reroute-js 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +8 -3
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +2701 -1078
- package/cli/bin.js.map +54 -43
- package/cli/index.d.ts +1 -1
- package/cli/index.js +661 -45
- package/cli/index.js.map +56 -7
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts.map +1 -1
- package/cli/src/commands/build.d.ts +6 -3
- package/cli/src/commands/build.d.ts.map +1 -1
- package/cli/src/commands/dev.d.ts +6 -6
- package/cli/src/commands/dev.d.ts.map +1 -1
- package/cli/src/commands/gen.d.ts +4 -1
- package/cli/src/commands/gen.d.ts.map +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/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +7 -1
- package/cli/src/commands/lib/bundler.d.ts.map +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +4 -3
- package/cli/src/commands/lib/env.d.ts.map +1 -1
- package/cli/src/commands/lib/images.d.ts +12 -0
- package/cli/src/commands/lib/images.d.ts.map +1 -0
- 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 +11 -1
- package/cli/src/commands/lib/markdown/processor.d.ts.map +1 -1
- package/cli/src/commands/lib/prerender.d.ts +40 -0
- package/cli/src/commands/lib/prerender.d.ts.map +1 -0
- package/cli/src/commands/lib/production.d.ts +3 -3
- package/cli/src/commands/lib/production.d.ts.map +1 -1
- package/cli/src/commands/lib/server.d.ts +2 -1
- package/cli/src/commands/lib/server.d.ts.map +1 -1
- package/cli/src/commands/lib/static.d.ts +86 -0
- package/cli/src/commands/lib/static.d.ts.map +1 -0
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +2 -2
- package/cli/src/commands/lib/streaming/suspense.d.ts.map +1 -1
- package/cli/src/commands/lib/supervise.d.ts +23 -0
- package/cli/src/commands/lib/supervise.d.ts.map +1 -0
- package/cli/src/commands/lib/terminal-ui.d.ts +2 -2
- package/cli/src/commands/lib/terminal-ui.d.ts.map +1 -1
- package/cli/src/commands/lib/theme.d.ts +9 -4
- package/cli/src/commands/lib/theme.d.ts.map +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/lib/watch.d.ts +37 -0
- package/cli/src/commands/lib/watch.d.ts.map +1 -0
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/og.d.ts.map +1 -1
- package/cli/src/commands/start.d.ts +2 -2
- package/cli/src/commands/start.d.ts.map +1 -1
- package/cli/src/commands/static-render.d.ts +18 -0
- package/cli/src/commands/static-render.d.ts.map +1 -0
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +798 -295
- package/core/index.js.map +30 -27
- package/core/src/app-paths.d.ts +32 -0
- package/core/src/app-paths.d.ts.map +1 -0
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +98 -7
- package/core/src/config.d.ts.map +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/i18n/catalog.d.ts +1 -1
- package/core/src/i18n/discover.d.ts +1 -1
- package/core/src/i18n/index.d.ts +1 -1
- package/core/src/i18n/messages.d.ts +1 -1
- package/core/src/i18n/negotiate.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts.map +1 -1
- package/core/src/i18n/resolve.d.ts +4 -3
- package/core/src/i18n/resolve.d.ts.map +1 -1
- package/core/src/i18n/types.d.ts +5 -1
- package/core/src/i18n/types.d.ts.map +1 -1
- package/core/src/image.d.ts +29 -0
- package/core/src/image.d.ts.map +1 -0
- package/core/src/index.d.ts +3 -1
- package/core/src/index.d.ts.map +1 -1
- package/core/src/llms/discovery.d.ts +35 -0
- package/core/src/llms/discovery.d.ts.map +1 -0
- package/core/src/llms/extractor.d.ts +6 -1
- package/core/src/llms/extractor.d.ts.map +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/formatter.d.ts.map +1 -1
- package/core/src/llms/full-generator.d.ts +3 -1
- package/core/src/llms/full-generator.d.ts.map +1 -1
- package/core/src/llms/index-generator.d.ts +6 -3
- package/core/src/llms/index-generator.d.ts.map +1 -1
- package/core/src/llms/index.d.ts +5 -2
- package/core/src/llms/index.d.ts.map +1 -1
- package/core/src/og/discovery.d.ts +8 -1
- package/core/src/og/discovery.d.ts.map +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/generator.d.ts.map +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +2 -2
- package/core/src/rss/discovery.d.ts.map +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 +7 -2
- package/core/src/sitemap/discovery.d.ts.map +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/cleanup.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +17 -1
- package/core/src/ssr/lib/collections.d.ts.map +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/content-path.d.ts +1 -1
- package/core/src/ssr/lib/content-path.d.ts.map +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/imports.d.ts +8 -3
- package/core/src/ssr/lib/imports.d.ts.map +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +6 -1
- package/core/src/ssr/lib/layouts.d.ts.map +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/route-match.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +2 -2
- package/core/src/ssr/lib/scripts/collections.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +6 -1
- package/core/src/ssr/lib/seed.d.ts.map +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +2 -2
- package/core/src/ssr/lib/setup.d.ts.map +1 -1
- package/core/src/ssr/lib/styles.d.ts +5 -4
- package/core/src/ssr/lib/styles.d.ts.map +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +15 -1
- package/core/src/ssr/lib/types.d.ts.map +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/render.d.ts.map +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/core/src/ssr/stream.d.ts.map +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +1331 -537
- package/elysia/index.js.map +45 -38
- package/elysia/src/index.d.ts +2 -1
- package/elysia/src/index.d.ts.map +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +6 -1
- package/elysia/src/libs/cache.d.ts.map +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/devReload.d.ts +53 -0
- package/elysia/src/libs/devReload.d.ts.map +1 -0
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/i18n.d.ts +2 -2
- package/elysia/src/libs/i18n.d.ts.map +1 -1
- package/elysia/src/libs/image.d.ts +30 -1
- package/elysia/src/libs/image.d.ts.map +1 -1
- package/elysia/src/libs/index.d.ts +2 -2
- package/elysia/src/libs/index.d.ts.map +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/plugin.d.ts.map +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts.map +1 -1
- package/elysia/src/routes/content.d.ts +2 -2
- package/elysia/src/routes/content.d.ts.map +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +7 -1
- package/elysia/src/routes/internal.d.ts.map +1 -1
- package/elysia/src/routes/liveReloadClient.d.ts +16 -0
- package/elysia/src/routes/liveReloadClient.d.ts.map +1 -0
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts.map +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +3 -1
- package/elysia/src/routes/robots.d.ts.map +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +3 -1
- package/elysia/src/routes/sitemap.d.ts.map +1 -1
- package/elysia/src/routes/ssr.d.ts +4 -2
- package/elysia/src/routes/ssr.d.ts.map +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/routes/themeCssRefresh.d.ts +17 -0
- package/elysia/src/routes/themeCssRefresh.d.ts.map +1 -0
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +407 -189
- package/react/index.js.map +18 -15
- 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 +5 -1
- package/react/src/components/Image.d.ts.map +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +16 -4
- package/react/src/components/Link.d.ts.map +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Markdown.d.ts.map +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 +1 -1
- package/react/src/hooks/useContent.d.ts.map +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useData.d.ts.map +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +11 -1
- package/react/src/hooks/useLayoutData.d.ts.map +1 -1
- package/react/src/hooks/useLlms.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/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/i18n/LocaleProvider.d.ts +1 -1
- package/react/src/i18n/LocaleProvider.d.ts.map +1 -1
- package/react/src/i18n/helpers.d.ts +1 -1
- package/react/src/i18n/helpers.d.ts.map +1 -1
- package/react/src/i18n/index.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/bundle.d.ts +27 -0
- package/react/src/lib/bundle.d.ts.map +1 -0
- package/react/src/lib/collection.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 +3 -1
- package/react/src/lib/index.d.ts.map +1 -1
- package/react/src/lib/layouts.d.ts +16 -0
- package/react/src/lib/layouts.d.ts.map +1 -0
- package/react/src/lib/lazy-route.d.ts +10 -19
- package/react/src/lib/lazy-route.d.ts.map +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/lib/static-data.d.ts +25 -0
- package/react/src/lib/static-data.d.ts.map +1 -0
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +2 -2
- package/react/src/providers/RerouteProvider.d.ts.map +1 -1
- package/react/src/providers/RouterProvider.d.ts +28 -2
- package/react/src/providers/RouterProvider.d.ts.map +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 +9 -1
- package/react/src/types/router.d.ts.map +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +16 -16
- package/telemetry/react.js.map +2 -2
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +68 -229
- package/telemetry/server.js.map +22 -17
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v1.0.0-alpha.
|
|
2
|
+
* reroute-js v1.0.0-alpha.30
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -8,8 +8,572 @@
|
|
|
8
8
|
* Built with Bun <3
|
|
9
9
|
*/
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
11
12
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
13
|
|
|
14
|
+
// packages/core/src/app-paths.ts
|
|
15
|
+
import { posix } from "node:path";
|
|
16
|
+
function toPosix(p) {
|
|
17
|
+
return p.replace(/\\/g, "/");
|
|
18
|
+
}
|
|
19
|
+
function resolveAppPaths(config = {}) {
|
|
20
|
+
const src = config.app?.src ?? DEFAULT_APP_SRC;
|
|
21
|
+
const server = config.app?.server ?? DEFAULT_APP_SERVER;
|
|
22
|
+
const clientDir = toPosix(posix.dirname(src));
|
|
23
|
+
return {
|
|
24
|
+
src,
|
|
25
|
+
clientDir,
|
|
26
|
+
routesDir: toPosix(posix.join(clientDir, "routes")),
|
|
27
|
+
cssEntry: toPosix(posix.join(clientDir, "index.css")),
|
|
28
|
+
assetsDir: toPosix(posix.join(clientDir, "assets")),
|
|
29
|
+
server
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var DEFAULT_APP_SRC = "./src/client/App", DEFAULT_APP_SERVER = "./src/index.ts";
|
|
33
|
+
var init_app_paths = () => {};
|
|
34
|
+
// packages/core/src/bundler/index.ts
|
|
35
|
+
var init_bundler = () => {};
|
|
36
|
+
|
|
37
|
+
// packages/core/src/config.ts
|
|
38
|
+
import { pathToFileURL } from "node:url";
|
|
39
|
+
async function loadConfig(cwd) {
|
|
40
|
+
const bundledConfig = globalThis.__REROUTE_CONFIG__;
|
|
41
|
+
if (bundledConfig) {
|
|
42
|
+
return bundledConfig;
|
|
43
|
+
}
|
|
44
|
+
const configPath = `${cwd}/reroute.config.ts`;
|
|
45
|
+
const configFile = Bun.file(configPath);
|
|
46
|
+
if (!await configFile.exists()) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const mod = await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`);
|
|
51
|
+
return mod.default || mod;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.warn("[reroute] Failed to load reroute.config.ts:", error);
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var init_config = () => {};
|
|
58
|
+
// packages/core/src/content/discovery.ts
|
|
59
|
+
var init_discovery = () => {};
|
|
60
|
+
|
|
61
|
+
// packages/core/src/content/metadata.ts
|
|
62
|
+
var init_metadata = () => {};
|
|
63
|
+
|
|
64
|
+
// packages/core/src/content/index.ts
|
|
65
|
+
var init_content = __esm(() => {
|
|
66
|
+
init_discovery();
|
|
67
|
+
init_metadata();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// packages/core/src/i18n/catalog.ts
|
|
71
|
+
var init_catalog = () => {};
|
|
72
|
+
|
|
73
|
+
// packages/core/src/i18n/discover.ts
|
|
74
|
+
var init_discover = () => {};
|
|
75
|
+
|
|
76
|
+
// packages/core/src/i18n/messages.ts
|
|
77
|
+
import { IntlMessageFormat } from "intl-messageformat";
|
|
78
|
+
var formatterCache;
|
|
79
|
+
var init_messages = __esm(() => {
|
|
80
|
+
init_catalog();
|
|
81
|
+
formatterCache = new Map;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// packages/core/src/i18n/negotiate.ts
|
|
85
|
+
var init_negotiate = () => {};
|
|
86
|
+
|
|
87
|
+
// packages/core/src/i18n/pathname.ts
|
|
88
|
+
var init_pathname = () => {};
|
|
89
|
+
|
|
90
|
+
// packages/core/src/i18n/resolve.ts
|
|
91
|
+
var init_resolve = __esm(() => {
|
|
92
|
+
init_discover();
|
|
93
|
+
init_negotiate();
|
|
94
|
+
init_pathname();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// packages/core/src/i18n/index.ts
|
|
98
|
+
var init_i18n = __esm(() => {
|
|
99
|
+
init_catalog();
|
|
100
|
+
init_discover();
|
|
101
|
+
init_messages();
|
|
102
|
+
init_negotiate();
|
|
103
|
+
init_pathname();
|
|
104
|
+
init_resolve();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// packages/core/src/image.ts
|
|
108
|
+
var init_image = () => {};
|
|
109
|
+
|
|
110
|
+
// packages/telemetry/src/server/context.ts
|
|
111
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
112
|
+
var contextStorage;
|
|
113
|
+
var init_context = __esm(() => {
|
|
114
|
+
contextStorage = new AsyncLocalStorage;
|
|
115
|
+
});
|
|
116
|
+
// packages/telemetry/src/server/headers/presets.ts
|
|
117
|
+
var init_presets = () => {};
|
|
118
|
+
|
|
119
|
+
// packages/telemetry/src/server/headers/index.ts
|
|
120
|
+
var init_headers = __esm(() => {
|
|
121
|
+
init_presets();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// packages/telemetry/src/server/instrumentation.ts
|
|
125
|
+
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
126
|
+
|
|
127
|
+
class NoopSpan {
|
|
128
|
+
spanContext() {
|
|
129
|
+
return {
|
|
130
|
+
traceId: "",
|
|
131
|
+
spanId: "",
|
|
132
|
+
traceFlags: 0
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
setAttribute() {
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
setAttributes() {
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
addEvent() {
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
addLink() {
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
addLinks() {
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
setStatus() {
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
updateName() {
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
end() {}
|
|
157
|
+
isRecording() {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
recordException() {}
|
|
161
|
+
}
|
|
162
|
+
var noopSpan;
|
|
163
|
+
var init_instrumentation = __esm(() => {
|
|
164
|
+
noopSpan = new NoopSpan;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// packages/telemetry/src/server/sourcemap.ts
|
|
168
|
+
import { SourceMapConsumer } from "source-map";
|
|
169
|
+
var sourcemapCache;
|
|
170
|
+
var init_sourcemap = __esm(() => {
|
|
171
|
+
sourcemapCache = new Map;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// packages/telemetry/src/server/plugin.ts
|
|
175
|
+
import {
|
|
176
|
+
context as context2,
|
|
177
|
+
metrics,
|
|
178
|
+
SpanStatusCode as SpanStatusCode2,
|
|
179
|
+
trace as trace2
|
|
180
|
+
} from "@opentelemetry/api";
|
|
181
|
+
import { logs, SeverityNumber } from "@opentelemetry/api-logs";
|
|
182
|
+
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
|
|
183
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
|
|
184
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
|
185
|
+
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
186
|
+
import {
|
|
187
|
+
BatchLogRecordProcessor,
|
|
188
|
+
LoggerProvider
|
|
189
|
+
} from "@opentelemetry/sdk-logs";
|
|
190
|
+
import {
|
|
191
|
+
MeterProvider,
|
|
192
|
+
PeriodicExportingMetricReader
|
|
193
|
+
} from "@opentelemetry/sdk-metrics";
|
|
194
|
+
import {
|
|
195
|
+
BatchSpanProcessor,
|
|
196
|
+
NodeTracerProvider
|
|
197
|
+
} from "@opentelemetry/sdk-trace-node";
|
|
198
|
+
import {
|
|
199
|
+
ATTR_SERVICE_NAME,
|
|
200
|
+
ATTR_SERVICE_VERSION
|
|
201
|
+
} from "@opentelemetry/semantic-conventions";
|
|
202
|
+
import { ATTR_HOST_NAME } from "@opentelemetry/semantic-conventions/incubating";
|
|
203
|
+
var init_plugin = __esm(() => {
|
|
204
|
+
init_core();
|
|
205
|
+
init_context();
|
|
206
|
+
init_instrumentation();
|
|
207
|
+
init_sourcemap();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// packages/telemetry/src/server/index.ts
|
|
211
|
+
var init_server = __esm(() => {
|
|
212
|
+
init_context();
|
|
213
|
+
init_headers();
|
|
214
|
+
init_instrumentation();
|
|
215
|
+
init_plugin();
|
|
216
|
+
init_sourcemap();
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// packages/telemetry/server.ts
|
|
220
|
+
var init_server2 = __esm(() => {
|
|
221
|
+
init_server();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// packages/core/src/ssr/lib/cache.ts
|
|
225
|
+
class SSRDataCache {
|
|
226
|
+
cache = new Map;
|
|
227
|
+
static cleanupInterval = null;
|
|
228
|
+
constructor() {
|
|
229
|
+
if (!SSRDataCache.cleanupInterval) {
|
|
230
|
+
SSRDataCache.cleanupInterval = setInterval(() => {
|
|
231
|
+
this.cleanup();
|
|
232
|
+
}, 60000);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
get(key) {
|
|
236
|
+
const entry = this.cache.get(key);
|
|
237
|
+
if (!entry)
|
|
238
|
+
return;
|
|
239
|
+
const age = Date.now() - entry.timestamp;
|
|
240
|
+
if (age > entry.maxAge) {
|
|
241
|
+
this.cache.delete(key);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return entry.data;
|
|
245
|
+
}
|
|
246
|
+
set(key, data, maxAge) {
|
|
247
|
+
if (maxAge <= 0)
|
|
248
|
+
return;
|
|
249
|
+
this.cache.set(key, {
|
|
250
|
+
data,
|
|
251
|
+
timestamp: Date.now(),
|
|
252
|
+
maxAge
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
has(key) {
|
|
256
|
+
return this.get(key) !== undefined;
|
|
257
|
+
}
|
|
258
|
+
clear() {
|
|
259
|
+
this.cache.clear();
|
|
260
|
+
}
|
|
261
|
+
cleanup() {
|
|
262
|
+
const now = Date.now();
|
|
263
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
264
|
+
if (now - entry.timestamp > entry.maxAge) {
|
|
265
|
+
this.cache.delete(key);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
stats() {
|
|
270
|
+
return {
|
|
271
|
+
size: this.cache.size,
|
|
272
|
+
keys: Array.from(this.cache.keys())
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
destroy() {
|
|
276
|
+
if (SSRDataCache.cleanupInterval) {
|
|
277
|
+
clearInterval(SSRDataCache.cleanupInterval);
|
|
278
|
+
SSRDataCache.cleanupInterval = null;
|
|
279
|
+
}
|
|
280
|
+
this.clear();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
var getGlobalCache = () => {
|
|
284
|
+
const g = globalThis;
|
|
285
|
+
if (!g.__REROUTE_SSR_CACHE__) {
|
|
286
|
+
g.__REROUTE_SSR_CACHE__ = new SSRDataCache;
|
|
287
|
+
}
|
|
288
|
+
return g.__REROUTE_SSR_CACHE__;
|
|
289
|
+
}, getGlobalStatusCache = () => {
|
|
290
|
+
const g = globalThis;
|
|
291
|
+
if (!g.__REROUTE_STATUS_CACHE__) {
|
|
292
|
+
g.__REROUTE_STATUS_CACHE__ = new SSRDataCache;
|
|
293
|
+
}
|
|
294
|
+
return g.__REROUTE_STATUS_CACHE__;
|
|
295
|
+
}, ssrCache, statusCache;
|
|
296
|
+
var init_cache = __esm(() => {
|
|
297
|
+
ssrCache = getGlobalCache();
|
|
298
|
+
statusCache = getGlobalStatusCache();
|
|
299
|
+
});
|
|
300
|
+
// packages/core/src/ssr/lib/imports.ts
|
|
301
|
+
var watchImportCache;
|
|
302
|
+
var init_imports = __esm(() => {
|
|
303
|
+
watchImportCache = new Map;
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// packages/core/src/ssr/lib/collections.ts
|
|
307
|
+
var init_collections = __esm(() => {
|
|
308
|
+
init_imports();
|
|
309
|
+
});
|
|
310
|
+
// packages/core/src/ssr/lib/compression.ts
|
|
311
|
+
var init_compression = () => {};
|
|
312
|
+
// packages/core/src/ssr/lib/content-path.ts
|
|
313
|
+
var init_content_path = __esm(() => {
|
|
314
|
+
init_pathname();
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// packages/core/src/ssr/lib/compute/content.ts
|
|
318
|
+
var init_content2 = __esm(() => {
|
|
319
|
+
init_cache();
|
|
320
|
+
init_content_path();
|
|
321
|
+
init_imports();
|
|
322
|
+
});
|
|
323
|
+
// packages/core/src/ssr/lib/compute/layouts.ts
|
|
324
|
+
var init_layouts = __esm(() => {
|
|
325
|
+
init_cache();
|
|
326
|
+
init_imports();
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// packages/core/src/ssr/lib/compute/routes.ts
|
|
330
|
+
var init_routes = __esm(() => {
|
|
331
|
+
init_cache();
|
|
332
|
+
init_content_path();
|
|
333
|
+
init_imports();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// packages/core/src/ssr/lib/compute/index.ts
|
|
337
|
+
var init_compute = __esm(() => {
|
|
338
|
+
init_imports();
|
|
339
|
+
init_content2();
|
|
340
|
+
init_layouts();
|
|
341
|
+
init_routes();
|
|
342
|
+
init_content2();
|
|
343
|
+
init_layouts();
|
|
344
|
+
init_routes();
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// packages/core/src/ssr/lib/modules.ts
|
|
348
|
+
var init_modules = __esm(() => {
|
|
349
|
+
init_content_path();
|
|
350
|
+
init_imports();
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// packages/core/src/ssr/lib/seed.ts
|
|
354
|
+
var init_seed = __esm(() => {
|
|
355
|
+
init_content_path();
|
|
356
|
+
init_modules();
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// packages/core/src/ssr/lib/data.ts
|
|
360
|
+
var init_data = __esm(() => {
|
|
361
|
+
init_content_path();
|
|
362
|
+
init_imports();
|
|
363
|
+
init_seed();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// packages/core/src/ssr/lib/html.ts
|
|
367
|
+
var init_html = () => {};
|
|
368
|
+
|
|
369
|
+
// packages/core/src/og/discovery.ts
|
|
370
|
+
var init_discovery2 = __esm(() => {
|
|
371
|
+
init_app_paths();
|
|
372
|
+
init_config();
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// packages/core/src/og/meta.ts
|
|
376
|
+
var init_meta = __esm(() => {
|
|
377
|
+
init_discovery2();
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// packages/core/src/ssr/lib/metadata.ts
|
|
381
|
+
var init_metadata2 = __esm(() => {
|
|
382
|
+
init_metadata();
|
|
383
|
+
init_pathname();
|
|
384
|
+
init_meta();
|
|
385
|
+
init_compute();
|
|
386
|
+
init_content_path();
|
|
387
|
+
init_imports();
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// packages/core/src/ssr/lib/preload.ts
|
|
391
|
+
var init_preload = __esm(() => {
|
|
392
|
+
init_imports();
|
|
393
|
+
});
|
|
394
|
+
// packages/core/src/ssr/lib/scripts/collections.ts
|
|
395
|
+
var init_collections2 = () => {};
|
|
396
|
+
|
|
397
|
+
// packages/core/src/ssr/lib/scripts/data.ts
|
|
398
|
+
var init_data2 = __esm(() => {
|
|
399
|
+
init_content_path();
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// packages/core/src/ssr/lib/scripts/feeds.ts
|
|
403
|
+
var init_feeds = () => {};
|
|
404
|
+
|
|
405
|
+
// packages/core/src/ssr/lib/scripts/index.ts
|
|
406
|
+
var init_scripts = __esm(() => {
|
|
407
|
+
init_collections2();
|
|
408
|
+
init_data2();
|
|
409
|
+
init_feeds();
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// packages/core/src/ssr/lib/styles.ts
|
|
413
|
+
var init_styles = () => {};
|
|
414
|
+
|
|
415
|
+
// packages/core/src/ssr/lib/setup.ts
|
|
416
|
+
var init_setup = __esm(() => {
|
|
417
|
+
init_server2();
|
|
418
|
+
init_collections();
|
|
419
|
+
init_compute();
|
|
420
|
+
init_metadata2();
|
|
421
|
+
init_preload();
|
|
422
|
+
init_scripts();
|
|
423
|
+
init_seed();
|
|
424
|
+
init_styles();
|
|
425
|
+
});
|
|
426
|
+
// packages/core/src/ssr/lib/index.ts
|
|
427
|
+
var init_lib = __esm(() => {
|
|
428
|
+
init_data();
|
|
429
|
+
init_cache();
|
|
430
|
+
init_collections();
|
|
431
|
+
init_compression();
|
|
432
|
+
init_compute();
|
|
433
|
+
init_html();
|
|
434
|
+
init_imports();
|
|
435
|
+
init_metadata2();
|
|
436
|
+
init_modules();
|
|
437
|
+
init_preload();
|
|
438
|
+
init_scripts();
|
|
439
|
+
init_seed();
|
|
440
|
+
init_setup();
|
|
441
|
+
init_styles();
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
// packages/core/src/ssr/render.ts
|
|
445
|
+
import dedent from "dedent";
|
|
446
|
+
import { cloneElement } from "react";
|
|
447
|
+
import { renderToString } from "react-dom/server";
|
|
448
|
+
var init_render = __esm(() => {
|
|
449
|
+
init_server2();
|
|
450
|
+
init_config();
|
|
451
|
+
init_discovery3();
|
|
452
|
+
init_lib();
|
|
453
|
+
init_html();
|
|
454
|
+
});
|
|
455
|
+
// packages/core/src/llms/extractor.ts
|
|
456
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
457
|
+
var init_extractor = __esm(() => {
|
|
458
|
+
init_render();
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// packages/core/src/llms/discovery.ts
|
|
462
|
+
var init_discovery3 = __esm(() => {
|
|
463
|
+
init_extractor();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// packages/core/src/llms/full-generator.ts
|
|
467
|
+
var init_full_generator = __esm(() => {
|
|
468
|
+
init_extractor();
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// packages/core/src/llms/index-generator.ts
|
|
472
|
+
var init_index_generator = __esm(() => {
|
|
473
|
+
init_app_paths();
|
|
474
|
+
init_config();
|
|
475
|
+
init_extractor();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// packages/core/src/llms/index.ts
|
|
479
|
+
var init_llms = __esm(() => {
|
|
480
|
+
init_discovery3();
|
|
481
|
+
init_extractor();
|
|
482
|
+
init_full_generator();
|
|
483
|
+
init_index_generator();
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
// packages/core/src/og/render.ts
|
|
487
|
+
import { createElement } from "react";
|
|
488
|
+
var init_render2 = () => {};
|
|
489
|
+
|
|
490
|
+
// packages/core/src/og/index.ts
|
|
491
|
+
var init_og = __esm(() => {
|
|
492
|
+
init_discovery2();
|
|
493
|
+
init_meta();
|
|
494
|
+
init_render2();
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
// packages/core/src/robots/discovery.ts
|
|
498
|
+
var init_discovery4 = () => {};
|
|
499
|
+
|
|
500
|
+
// packages/core/src/robots/generator.ts
|
|
501
|
+
var init_generator = __esm(() => {
|
|
502
|
+
init_discovery3();
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
// packages/core/src/robots/policies.ts
|
|
506
|
+
var init_policies = () => {};
|
|
507
|
+
|
|
508
|
+
// packages/core/src/robots/index.ts
|
|
509
|
+
var init_robots = __esm(() => {
|
|
510
|
+
init_discovery4();
|
|
511
|
+
init_generator();
|
|
512
|
+
init_policies();
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// packages/core/src/rss/discovery.ts
|
|
516
|
+
var init_discovery5 = __esm(() => {
|
|
517
|
+
init_app_paths();
|
|
518
|
+
init_config();
|
|
519
|
+
});
|
|
520
|
+
// packages/core/src/rss/index.ts
|
|
521
|
+
var init_rss = __esm(() => {
|
|
522
|
+
init_discovery5();
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// packages/core/src/sitemap/discovery.ts
|
|
526
|
+
var init_discovery6 = () => {};
|
|
527
|
+
|
|
528
|
+
// packages/core/src/sitemap/generator.ts
|
|
529
|
+
var init_generator2 = () => {};
|
|
530
|
+
|
|
531
|
+
// packages/core/src/sitemap/index.ts
|
|
532
|
+
var init_sitemap = __esm(() => {
|
|
533
|
+
init_discovery6();
|
|
534
|
+
init_generator2();
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// packages/core/src/ssr/stream.ts
|
|
538
|
+
import { cloneElement as cloneElement2 } from "react";
|
|
539
|
+
import { renderToReadableStream } from "react-dom/server";
|
|
540
|
+
var init_stream = __esm(() => {
|
|
541
|
+
init_server2();
|
|
542
|
+
init_config();
|
|
543
|
+
init_discovery3();
|
|
544
|
+
init_lib();
|
|
545
|
+
init_html();
|
|
546
|
+
init_imports();
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
// packages/core/src/ssr/index.ts
|
|
550
|
+
var init_ssr = __esm(() => {
|
|
551
|
+
init_lib();
|
|
552
|
+
init_render();
|
|
553
|
+
init_stream();
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// packages/core/src/index.ts
|
|
557
|
+
var init_src = __esm(() => {
|
|
558
|
+
init_app_paths();
|
|
559
|
+
init_bundler();
|
|
560
|
+
init_config();
|
|
561
|
+
init_content();
|
|
562
|
+
init_i18n();
|
|
563
|
+
init_image();
|
|
564
|
+
init_llms();
|
|
565
|
+
init_og();
|
|
566
|
+
init_robots();
|
|
567
|
+
init_rss();
|
|
568
|
+
init_sitemap();
|
|
569
|
+
init_ssr();
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
// packages/core/index.ts
|
|
573
|
+
var init_core = __esm(() => {
|
|
574
|
+
init_src();
|
|
575
|
+
});
|
|
576
|
+
|
|
13
577
|
// packages/cli/src/commands/lib/command.ts
|
|
14
578
|
import { existsSync } from "node:fs";
|
|
15
579
|
import { join } from "node:path";
|
|
@@ -296,6 +860,12 @@ function setupRemarkPlugins(cwd, enableGfm) {
|
|
|
296
860
|
}
|
|
297
861
|
return remarkPlugins;
|
|
298
862
|
}
|
|
863
|
+
function shikiRehypeOptions(theme) {
|
|
864
|
+
if (theme === "github-light" || theme === "github-dark") {
|
|
865
|
+
return { themes: { light: "github-light", dark: "github-dark" } };
|
|
866
|
+
}
|
|
867
|
+
return { theme };
|
|
868
|
+
}
|
|
299
869
|
function setupRehypePlugins(cwd, theme) {
|
|
300
870
|
const rehypePlugins = [];
|
|
301
871
|
const rehypeRaw = tryLoadModule(cwd, "rehype-raw");
|
|
@@ -316,7 +886,10 @@ function setupRehypePlugins(cwd, theme) {
|
|
|
316
886
|
}
|
|
317
887
|
const rehypeShiki = tryLoadModule(cwd, "@shikijs/rehype");
|
|
318
888
|
if (rehypeShiki) {
|
|
319
|
-
rehypePlugins.push([
|
|
889
|
+
rehypePlugins.push([
|
|
890
|
+
rehypeShiki.default || rehypeShiki,
|
|
891
|
+
shikiRehypeOptions(theme)
|
|
892
|
+
]);
|
|
320
893
|
} else {
|
|
321
894
|
console.warn("[reroute/mdx] @shikijs/rehype not available, skipping highlighting");
|
|
322
895
|
}
|
|
@@ -559,19 +1132,33 @@ function stripMarkdown(content) {
|
|
|
559
1132
|
return text;
|
|
560
1133
|
}
|
|
561
1134
|
// packages/cli/src/commands/lib/production.ts
|
|
1135
|
+
function hasProdFlag(args = []) {
|
|
1136
|
+
return args.includes("--prod") || args.includes("--production");
|
|
1137
|
+
}
|
|
562
1138
|
function isProductionMode(args = []) {
|
|
563
|
-
return args
|
|
1139
|
+
return hasProdFlag(args);
|
|
564
1140
|
}
|
|
565
1141
|
function ensureProductionEnv(args = []) {
|
|
566
|
-
if (args
|
|
1142
|
+
if (hasProdFlag(args)) {
|
|
567
1143
|
process.env.NODE_ENV = "production";
|
|
568
1144
|
Bun.env.NODE_ENV = "production";
|
|
569
1145
|
}
|
|
570
1146
|
}
|
|
571
1147
|
function filterProdFlag(args) {
|
|
572
|
-
return args.filter((arg) => arg !== "--prod");
|
|
1148
|
+
return args.filter((arg) => arg !== "--prod" && arg !== "--production");
|
|
573
1149
|
}
|
|
574
1150
|
// packages/cli/src/commands/lib/server.ts
|
|
1151
|
+
async function isServerRunning(port, timeout = 1000) {
|
|
1152
|
+
try {
|
|
1153
|
+
const response = await fetch(`http://localhost:${port}/`, {
|
|
1154
|
+
method: "GET",
|
|
1155
|
+
signal: AbortSignal.timeout(timeout)
|
|
1156
|
+
});
|
|
1157
|
+
return response.status < 500;
|
|
1158
|
+
} catch {
|
|
1159
|
+
return false;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
575
1162
|
async function waitForServerReady(port = 3000, timeout = 30000) {
|
|
576
1163
|
const startTime = Date.now();
|
|
577
1164
|
let checkInterval = 50;
|
|
@@ -592,13 +1179,21 @@ async function waitForServerReady(port = 3000, timeout = 30000) {
|
|
|
592
1179
|
throw new Error(`Timeout waiting for server to respond after ${timeout}ms. ` + `Make sure your server is starting correctly on port ${port}.`);
|
|
593
1180
|
}
|
|
594
1181
|
// packages/cli/src/commands/lib/theme.ts
|
|
1182
|
+
init_core();
|
|
1183
|
+
import { createHash } from "node:crypto";
|
|
595
1184
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
596
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
597
|
-
import { dirname as dirname3, isAbsolute, join as
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
1185
|
+
import { mkdir, readdir, unlink, writeFile } from "node:fs/promises";
|
|
1186
|
+
import { dirname as dirname3, isAbsolute, join as join5, resolve as resolve2 } from "node:path";
|
|
1187
|
+
var HASHED_THEME_RE = /^index\.[a-z0-9]{8,}\.css$/i;
|
|
1188
|
+
async function getCssPaths(cwd) {
|
|
1189
|
+
const paths = resolveAppPaths(await loadConfig(cwd));
|
|
1190
|
+
const input = join5(cwd, paths.cssEntry);
|
|
1191
|
+
const bundlesDir = join5(cwd, ".reroute/bundles");
|
|
1192
|
+
return { input, bundlesDir };
|
|
1193
|
+
}
|
|
1194
|
+
function themeCssFileName(css) {
|
|
1195
|
+
const hash2 = createHash("sha1").update(css).digest("hex").slice(0, 8);
|
|
1196
|
+
return `index.${hash2}.css`;
|
|
602
1197
|
}
|
|
603
1198
|
var IMPORT_RE = /@import\s+(?:url\(\s*)?(?:'([^']+)'|"([^"]+)"|([^'")\s]+))\s*\)?\s*([^;]*);/g;
|
|
604
1199
|
function isFileImport(specifier) {
|
|
@@ -608,6 +1203,12 @@ function isFileImport(specifier) {
|
|
|
608
1203
|
return true;
|
|
609
1204
|
}
|
|
610
1205
|
function bundleCssEntrypoint(entryPath) {
|
|
1206
|
+
return walkCssEntrypoint(entryPath).css;
|
|
1207
|
+
}
|
|
1208
|
+
function cssEntrypointFiles(entryPath) {
|
|
1209
|
+
return walkCssEntrypoint(entryPath).files;
|
|
1210
|
+
}
|
|
1211
|
+
function walkCssEntrypoint(entryPath) {
|
|
611
1212
|
const absEntry = resolve2(entryPath);
|
|
612
1213
|
const stack = new Set;
|
|
613
1214
|
const completed = new Set;
|
|
@@ -640,17 +1241,29 @@ ${bundleFile(importedPath)}
|
|
|
640
1241
|
completed.add(absPath);
|
|
641
1242
|
return bundled;
|
|
642
1243
|
}
|
|
643
|
-
|
|
1244
|
+
const css = bundleFile(absEntry);
|
|
1245
|
+
return { css, files: [...completed] };
|
|
1246
|
+
}
|
|
1247
|
+
async function pruneStaleThemeCss(bundlesDir, keep) {
|
|
1248
|
+
const files = await readdir(bundlesDir);
|
|
1249
|
+
for (const file of files) {
|
|
1250
|
+
if (HASHED_THEME_RE.test(file) && file !== keep) {
|
|
1251
|
+
await unlink(join5(bundlesDir, file));
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
644
1254
|
}
|
|
645
1255
|
async function syncThemeCss(cwd) {
|
|
646
|
-
const { input,
|
|
1256
|
+
const { input, bundlesDir } = await getCssPaths(cwd);
|
|
647
1257
|
if (!existsSync4(input)) {
|
|
648
1258
|
return false;
|
|
649
1259
|
}
|
|
650
|
-
await mkdir(
|
|
1260
|
+
await mkdir(bundlesDir, { recursive: true });
|
|
651
1261
|
try {
|
|
652
1262
|
const css = bundleCssEntrypoint(input);
|
|
653
|
-
|
|
1263
|
+
const hashedName = themeCssFileName(css);
|
|
1264
|
+
await writeFile(join5(bundlesDir, "index.css"), css, "utf-8");
|
|
1265
|
+
await writeFile(join5(bundlesDir, hashedName), css, "utf-8");
|
|
1266
|
+
await pruneStaleThemeCss(bundlesDir, hashedName);
|
|
654
1267
|
} catch (err) {
|
|
655
1268
|
const message = err instanceof Error ? err.message : String(err);
|
|
656
1269
|
if (message.startsWith("[reroute/theme]")) {
|
|
@@ -659,11 +1272,11 @@ async function syncThemeCss(cwd) {
|
|
|
659
1272
|
throw new Error(`[reroute/theme] Failed to bundle index.css:
|
|
660
1273
|
${message}`);
|
|
661
1274
|
}
|
|
662
|
-
console.log("[reroute/theme] synced index.css");
|
|
1275
|
+
console.log("[reroute/theme] synced /bundles/index.css");
|
|
663
1276
|
return true;
|
|
664
1277
|
}
|
|
665
1278
|
// packages/cli/src/commands/lib/version.ts
|
|
666
|
-
import
|
|
1279
|
+
import path2 from "node:path";
|
|
667
1280
|
async function getVersionString() {
|
|
668
1281
|
const version = await getVersion();
|
|
669
1282
|
const commit = await getCommit();
|
|
@@ -671,13 +1284,13 @@ async function getVersionString() {
|
|
|
671
1284
|
}
|
|
672
1285
|
async function getVersion() {
|
|
673
1286
|
if (true) {
|
|
674
|
-
return "1.0.0-alpha.
|
|
1287
|
+
return "1.0.0-alpha.30";
|
|
675
1288
|
}
|
|
676
1289
|
const possiblePaths = [
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
1290
|
+
path2.join(import.meta.dir, "../../../../package.json"),
|
|
1291
|
+
path2.join(import.meta.dir, "../../../package.json"),
|
|
1292
|
+
path2.join(import.meta.dir, "../../package.json"),
|
|
1293
|
+
path2.join(import.meta.dir, "../package.json")
|
|
681
1294
|
];
|
|
682
1295
|
for (const pkgPath of possiblePaths) {
|
|
683
1296
|
try {
|
|
@@ -689,33 +1302,36 @@ async function getVersion() {
|
|
|
689
1302
|
}
|
|
690
1303
|
async function getCommit() {
|
|
691
1304
|
if (true) {
|
|
692
|
-
return "
|
|
1305
|
+
return "48f3afc";
|
|
693
1306
|
}
|
|
694
1307
|
return "dev";
|
|
695
1308
|
}
|
|
696
1309
|
export {
|
|
697
|
-
|
|
698
|
-
syncThemeCss,
|
|
699
|
-
stripMarkdown,
|
|
700
|
-
processMarkdownFile,
|
|
701
|
-
logMarkdownStatus,
|
|
702
|
-
isProductionMode,
|
|
703
|
-
isMarkdownFile,
|
|
704
|
-
getVersionString,
|
|
705
|
-
getRerouteCommand,
|
|
706
|
-
getMarkdownRouteName,
|
|
707
|
-
getMarkdownConfig,
|
|
708
|
-
generatePlainMarkdownModule,
|
|
709
|
-
generateMarkdownModule,
|
|
710
|
-
filterProdFlag,
|
|
711
|
-
extractHeadings,
|
|
712
|
-
ensureProductionEnv,
|
|
713
|
-
createServerOutputHandler,
|
|
714
|
-
colorizeLogPrefixAnsi,
|
|
715
|
-
colorizeLogPrefix,
|
|
716
|
-
checkMarkdownIfConfigured,
|
|
1310
|
+
blessedToAnsi,
|
|
717
1311
|
bundleCssEntrypoint,
|
|
718
|
-
|
|
1312
|
+
checkMarkdownIfConfigured,
|
|
1313
|
+
colorizeLogPrefix,
|
|
1314
|
+
colorizeLogPrefixAnsi,
|
|
1315
|
+
createServerOutputHandler,
|
|
1316
|
+
cssEntrypointFiles,
|
|
1317
|
+
ensureProductionEnv,
|
|
1318
|
+
extractHeadings,
|
|
1319
|
+
filterProdFlag,
|
|
1320
|
+
generateMarkdownModule,
|
|
1321
|
+
generatePlainMarkdownModule,
|
|
1322
|
+
getMarkdownConfig,
|
|
1323
|
+
getMarkdownRouteName,
|
|
1324
|
+
getRerouteCommand,
|
|
1325
|
+
getVersionString,
|
|
1326
|
+
isMarkdownFile,
|
|
1327
|
+
isProductionMode,
|
|
1328
|
+
isServerRunning,
|
|
1329
|
+
logMarkdownStatus,
|
|
1330
|
+
processMarkdownFile,
|
|
1331
|
+
shikiRehypeOptions,
|
|
1332
|
+
stripMarkdown,
|
|
1333
|
+
syncThemeCss,
|
|
1334
|
+
waitForServerReady
|
|
719
1335
|
};
|
|
720
1336
|
|
|
721
|
-
//# debugId=
|
|
1337
|
+
//# debugId=E53B9CA8B4A564CF64756E2164756E21
|