reroute-js 1.0.0-alpha.1 → 1.0.0-alpha.2
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 +120 -51
- package/cli/bin.js.map +4 -4
- package/cli/index.d.ts +1 -1
- package/cli/index.js +61 -8
- package/cli/index.js.map +3 -3
- 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/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 +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/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/theme.d.ts +17 -3
- 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/og.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 +2 -2
- package/core/index.js.map +1 -1
- 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/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/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +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/index.d.ts +1 -1
- package/core/src/robots/policies.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/cleanup.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/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/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.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/route-match.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +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 +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.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 +95 -19
- package/elysia/index.js.map +4 -4
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/i18n.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +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/content.d.ts +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 +3 -2
- package/elysia/src/routes/internal.d.ts.map +1 -1
- package/elysia/src/routes/llms.d.ts +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 +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 +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 +2 -2
- package/react/index.js.map +1 -1
- 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 +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/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/helpers.d.ts +1 -1
- package/react/src/i18n/index.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- 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 +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/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/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +2 -2
- package/telemetry/react.js.map +1 -1
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +2 -2
- package/telemetry/server.js.map +1 -1
- 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/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 v1.0.0-alpha.
|
|
4
|
+
* reroute-js v1.0.0-alpha.2
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -66,7 +66,7 @@ async function getVersionString() {
|
|
|
66
66
|
}
|
|
67
67
|
async function getVersion() {
|
|
68
68
|
if (true) {
|
|
69
|
-
return "1.0.0-alpha.
|
|
69
|
+
return "1.0.0-alpha.2";
|
|
70
70
|
}
|
|
71
71
|
const possiblePaths = [
|
|
72
72
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -84,7 +84,7 @@ async function getVersion() {
|
|
|
84
84
|
}
|
|
85
85
|
async function getCommit() {
|
|
86
86
|
if (true) {
|
|
87
|
-
return "
|
|
87
|
+
return "3e34125";
|
|
88
88
|
}
|
|
89
89
|
return "dev";
|
|
90
90
|
}
|
|
@@ -7376,25 +7376,79 @@ var AUTO_HEADER = `// \uD83D\uDEA8 Auto-generated streaming wrapper by Reroute -
|
|
|
7376
7376
|
var init_suspense = () => {};
|
|
7377
7377
|
|
|
7378
7378
|
// packages/cli/src/commands/lib/theme.ts
|
|
7379
|
-
import { existsSync as existsSync5 } from "node:fs";
|
|
7380
|
-
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
7381
|
-
import { dirname as dirname5, join as join9 } from "node:path";
|
|
7379
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
7380
|
+
import { mkdir as mkdir2, writeFile } from "node:fs/promises";
|
|
7381
|
+
import { dirname as dirname5, isAbsolute, join as join9, resolve as resolve2 } from "node:path";
|
|
7382
7382
|
function getCssPaths(cwd) {
|
|
7383
7383
|
const input = join9(cwd, "src/client/index.css");
|
|
7384
7384
|
const output = join9(cwd, ".reroute/index.css");
|
|
7385
7385
|
return { input, output };
|
|
7386
7386
|
}
|
|
7387
|
+
function isFileImport(specifier) {
|
|
7388
|
+
if (specifier.startsWith("http://") || specifier.startsWith("https://") || specifier.startsWith("data:") || specifier.startsWith("/")) {
|
|
7389
|
+
return false;
|
|
7390
|
+
}
|
|
7391
|
+
return true;
|
|
7392
|
+
}
|
|
7393
|
+
function bundleCssEntrypoint(entryPath) {
|
|
7394
|
+
const absEntry = resolve2(entryPath);
|
|
7395
|
+
const stack = new Set;
|
|
7396
|
+
const completed = new Set;
|
|
7397
|
+
function bundleFile(filePath) {
|
|
7398
|
+
const absPath = resolve2(filePath);
|
|
7399
|
+
if (completed.has(absPath)) {
|
|
7400
|
+
return "";
|
|
7401
|
+
}
|
|
7402
|
+
if (stack.has(absPath)) {
|
|
7403
|
+
throw new Error(`[reroute/theme] Circular @import detected: ${absPath}`);
|
|
7404
|
+
}
|
|
7405
|
+
if (!existsSync5(absPath)) {
|
|
7406
|
+
throw new Error(`[reroute/theme] Missing CSS import: ${absPath}`);
|
|
7407
|
+
}
|
|
7408
|
+
stack.add(absPath);
|
|
7409
|
+
const source = readFileSync4(absPath, "utf-8");
|
|
7410
|
+
const baseDir = dirname5(absPath);
|
|
7411
|
+
const bundled = source.replace(IMPORT_RE, (full, single, double, bare, rest) => {
|
|
7412
|
+
const specifier = single || double || bare;
|
|
7413
|
+
const condition = (rest ?? "").trim();
|
|
7414
|
+
if (condition || !isFileImport(specifier)) {
|
|
7415
|
+
return full;
|
|
7416
|
+
}
|
|
7417
|
+
const importedPath = isAbsolute(specifier) ? specifier : resolve2(baseDir, specifier);
|
|
7418
|
+
return `/* ${specifier} */
|
|
7419
|
+
${bundleFile(importedPath)}
|
|
7420
|
+
`;
|
|
7421
|
+
});
|
|
7422
|
+
stack.delete(absPath);
|
|
7423
|
+
completed.add(absPath);
|
|
7424
|
+
return bundled;
|
|
7425
|
+
}
|
|
7426
|
+
return bundleFile(absEntry);
|
|
7427
|
+
}
|
|
7387
7428
|
async function syncThemeCss(cwd) {
|
|
7388
7429
|
const { input, output } = getCssPaths(cwd);
|
|
7389
7430
|
if (!existsSync5(input)) {
|
|
7390
7431
|
return false;
|
|
7391
7432
|
}
|
|
7392
7433
|
await mkdir2(dirname5(output), { recursive: true });
|
|
7393
|
-
|
|
7434
|
+
try {
|
|
7435
|
+
const css = bundleCssEntrypoint(input);
|
|
7436
|
+
await writeFile(output, css, "utf-8");
|
|
7437
|
+
} catch (err) {
|
|
7438
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7439
|
+
if (message.startsWith("[reroute/theme]")) {
|
|
7440
|
+
throw err;
|
|
7441
|
+
}
|
|
7442
|
+
throw new Error(`[reroute/theme] Failed to bundle index.css:
|
|
7443
|
+
${message}`);
|
|
7444
|
+
}
|
|
7394
7445
|
console.log("[reroute/theme] synced index.css");
|
|
7395
7446
|
return true;
|
|
7396
7447
|
}
|
|
7397
|
-
var
|
|
7448
|
+
var IMPORT_RE;
|
|
7449
|
+
var init_theme = __esm(() => {
|
|
7450
|
+
IMPORT_RE = /@import\s+(?:url\(\s*)?(?:'([^']+)'|"([^"]+)"|([^'")\s]+))\s*\)?\s*([^;]*);/g;
|
|
7451
|
+
});
|
|
7398
7452
|
|
|
7399
7453
|
// packages/cli/src/commands/gen.ts
|
|
7400
7454
|
var exports_gen = {};
|
|
@@ -8759,14 +8813,16 @@ async function gen(args) {
|
|
|
8759
8813
|
console.log(`[reroute/gen] rebuilding notified (port ${port}, ${data.clients} browser(s))`);
|
|
8760
8814
|
} catch (_err) {}
|
|
8761
8815
|
};
|
|
8762
|
-
const notifyReload = async (reason) => {
|
|
8816
|
+
const notifyReload = async (reason, mode = "full") => {
|
|
8763
8817
|
const port = getPort();
|
|
8764
8818
|
try {
|
|
8765
8819
|
const response = await fetch(`http://localhost:${port}/__reroute_reload`, {
|
|
8766
|
-
method: "POST"
|
|
8820
|
+
method: "POST",
|
|
8821
|
+
headers: { "content-type": "application/json" },
|
|
8822
|
+
body: JSON.stringify({ mode })
|
|
8767
8823
|
});
|
|
8768
8824
|
const data = await response.json();
|
|
8769
|
-
console.log(`[reroute/gen] reload notified (port ${port}, ${data.clients} browser(s))${reason ? `: ${reason}` : ""}`);
|
|
8825
|
+
console.log(`[reroute/gen] reload notified (port ${port}, ${data.clients} browser(s), ${mode})${reason ? `: ${reason}` : ""}`);
|
|
8770
8826
|
} catch {}
|
|
8771
8827
|
};
|
|
8772
8828
|
await notifyReload("initial generation");
|
|
@@ -8775,30 +8831,35 @@ async function gen(args) {
|
|
|
8775
8831
|
let isBuilding = false;
|
|
8776
8832
|
let pendingBuild = null;
|
|
8777
8833
|
let skipCurrentBuild = false;
|
|
8778
|
-
function scheduleBuild(buildFn, reason) {
|
|
8834
|
+
function scheduleBuild(buildFn, reason, reloadMode = "full") {
|
|
8779
8835
|
if (isBuilding) {
|
|
8780
8836
|
if (!skipCurrentBuild) {
|
|
8781
8837
|
skipCurrentBuild = true;
|
|
8782
8838
|
console.log(`[reroute/watch] ⏭️ Superseding current build with: ${reason}`);
|
|
8783
8839
|
}
|
|
8784
|
-
pendingBuild = { fn: buildFn, reason };
|
|
8840
|
+
pendingBuild = { fn: buildFn, reason, reloadMode };
|
|
8785
8841
|
return;
|
|
8786
8842
|
}
|
|
8787
8843
|
if (pendingBuild) {
|
|
8788
8844
|
console.log(`[reroute/watch] ⏭️ Replacing queued build with: ${reason}`);
|
|
8845
|
+
const mergedMode = pendingBuild.reloadMode === "css" && reloadMode === "css" ? "css" : "full";
|
|
8846
|
+
pendingBuild = { fn: buildFn, reason, reloadMode: mergedMode };
|
|
8847
|
+
} else {
|
|
8848
|
+
pendingBuild = { fn: buildFn, reason, reloadMode };
|
|
8789
8849
|
}
|
|
8790
|
-
pendingBuild = { fn: buildFn, reason };
|
|
8791
8850
|
processPendingBuild();
|
|
8792
8851
|
}
|
|
8793
8852
|
async function processPendingBuild() {
|
|
8794
8853
|
if (!pendingBuild || isBuilding)
|
|
8795
8854
|
return;
|
|
8796
|
-
const { fn: buildFn, reason } = pendingBuild;
|
|
8855
|
+
const { fn: buildFn, reason, reloadMode } = pendingBuild;
|
|
8797
8856
|
pendingBuild = null;
|
|
8798
8857
|
skipCurrentBuild = false;
|
|
8799
8858
|
isBuilding = true;
|
|
8800
8859
|
const startTime = performance.now();
|
|
8801
|
-
|
|
8860
|
+
if (reloadMode !== "css") {
|
|
8861
|
+
await notifyRebuilding();
|
|
8862
|
+
}
|
|
8802
8863
|
try {
|
|
8803
8864
|
await buildFn();
|
|
8804
8865
|
if (skipCurrentBuild) {
|
|
@@ -8807,12 +8868,14 @@ async function gen(args) {
|
|
|
8807
8868
|
}
|
|
8808
8869
|
const duration = ((performance.now() - startTime) / 1000).toFixed(2);
|
|
8809
8870
|
console.log(`[reroute/watch] ✓ Rebuild complete in ${duration}s (${reason})`);
|
|
8810
|
-
|
|
8871
|
+
if (reloadMode !== "css") {
|
|
8872
|
+
await Bun.sleep(200);
|
|
8873
|
+
}
|
|
8811
8874
|
if (skipCurrentBuild || pendingBuild) {
|
|
8812
8875
|
console.log(`[reroute/watch] ⏭️ Skipping reload, new build pending`);
|
|
8813
8876
|
return;
|
|
8814
8877
|
}
|
|
8815
|
-
await notifyReload(reason);
|
|
8878
|
+
await notifyReload(reason, reloadMode);
|
|
8816
8879
|
} catch (err) {
|
|
8817
8880
|
if (!skipCurrentBuild) {
|
|
8818
8881
|
console.error(`[reroute/watch] ✗ Build failed (${reason}):`, err);
|
|
@@ -8970,6 +9033,7 @@ async function gen(args) {
|
|
|
8970
9033
|
});
|
|
8971
9034
|
const clientPath = join10(cwd, "src", "client");
|
|
8972
9035
|
console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${clientPath}...`);
|
|
9036
|
+
let pendingClientFiles = new Set;
|
|
8973
9037
|
const clientWatcher = watch(clientPath, { recursive: true }, (_ev, filename) => {
|
|
8974
9038
|
if (!filename)
|
|
8975
9039
|
return;
|
|
@@ -8980,10 +9044,15 @@ async function gen(args) {
|
|
|
8980
9044
|
return;
|
|
8981
9045
|
if (!/\.(tsx|ts|jsx|js|html|md|mdx|css)$/.test(name))
|
|
8982
9046
|
return;
|
|
9047
|
+
pendingClientFiles.add(name);
|
|
8983
9048
|
mediumDebounce(() => {
|
|
9049
|
+
const names = [...pendingClientFiles];
|
|
9050
|
+
pendingClientFiles = new Set;
|
|
9051
|
+
const reloadMode = names.every((n) => n.endsWith(".css")) ? "css" : "full";
|
|
9052
|
+
const label = names.length === 1 ? names[0] : `${names.length} files`;
|
|
8984
9053
|
scheduleBuild(async () => {
|
|
8985
|
-
console.log(`[reroute/watch] \uD83D\uDCE6 Client changed: ${
|
|
8986
|
-
if (
|
|
9054
|
+
console.log(`[reroute/watch] \uD83D\uDCE6 Client changed: ${label}`);
|
|
9055
|
+
if (names.some((n) => n.endsWith(".ts") || n.endsWith(".tsx"))) {
|
|
8987
9056
|
console.log("[reroute/watch] ├─ Rebuilding bundle...");
|
|
8988
9057
|
const bundleStart = performance.now();
|
|
8989
9058
|
try {
|
|
@@ -8999,7 +9068,7 @@ async function gen(args) {
|
|
|
8999
9068
|
if (themeSynced) {
|
|
9000
9069
|
console.log("[reroute/watch] ├─ index.css synced");
|
|
9001
9070
|
}
|
|
9002
|
-
}, "client change");
|
|
9071
|
+
}, "client change", reloadMode);
|
|
9003
9072
|
});
|
|
9004
9073
|
});
|
|
9005
9074
|
console.log(`[reroute/watch] ✓ Watch mode active - ready for changes!
|
|
@@ -9096,7 +9165,7 @@ async function waitForServerReady(port = 3000, timeout = 30000) {
|
|
|
9096
9165
|
return;
|
|
9097
9166
|
}
|
|
9098
9167
|
} catch {}
|
|
9099
|
-
await new Promise((
|
|
9168
|
+
await new Promise((resolve3) => setTimeout(resolve3, checkInterval));
|
|
9100
9169
|
checkInterval = Math.min(checkInterval * 1.5, maxInterval);
|
|
9101
9170
|
}
|
|
9102
9171
|
throw new Error(`Timeout waiting for server to respond after ${timeout}ms. ` + `Make sure your server is starting correctly on port ${port}.`);
|
|
@@ -19437,12 +19506,12 @@ var require_screen = __commonJS((exports, module) => {
|
|
|
19437
19506
|
env: process.env,
|
|
19438
19507
|
cwd: process.env.HOME
|
|
19439
19508
|
};
|
|
19440
|
-
function
|
|
19509
|
+
function writeFile2(callback2) {
|
|
19441
19510
|
if (!options.value)
|
|
19442
19511
|
return callback2();
|
|
19443
19512
|
return fs.writeFile(file, options.value, callback2);
|
|
19444
19513
|
}
|
|
19445
|
-
return
|
|
19514
|
+
return writeFile2(function(err) {
|
|
19446
19515
|
if (err)
|
|
19447
19516
|
return callback(err);
|
|
19448
19517
|
return self2.exec(editor, args, opt, function(err2, success) {
|
|
@@ -94793,7 +94862,7 @@ Should be of format "before:after"`);
|
|
|
94793
94862
|
}
|
|
94794
94863
|
}
|
|
94795
94864
|
function objectize(node) {
|
|
94796
|
-
function
|
|
94865
|
+
function resolve3(value, key) {
|
|
94797
94866
|
if (!value._parent)
|
|
94798
94867
|
return;
|
|
94799
94868
|
if (value._parent._default && value._parent._default[key])
|
|
@@ -94816,8 +94885,8 @@ Should be of format "before:after"`);
|
|
|
94816
94885
|
if (isObject(value)) {
|
|
94817
94886
|
if (!value._before && !value._after)
|
|
94818
94887
|
return objectize(value);
|
|
94819
|
-
value._before = value._before ||
|
|
94820
|
-
value._after = value._after ||
|
|
94888
|
+
value._before = value._before || resolve3(value, "_before");
|
|
94889
|
+
value._after = value._after || resolve3(value, "_after");
|
|
94821
94890
|
return;
|
|
94822
94891
|
}
|
|
94823
94892
|
throw new Error("nodes need to be either {String}, {Object} or {Function}." + value + " is neither.");
|
|
@@ -103726,7 +103795,7 @@ function getRerouteCommand() {
|
|
|
103726
103795
|
async function waitForInitialBuild(genProcess) {
|
|
103727
103796
|
console.log("[reroute/dev] Waiting for initial build...");
|
|
103728
103797
|
const outputBuffer = [];
|
|
103729
|
-
const buildCompletePromise = new Promise((
|
|
103798
|
+
const buildCompletePromise = new Promise((resolve3, reject) => {
|
|
103730
103799
|
const timeout = setTimeout(() => {
|
|
103731
103800
|
reject(new Error("Timeout waiting for initial build to complete (120s)"));
|
|
103732
103801
|
}, 120000);
|
|
@@ -103736,7 +103805,7 @@ async function waitForInitialBuild(genProcess) {
|
|
|
103736
103805
|
clearTimeout(timeout);
|
|
103737
103806
|
genProcess.stdout?.removeListener("data", checkComplete);
|
|
103738
103807
|
genProcess.stderr?.removeListener("data", checkComplete);
|
|
103739
|
-
|
|
103808
|
+
resolve3();
|
|
103740
103809
|
}
|
|
103741
103810
|
};
|
|
103742
103811
|
genProcess.stdout?.on("data", checkComplete);
|
|
@@ -103922,7 +103991,7 @@ async function start(args) {
|
|
|
103922
103991
|
`);
|
|
103923
103992
|
const genCommand = useShell ? `${rerouteCmd} gen ${genArgs.join(" ")}` : rerouteCmd;
|
|
103924
103993
|
const genArgsWithCmd = useShell ? [] : ["gen", ...genArgs];
|
|
103925
|
-
await new Promise((
|
|
103994
|
+
await new Promise((resolve3, reject) => {
|
|
103926
103995
|
const genProcess = spawn2(genCommand, genArgsWithCmd, {
|
|
103927
103996
|
stdio: ["ignore", "pipe", "pipe"],
|
|
103928
103997
|
shell: useShell
|
|
@@ -103933,7 +104002,7 @@ async function start(args) {
|
|
|
103933
104002
|
if (code !== null && code !== 0) {
|
|
103934
104003
|
reject(new Error(`Gen exited with code ${code}`));
|
|
103935
104004
|
} else {
|
|
103936
|
-
|
|
104005
|
+
resolve3();
|
|
103937
104006
|
}
|
|
103938
104007
|
});
|
|
103939
104008
|
genProcess.on("error", (error) => {
|
|
@@ -103974,13 +104043,13 @@ async function start(args) {
|
|
|
103974
104043
|
serverProcess.kill("SIGINT");
|
|
103975
104044
|
process.exit(0);
|
|
103976
104045
|
});
|
|
103977
|
-
await new Promise((
|
|
104046
|
+
await new Promise((resolve3, reject) => {
|
|
103978
104047
|
serverProcess.on("exit", (code) => {
|
|
103979
104048
|
if (code !== null && code !== 0) {
|
|
103980
104049
|
console.error(colorizeLogPrefixAnsi(`[reroute/start] Server exited with code ${code}`));
|
|
103981
104050
|
reject(new Error(`Server exited with code ${code}`));
|
|
103982
104051
|
} else {
|
|
103983
|
-
|
|
104052
|
+
resolve3();
|
|
103984
104053
|
}
|
|
103985
104054
|
});
|
|
103986
104055
|
serverProcess.on("error", (error) => {
|
|
@@ -104042,7 +104111,7 @@ __export(exports_build, {
|
|
|
104042
104111
|
default: () => build
|
|
104043
104112
|
});
|
|
104044
104113
|
import { spawn as spawn3 } from "node:child_process";
|
|
104045
|
-
import { existsSync as existsSync9, readFileSync as
|
|
104114
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5, rmSync, unlinkSync } from "node:fs";
|
|
104046
104115
|
import { join as join14 } from "node:path";
|
|
104047
104116
|
function getRerouteCommand3() {
|
|
104048
104117
|
const binPath = join14(import.meta.dir, "..", "..", "bin.ts");
|
|
@@ -104069,7 +104138,7 @@ function getOutputName() {
|
|
|
104069
104138
|
const packageJsonPath = join14(cwd, "package.json");
|
|
104070
104139
|
if (existsSync9(packageJsonPath)) {
|
|
104071
104140
|
try {
|
|
104072
|
-
const packageJson = JSON.parse(
|
|
104141
|
+
const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
|
|
104073
104142
|
const name = packageJson.name;
|
|
104074
104143
|
if (name) {
|
|
104075
104144
|
const parts = name.split("-");
|
|
@@ -104111,7 +104180,7 @@ async function cleanRerouteFolder(cwd) {
|
|
|
104111
104180
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Cleaning .reroute folder...
|
|
104112
104181
|
`));
|
|
104113
104182
|
rmSync(rerouteDir, { recursive: true, force: true });
|
|
104114
|
-
await new Promise((
|
|
104183
|
+
await new Promise((resolve3) => setTimeout(resolve3, 100));
|
|
104115
104184
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] ✓ .reroute folder cleaned
|
|
104116
104185
|
`));
|
|
104117
104186
|
}
|
|
@@ -104137,7 +104206,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
104137
104206
|
const genArgs = useShell ? [] : ["gen", "--prod", noCompression ? "--no-compression" : ""];
|
|
104138
104207
|
const genBuffer = { current: "" };
|
|
104139
104208
|
const handleGenOutput = createOutputHandler(genBuffer);
|
|
104140
|
-
await new Promise((
|
|
104209
|
+
await new Promise((resolve3, reject) => {
|
|
104141
104210
|
const genProcess = spawn3(genCommand, genArgs, {
|
|
104142
104211
|
stdio: ["ignore", "pipe", "pipe"],
|
|
104143
104212
|
shell: useShell
|
|
@@ -104148,7 +104217,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
104148
104217
|
if (code !== null && code !== 0) {
|
|
104149
104218
|
reject(new Error(`Gen exited with code ${code}`));
|
|
104150
104219
|
} else {
|
|
104151
|
-
|
|
104220
|
+
resolve3();
|
|
104152
104221
|
}
|
|
104153
104222
|
});
|
|
104154
104223
|
genProcess.on("error", (error) => {
|
|
@@ -104319,7 +104388,7 @@ __export(exports_analyze, {
|
|
|
104319
104388
|
default: () => analyze
|
|
104320
104389
|
});
|
|
104321
104390
|
import { existsSync as existsSync11, statSync } from "node:fs";
|
|
104322
|
-
import { readdir as readdir8, readFile, stat as stat5, writeFile } from "node:fs/promises";
|
|
104391
|
+
import { readdir as readdir8, readFile, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
104323
104392
|
import { basename as basename3, join as join16, relative as relative3 } from "node:path";
|
|
104324
104393
|
import Table from "cli-table3";
|
|
104325
104394
|
async function findChunkBundles(cwd) {
|
|
@@ -104426,11 +104495,11 @@ async function findBrowserEntry(cwd) {
|
|
|
104426
104495
|
const code = await output.text();
|
|
104427
104496
|
const actualHash = await generateContentHash2(code);
|
|
104428
104497
|
const bundlePath = join16(tempDir, `index.${actualHash}.js`);
|
|
104429
|
-
await
|
|
104498
|
+
await writeFile2(bundlePath, code, "utf-8");
|
|
104430
104499
|
const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
|
|
104431
104500
|
if (mapOutput) {
|
|
104432
104501
|
const mapContent = await mapOutput.text();
|
|
104433
|
-
await
|
|
104502
|
+
await writeFile2(`${bundlePath}.map`, mapContent, "utf-8");
|
|
104434
104503
|
}
|
|
104435
104504
|
return bundlePath;
|
|
104436
104505
|
} catch (error) {
|
|
@@ -106348,7 +106417,7 @@ async function analyze(args) {
|
|
|
106348
106417
|
const useShell = rerouteCmd.includes(" ");
|
|
106349
106418
|
const buildCommand = useShell ? `${rerouteCmd} build` : rerouteCmd;
|
|
106350
106419
|
const buildArgs = useShell ? [] : ["build"];
|
|
106351
|
-
await new Promise((
|
|
106420
|
+
await new Promise((resolve3, reject) => {
|
|
106352
106421
|
const buildProcess = spawn4(buildCommand, buildArgs, {
|
|
106353
106422
|
stdio: "inherit",
|
|
106354
106423
|
shell: useShell
|
|
@@ -106357,7 +106426,7 @@ async function analyze(args) {
|
|
|
106357
106426
|
if (code !== null && code !== 0) {
|
|
106358
106427
|
reject(new Error(`Build exited with code ${code}`));
|
|
106359
106428
|
} else {
|
|
106360
|
-
|
|
106429
|
+
resolve3();
|
|
106361
106430
|
}
|
|
106362
106431
|
});
|
|
106363
106432
|
buildProcess.on("error", (error) => {
|
|
@@ -106420,11 +106489,11 @@ async function analyze(args) {
|
|
|
106420
106489
|
const output = result.outputs[0];
|
|
106421
106490
|
const code = await output.text();
|
|
106422
106491
|
const analysisEntry = join16(serverAnalysisDir, "index.js");
|
|
106423
|
-
await
|
|
106492
|
+
await writeFile2(analysisEntry, code, "utf-8");
|
|
106424
106493
|
const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
|
|
106425
106494
|
if (mapOutput) {
|
|
106426
106495
|
const mapContent = await mapOutput.text();
|
|
106427
|
-
await
|
|
106496
|
+
await writeFile2(`${analysisEntry}.map`, mapContent, "utf-8");
|
|
106428
106497
|
}
|
|
106429
106498
|
entry = analysisEntry;
|
|
106430
106499
|
}
|
|
@@ -106484,7 +106553,7 @@ async function analyze(args) {
|
|
|
106484
106553
|
const html2 = await generateHTMLReport(stats, depTree, mainInfo, browserDepTree, browserInfo, initialSearch);
|
|
106485
106554
|
const { mkdir: mkdir4 } = await import("node:fs/promises");
|
|
106486
106555
|
await mkdir4(join16(cwd, ".reroute"), { recursive: true });
|
|
106487
|
-
await
|
|
106556
|
+
await writeFile2(htmlPath, html2, "utf-8");
|
|
106488
106557
|
console.log(colorizeLogPrefixAnsi(`[reroute/analyze] HTML report generated: ${relative3(cwd, htmlPath)}
|
|
106489
106558
|
`));
|
|
106490
106559
|
if (openBrowser) {
|
|
@@ -106563,8 +106632,8 @@ async function killProcessOnPort(port) {
|
|
|
106563
106632
|
const proc = spawn4("bunx", ["kill-port", String(port)], {
|
|
106564
106633
|
stdio: "ignore"
|
|
106565
106634
|
});
|
|
106566
|
-
await new Promise((
|
|
106567
|
-
proc.on("close", () =>
|
|
106635
|
+
await new Promise((resolve3) => {
|
|
106636
|
+
proc.on("close", () => resolve3());
|
|
106568
106637
|
});
|
|
106569
106638
|
} catch {}
|
|
106570
106639
|
}
|
|
@@ -106928,7 +106997,7 @@ async function getVersionString2() {
|
|
|
106928
106997
|
}
|
|
106929
106998
|
async function getVersion2() {
|
|
106930
106999
|
if (true) {
|
|
106931
|
-
return "1.0.0-alpha.
|
|
107000
|
+
return "1.0.0-alpha.2";
|
|
106932
107001
|
}
|
|
106933
107002
|
const possiblePaths = [
|
|
106934
107003
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -106945,10 +107014,10 @@ async function getVersion2() {
|
|
|
106945
107014
|
}
|
|
106946
107015
|
async function getCommit2() {
|
|
106947
107016
|
if (true) {
|
|
106948
|
-
return "
|
|
107017
|
+
return "3e34125";
|
|
106949
107018
|
}
|
|
106950
107019
|
return "dev";
|
|
106951
107020
|
}
|
|
106952
107021
|
main();
|
|
106953
107022
|
|
|
106954
|
-
//# debugId=
|
|
107023
|
+
//# debugId=CC941DD40B19367864756E2164756E21
|