reroute-js 0.15.1 → 0.16.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/cli/bin.d.ts +1 -1
- package/cli/bin.js +59 -9
- package/cli/bin.js.map +3 -3
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +55 -5
- package/core/index.js.map +3 -3
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/scripts.d.ts +1 -1
- package/core/src/ssr/lib/scripts.d.ts.map +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +55 -5
- package/elysia/index.js.map +3 -3
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +29 -6
- package/react/index.js.map +4 -4
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +7 -1
- package/react/src/hooks/useContent.d.ts.map +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts.map +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
package/cli/bin.d.ts
CHANGED
package/cli/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
/**
|
|
4
|
-
* reroute-js v0.
|
|
4
|
+
* reroute-js v0.16.0
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -47,7 +47,7 @@ async function getVersionString() {
|
|
|
47
47
|
}
|
|
48
48
|
async function getVersion() {
|
|
49
49
|
if (true) {
|
|
50
|
-
return "0.
|
|
50
|
+
return "0.16.0";
|
|
51
51
|
}
|
|
52
52
|
const possiblePaths = [
|
|
53
53
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -65,7 +65,7 @@ async function getVersion() {
|
|
|
65
65
|
}
|
|
66
66
|
async function getCommit() {
|
|
67
67
|
if (true) {
|
|
68
|
-
return "
|
|
68
|
+
return "b8bc515";
|
|
69
69
|
}
|
|
70
70
|
return "dev";
|
|
71
71
|
}
|
|
@@ -2380,6 +2380,39 @@ function createFeedsScript() {
|
|
|
2380
2380
|
return "";
|
|
2381
2381
|
}
|
|
2382
2382
|
}
|
|
2383
|
+
function pickFields(item, fields) {
|
|
2384
|
+
const result = {};
|
|
2385
|
+
const mandatory = ["collection", "name", "slug", "href", "module"];
|
|
2386
|
+
for (const field of mandatory) {
|
|
2387
|
+
if (item[field] !== undefined) {
|
|
2388
|
+
result[field] = item[field];
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
for (const field of fields) {
|
|
2392
|
+
const parts = field.split(".");
|
|
2393
|
+
let src = item;
|
|
2394
|
+
let dst = result;
|
|
2395
|
+
let valid = true;
|
|
2396
|
+
for (let i = 0;i < parts.length - 1; i++) {
|
|
2397
|
+
const key = parts[i];
|
|
2398
|
+
src = src?.[key];
|
|
2399
|
+
if (src === undefined) {
|
|
2400
|
+
valid = false;
|
|
2401
|
+
break;
|
|
2402
|
+
}
|
|
2403
|
+
if (!dst[key])
|
|
2404
|
+
dst[key] = {};
|
|
2405
|
+
dst = dst[key];
|
|
2406
|
+
}
|
|
2407
|
+
if (valid) {
|
|
2408
|
+
const lastKey = parts[parts.length - 1];
|
|
2409
|
+
if (src && src[lastKey] !== undefined) {
|
|
2410
|
+
dst[lastKey] = src[lastKey];
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
return result;
|
|
2415
|
+
}
|
|
2383
2416
|
function processCollections(accessedCollections, byCollectionForSSR) {
|
|
2384
2417
|
const sortByDate = (order) => (a, b) => {
|
|
2385
2418
|
const da = a?.meta?.date ? Date.parse(String(a.meta.date)) : 0;
|
|
@@ -2390,13 +2423,19 @@ function processCollections(accessedCollections, byCollectionForSSR) {
|
|
|
2390
2423
|
if (accessedCollections && typeof accessedCollections.forEach === "function") {
|
|
2391
2424
|
accessedCollections.forEach((c) => {
|
|
2392
2425
|
if (typeof c === "string")
|
|
2393
|
-
usage[c] = {
|
|
2426
|
+
usage[c] = {
|
|
2427
|
+
limit: Number.POSITIVE_INFINITY,
|
|
2428
|
+
sort: "custom",
|
|
2429
|
+
fields: "all"
|
|
2430
|
+
};
|
|
2394
2431
|
});
|
|
2395
2432
|
} else if (accessedCollections && typeof accessedCollections === "object") {
|
|
2396
2433
|
for (const [k, v] of Object.entries(accessedCollections)) {
|
|
2397
2434
|
const lim = typeof v?.limit === "number" ? v.limit : Number.POSITIVE_INFINITY;
|
|
2398
2435
|
const s = typeof v?.sort === "string" ? v.sort : "custom";
|
|
2399
|
-
|
|
2436
|
+
const slugs = v?.slugs instanceof Set ? v.slugs : undefined;
|
|
2437
|
+
const fields = v?.fields === "all" || v?.fields instanceof Set ? v.fields : "all";
|
|
2438
|
+
usage[k] = { limit: lim, sort: s, slugs, fields };
|
|
2400
2439
|
}
|
|
2401
2440
|
}
|
|
2402
2441
|
const collections = Object.keys(usage);
|
|
@@ -2415,8 +2454,19 @@ function processCollections(accessedCollections, byCollectionForSSR) {
|
|
|
2415
2454
|
arr = full.slice(0, conf.limit);
|
|
2416
2455
|
}
|
|
2417
2456
|
}
|
|
2457
|
+
if (conf.fields !== "all" && conf.fields instanceof Set) {
|
|
2458
|
+
const fields = conf.fields;
|
|
2459
|
+
const slugs = conf.slugs || new Set;
|
|
2460
|
+
arr = arr.map((item) => {
|
|
2461
|
+
const doc = item;
|
|
2462
|
+
if (doc.slug && slugs.has(doc.slug)) {
|
|
2463
|
+
return doc;
|
|
2464
|
+
}
|
|
2465
|
+
return pickFields(doc, fields);
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2418
2468
|
subset[c] = arr;
|
|
2419
|
-
partial[c] = Array.isArray(arr) && Array.isArray(full)
|
|
2469
|
+
partial[c] = Array.isArray(arr) && Array.isArray(full) && arr.length < full.length || conf.fields !== "all";
|
|
2420
2470
|
}
|
|
2421
2471
|
return { subset, partial };
|
|
2422
2472
|
}
|
|
@@ -7563,7 +7613,7 @@ async function getVersionString2() {
|
|
|
7563
7613
|
}
|
|
7564
7614
|
async function getVersion2() {
|
|
7565
7615
|
if (true) {
|
|
7566
|
-
return "0.
|
|
7616
|
+
return "0.16.0";
|
|
7567
7617
|
}
|
|
7568
7618
|
const possiblePaths = [
|
|
7569
7619
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -7580,10 +7630,10 @@ async function getVersion2() {
|
|
|
7580
7630
|
}
|
|
7581
7631
|
async function getCommit2() {
|
|
7582
7632
|
if (true) {
|
|
7583
|
-
return "
|
|
7633
|
+
return "b8bc515";
|
|
7584
7634
|
}
|
|
7585
7635
|
return "dev";
|
|
7586
7636
|
}
|
|
7587
7637
|
main();
|
|
7588
7638
|
|
|
7589
|
-
//# debugId=
|
|
7639
|
+
//# debugId=30740D5F0C39AC8F64756E2164756E21
|