@real-router/route-utils 0.1.6 → 0.1.7
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/dist/cjs/index.js +1 -1
- package/dist/cjs/metafile-cjs.json +1 -1
- package/package.json +4 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e,t){return e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`)}var t=/^[\w.-]+$/,n=e=>e.replaceAll(/[$()*+.?[\\\]^{|}-]/g,String.raw`\$&`),s=(e,s)=>{const r=new Map,i=i=>{const a=r.get(i);if(a)return a;if(i.length>1e4)throw new RangeError("Segment exceeds maximum length of 10000 characters");if(!t.test(i))throw new TypeError("Segment contains invalid characters. Allowed: a-z, A-Z, 0-9, dot (.), dash (-), underscore (_)");const l=new RegExp(e+n(i)+s);return r.set(i,l),l};return(e,t)=>{const n="string"==typeof e?e:e.name;if("string"!=typeof n)return!1;if(0===n.length)return!1;if(null===t)return!1;if(void 0===t)return e=>{if("string"!=typeof e)throw new TypeError("Segment must be a string, got "+typeof e);return 0!==e.length&&i(e).test(n)};if("string"!=typeof t)throw new TypeError("Segment must be a string, got "+typeof t);return 0!==t.length&&i(t).test(n)}},r=`(?:${n(".")}|$)`,i=s("^",r),a=s(`(?:^|${n(".")})`,"$"),l=s(`(?:^|${n(".")})`,r),o=class{static startsWithSegment=i;static endsWithSegment=a;static includesSegment=l;static areRoutesRelated=e;#e;#t;constructor(e){this.#e=new Map,this.#t=new Map,this.#n(e,[])}getChain(e){return this.#e.get(e)}getSiblings(e){return this.#t.get(e)}isDescendantOf(e,t){return e!==t&&e.startsWith(`${t}.`)}#n(e,t){const{fullName:n}=e;""!==n&&t.push(n),this.#e.set(n,Object.freeze(""===n?[""]:[...t]));const s=e.nonAbsoluteChildren.map(e=>e.fullName);for(const t of e.nonAbsoluteChildren)this.#t.set(t.fullName,Object.freeze(s.filter(e=>e!==t.fullName)));for(const t of e.children.values())this.#t.has(t.fullName)||""===t.fullName||this.#t.set(t.fullName,Object.freeze([...s]));for(const n of e.children.values())this.#n(n,t);""!==n&&t.pop()}},h=new WeakMap;exports.RouteUtils=o,exports.areRoutesRelated=e,exports.endsWithSegment=a,exports.getRouteUtils=function(e){let t=h.get(e);return void 0===t&&(t=new o(e),h.set(e,t)),t},exports.includesSegment=l,exports.startsWithSegment=i;//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@
|
|
1
|
+
{"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/routeRelation.ts":{"bytes":994,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":515,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/segmentTesters.ts":{"bytes":8570,"imports":[{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/RouteUtils.ts":{"bytes":4855,"imports":[{"path":"src/routeRelation.ts","kind":"import-statement","original":"./routeRelation.js"},{"path":"src/segmentTesters.ts","kind":"import-statement","original":"./segmentTesters.js"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/getRouteUtils.ts":{"bytes":365,"imports":[{"path":"src/RouteUtils.ts","kind":"import-statement","original":"./RouteUtils.js"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":310,"imports":[{"path":"src/RouteUtils.ts","kind":"import-statement","original":"./RouteUtils.js"},{"path":"src/getRouteUtils.ts","kind":"import-statement","original":"./getRouteUtils.js"},{"path":"src/segmentTesters.ts","kind":"import-statement","original":"./segmentTesters.js"},{"path":"src/routeRelation.ts","kind":"import-statement","original":"./routeRelation.js"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":19334},"dist/cjs/index.js":{"imports":[],"exports":["RouteUtils","areRoutesRelated","endsWithSegment","getRouteUtils","includesSegment","startsWithSegment"],"entryPoint":"src/index.ts","inputs":{"src/routeRelation.ts":{"bytesInOutput":144},"src/constants.ts":{"bytesInOutput":105},"src/segmentTesters.ts":{"bytesInOutput":1998},"src/RouteUtils.ts":{"bytesInOutput":3891},"src/index.ts":{"bytesInOutput":0},"src/getRouteUtils.ts":{"bytesInOutput":215}},"bytes":6592}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/route-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Cached read-only query API for route tree structure",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"route-tree": "^0.3.4"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@real-router/types": "^0.
|
|
48
|
+
"@real-router/types": "^0.27.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"lint": "eslint --cache --ext .ts src/ tests/ --fix --max-warnings 0 --no-error-on-unmatched-pattern",
|
|
54
54
|
"test": "vitest run",
|
|
55
55
|
"test:properties": "vitest --config vitest.config.properties.mts --run",
|
|
56
|
-
"bench": "NODE_OPTIONS='--expose-gc --max-old-space-size=4096' npx tsx tests/benchmarks/index.ts"
|
|
56
|
+
"bench": "NODE_OPTIONS='--expose-gc --max-old-space-size=4096' npx tsx tests/benchmarks/index.ts",
|
|
57
|
+
"build:dist-only": "tsup"
|
|
57
58
|
}
|
|
58
59
|
}
|