reroute-js 1.0.0-alpha.22 → 1.0.0-alpha.24
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 +91 -60
- package/cli/bin.js.map +6 -6
- package/cli/index.d.ts +1 -1
- package/cli/index.js +15 -5
- package/cli/index.js.map +4 -4
- 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/images.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 +11 -1
- package/cli/src/commands/lib/markdown/processor.d.ts.map +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 +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/lib/watch.d.ts +6 -1
- package/cli/src/commands/lib/watch.d.ts.map +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 +3 -3
- package/core/src/app-paths.d.ts +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 +9 -1
- 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/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/image.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/discovery.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 +68 -34
- package/elysia/index.js.map +6 -5
- 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/devReload.d.ts +31 -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 +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 +1 -1
- package/elysia/src/routes/liveReloadClient.d.ts +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/routes/themeCssRefresh.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 +27 -14
- package/react/index.js.map +3 -3
- 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/bundle.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 +9 -2
- package/react/src/lib/lazy-route.d.ts.map +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 +3 -3
- 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.24
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -68,7 +68,7 @@ async function getVersionString() {
|
|
|
68
68
|
}
|
|
69
69
|
async function getVersion() {
|
|
70
70
|
if (true) {
|
|
71
|
-
return "1.0.0-alpha.
|
|
71
|
+
return "1.0.0-alpha.24";
|
|
72
72
|
}
|
|
73
73
|
const possiblePaths = [
|
|
74
74
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -86,7 +86,7 @@ async function getVersion() {
|
|
|
86
86
|
}
|
|
87
87
|
async function getCommit() {
|
|
88
88
|
if (true) {
|
|
89
|
-
return "
|
|
89
|
+
return "ab63579";
|
|
90
90
|
}
|
|
91
91
|
return "dev";
|
|
92
92
|
}
|
|
@@ -7744,6 +7744,12 @@ function setupRemarkPlugins(cwd, enableGfm) {
|
|
|
7744
7744
|
}
|
|
7745
7745
|
return remarkPlugins;
|
|
7746
7746
|
}
|
|
7747
|
+
function shikiRehypeOptions(theme) {
|
|
7748
|
+
if (theme === "github-light" || theme === "github-dark") {
|
|
7749
|
+
return { themes: { light: "github-light", dark: "github-dark" } };
|
|
7750
|
+
}
|
|
7751
|
+
return { theme };
|
|
7752
|
+
}
|
|
7747
7753
|
function setupRehypePlugins(cwd, theme) {
|
|
7748
7754
|
const rehypePlugins = [];
|
|
7749
7755
|
const rehypeRaw = tryLoadModule(cwd, "rehype-raw");
|
|
@@ -7764,7 +7770,10 @@ function setupRehypePlugins(cwd, theme) {
|
|
|
7764
7770
|
}
|
|
7765
7771
|
const rehypeShiki = tryLoadModule(cwd, "@shikijs/rehype");
|
|
7766
7772
|
if (rehypeShiki) {
|
|
7767
|
-
rehypePlugins.push([
|
|
7773
|
+
rehypePlugins.push([
|
|
7774
|
+
rehypeShiki.default || rehypeShiki,
|
|
7775
|
+
shikiRehypeOptions(theme)
|
|
7776
|
+
]);
|
|
7768
7777
|
} else {
|
|
7769
7778
|
console.warn("[reroute/mdx] @shikijs/rehype not available, skipping highlighting");
|
|
7770
7779
|
}
|
|
@@ -8284,6 +8293,15 @@ import { join as join13 } from "node:path";
|
|
|
8284
8293
|
function isWatchNoise(name) {
|
|
8285
8294
|
return name.split(/[/\\]/).some((part) => part.startsWith(".")) || /\.bust-[^/\\]+$/.test(name);
|
|
8286
8295
|
}
|
|
8296
|
+
function isClientSource(name, skipRoutes) {
|
|
8297
|
+
if (isWatchNoise(name))
|
|
8298
|
+
return false;
|
|
8299
|
+
if (name.includes(".reroute") || name.includes("node_modules"))
|
|
8300
|
+
return false;
|
|
8301
|
+
if (skipRoutes && /(^|[/\\])routes[/\\]/.test(name))
|
|
8302
|
+
return false;
|
|
8303
|
+
return /\.(tsx|ts|jsx|js|html|md|mdx|css)$/.test(name);
|
|
8304
|
+
}
|
|
8287
8305
|
function createContentFingerprint(options) {
|
|
8288
8306
|
const hashes = new Map;
|
|
8289
8307
|
const startedAt = Date.now();
|
|
@@ -8330,7 +8348,7 @@ __export(exports_gen, {
|
|
|
8330
8348
|
});
|
|
8331
8349
|
import { watch } from "node:fs";
|
|
8332
8350
|
import { copyFile as copyFile2, mkdir as mkdir3, readdir as readdir8, rm, unlink as unlink3 } from "node:fs/promises";
|
|
8333
|
-
import { dirname as dirname7, extname as extname4, join as join14 } from "node:path";
|
|
8351
|
+
import { dirname as dirname7, extname as extname4, join as join14, resolve as resolve3 } from "node:path";
|
|
8334
8352
|
import { pathToFileURL as pathToFileURL8 } from "node:url";
|
|
8335
8353
|
async function bundleThemeCssIntoArtifacts(cwd) {
|
|
8336
8354
|
const cssPath = join14(cwd, ".reroute", "bundles", "index.css");
|
|
@@ -8608,8 +8626,17 @@ function getImportPath(filePath, streamingMap, routesImportBase) {
|
|
|
8608
8626
|
const pathWithoutExt = filePath.replace(/\.(tsx|ts)$/, "");
|
|
8609
8627
|
return `${routesImportBase}/${pathWithoutExt}`;
|
|
8610
8628
|
}
|
|
8611
|
-
function
|
|
8612
|
-
const
|
|
8629
|
+
function lazyRouteFallbackImport(config2) {
|
|
8630
|
+
const value = config2.streaming?.defaultSkeleton;
|
|
8631
|
+
if (typeof value !== "string" || value.trim().length === 0)
|
|
8632
|
+
return;
|
|
8633
|
+
return importFromReroute(value);
|
|
8634
|
+
}
|
|
8635
|
+
function generateTypeScript(tree, streamingMap, client, routesImportBase, fallbackImport) {
|
|
8636
|
+
const helperImport = fallbackImport ? `import { createLazyRoute } from 'reroute-js/react';
|
|
8637
|
+
import LazyRouteFallback from '${fallbackImport}';` : "import { createLazyRoute } from 'reroute-js/react';";
|
|
8638
|
+
const clientFallbackArgs = fallbackImport ? ", undefined, LazyRouteFallback" : "";
|
|
8639
|
+
const serverFallbackArgs = fallbackImport ? ", LazyRouteFallback" : "";
|
|
8613
8640
|
const ssrHelper = "const _ssr = (m: any) => m.ssr;";
|
|
8614
8641
|
const metaHelper = "const _meta = (m: any) => m.meta;";
|
|
8615
8642
|
const metaImports = [
|
|
@@ -8633,23 +8660,23 @@ const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
|
8633
8660
|
...tree.routes.map((r, i) => {
|
|
8634
8661
|
const importPath = getImportPath(r.filePath, streamingMap, routesImportBase);
|
|
8635
8662
|
if (client) {
|
|
8636
|
-
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}");`;
|
|
8663
|
+
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}"${clientFallbackArgs});`;
|
|
8637
8664
|
}
|
|
8638
|
-
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}", Route${i}Eager);`;
|
|
8665
|
+
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}", Route${i}Eager${serverFallbackArgs});`;
|
|
8639
8666
|
}),
|
|
8640
8667
|
...tree.layouts.map((l, i) => {
|
|
8641
8668
|
const importPath = getImportPath(l.filePath, streamingMap, routesImportBase);
|
|
8642
8669
|
if (client) {
|
|
8643
|
-
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}");`;
|
|
8670
|
+
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}"${clientFallbackArgs});`;
|
|
8644
8671
|
}
|
|
8645
|
-
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}", Layout${i}Eager);`;
|
|
8672
|
+
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}", Layout${i}Eager${serverFallbackArgs});`;
|
|
8646
8673
|
}),
|
|
8647
8674
|
...tree.notFoundRoutes.map((nf, i) => {
|
|
8648
8675
|
const importPath = getImportPath(nf.filePath, streamingMap, routesImportBase);
|
|
8649
8676
|
if (client) {
|
|
8650
|
-
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}");`;
|
|
8677
|
+
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}"${clientFallbackArgs});`;
|
|
8651
8678
|
}
|
|
8652
|
-
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}", NotFound${i}Eager);`;
|
|
8679
|
+
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}", NotFound${i}Eager${serverFallbackArgs});`;
|
|
8653
8680
|
})
|
|
8654
8681
|
].join(`
|
|
8655
8682
|
`);
|
|
@@ -9503,8 +9530,9 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9503
9530
|
const all = Array.from(new Set([...files, ...nfFiles]));
|
|
9504
9531
|
const tree = generateRouteTree(all.map((f) => f.replace(/\\/g, "/")));
|
|
9505
9532
|
const streamingAnalyses = streamingEnabled ? await buildStreamingWrappersForTree(cwd, routesPath, tree, config2) : new Map;
|
|
9506
|
-
const
|
|
9507
|
-
const
|
|
9533
|
+
const fallbackImport = lazyRouteFallbackImport(config2);
|
|
9534
|
+
const serverRoutes = generateTypeScript(tree, streamingAnalyses, false, routesImportBase, fallbackImport);
|
|
9535
|
+
const clientRoutes = generateTypeScript(tree, streamingAnalyses, true, routesImportBase, fallbackImport);
|
|
9508
9536
|
await Bun.write(join14(cwd, OUTPUT_ROUTES), serverRoutes);
|
|
9509
9537
|
await Bun.write(join14(cwd, OUTPUT_ROUTES_CLIENT), clientRoutes);
|
|
9510
9538
|
});
|
|
@@ -10061,30 +10089,32 @@ async function startGenWatch(cwd, args) {
|
|
|
10061
10089
|
console.log("[reroute/watch] ├─ index.css synced");
|
|
10062
10090
|
}
|
|
10063
10091
|
}
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
if (changed.length === 0)
|
|
10083
|
-
return;
|
|
10084
|
-
const reloadMode = changed.every((n) => n.endsWith(".css")) ? "css" : "full";
|
|
10085
|
-
scheduleBuild(() => rebuildWatchedClient(changed), "client change", reloadMode);
|
|
10092
|
+
const watchClientSources = (dir, skipRoutes) => {
|
|
10093
|
+
let pending = new Set;
|
|
10094
|
+
return watch(dir, { recursive: true }, (_ev, filename) => {
|
|
10095
|
+
if (!filename)
|
|
10096
|
+
return;
|
|
10097
|
+
const name = String(filename);
|
|
10098
|
+
if (!isClientSource(name, skipRoutes))
|
|
10099
|
+
return;
|
|
10100
|
+
pending.add(name);
|
|
10101
|
+
mediumDebounce(() => {
|
|
10102
|
+
const names = [...pending];
|
|
10103
|
+
pending = new Set;
|
|
10104
|
+
retainChangedFiles(dir, names, fingerprint).then((changed) => {
|
|
10105
|
+
if (changed.length === 0)
|
|
10106
|
+
return;
|
|
10107
|
+
const reloadMode = changed.every((n) => n.endsWith(".css")) ? "css" : "full";
|
|
10108
|
+
scheduleBuild(() => rebuildWatchedClient(changed), "client change", reloadMode);
|
|
10109
|
+
});
|
|
10086
10110
|
});
|
|
10087
10111
|
});
|
|
10112
|
+
};
|
|
10113
|
+
const clientWatcher = watchClientSources(clientPath, true);
|
|
10114
|
+
const extraWatchers = (loadedConfig.app?.watch ?? []).map((entry) => {
|
|
10115
|
+
const dir = resolve3(cwd, entry);
|
|
10116
|
+
console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${dir}...`);
|
|
10117
|
+
return watchClientSources(dir, false);
|
|
10088
10118
|
});
|
|
10089
10119
|
console.log(`[reroute/watch] ✓ Watch mode active - ready for changes!
|
|
10090
10120
|
`);
|
|
@@ -10093,7 +10123,8 @@ async function startGenWatch(cwd, args) {
|
|
|
10093
10123
|
clientWatcher,
|
|
10094
10124
|
packagesWatcher,
|
|
10095
10125
|
configWatcher,
|
|
10096
|
-
...envWatchers
|
|
10126
|
+
...envWatchers,
|
|
10127
|
+
...extraWatchers
|
|
10097
10128
|
].filter(Boolean);
|
|
10098
10129
|
return {
|
|
10099
10130
|
close() {
|
|
@@ -10124,10 +10155,10 @@ async function gen(args) {
|
|
|
10124
10155
|
process.exit(0);
|
|
10125
10156
|
}
|
|
10126
10157
|
const session = await startGenWatch(cwd, args);
|
|
10127
|
-
await new Promise((
|
|
10158
|
+
await new Promise((resolve4) => {
|
|
10128
10159
|
process.on("SIGINT", () => {
|
|
10129
10160
|
session.close();
|
|
10130
|
-
|
|
10161
|
+
resolve4();
|
|
10131
10162
|
});
|
|
10132
10163
|
});
|
|
10133
10164
|
process.exit(0);
|
|
@@ -10248,7 +10279,7 @@ async function waitForServerReady(port = 3000, timeout = 30000) {
|
|
|
10248
10279
|
return;
|
|
10249
10280
|
}
|
|
10250
10281
|
} catch {}
|
|
10251
|
-
await new Promise((
|
|
10282
|
+
await new Promise((resolve4) => setTimeout(resolve4, checkInterval));
|
|
10252
10283
|
checkInterval = Math.min(checkInterval * 1.5, maxInterval);
|
|
10253
10284
|
}
|
|
10254
10285
|
throw new Error(`Timeout waiting for server to respond after ${timeout}ms. ` + `Make sure your server is starting correctly on port ${port}.`);
|
|
@@ -95945,7 +95976,7 @@ Should be of format "before:after"`);
|
|
|
95945
95976
|
}
|
|
95946
95977
|
}
|
|
95947
95978
|
function objectize(node) {
|
|
95948
|
-
function
|
|
95979
|
+
function resolve4(value, key) {
|
|
95949
95980
|
if (!value._parent)
|
|
95950
95981
|
return;
|
|
95951
95982
|
if (value._parent._default && value._parent._default[key])
|
|
@@ -95968,8 +95999,8 @@ Should be of format "before:after"`);
|
|
|
95968
95999
|
if (isObject(value)) {
|
|
95969
96000
|
if (!value._before && !value._after)
|
|
95970
96001
|
return objectize(value);
|
|
95971
|
-
value._before = value._before ||
|
|
95972
|
-
value._after = value._after ||
|
|
96002
|
+
value._before = value._before || resolve4(value, "_before");
|
|
96003
|
+
value._after = value._after || resolve4(value, "_after");
|
|
95973
96004
|
return;
|
|
95974
96005
|
}
|
|
95975
96006
|
throw new Error("nodes need to be either {String}, {Object} or {Function}." + value + " is neither.");
|
|
@@ -104866,7 +104897,7 @@ function parsePort(args) {
|
|
|
104866
104897
|
async function waitForInitialBuild(genProcess) {
|
|
104867
104898
|
console.log("[reroute/dev] Waiting for initial build...");
|
|
104868
104899
|
const outputBuffer = [];
|
|
104869
|
-
const buildCompletePromise = new Promise((
|
|
104900
|
+
const buildCompletePromise = new Promise((resolve4, reject) => {
|
|
104870
104901
|
const timeout = setTimeout(() => {
|
|
104871
104902
|
reject(new Error("Timeout waiting for initial build to complete (120s)"));
|
|
104872
104903
|
}, 120000);
|
|
@@ -104876,7 +104907,7 @@ async function waitForInitialBuild(genProcess) {
|
|
|
104876
104907
|
clearTimeout(timeout);
|
|
104877
104908
|
genProcess.stdout?.removeListener("data", checkComplete);
|
|
104878
104909
|
genProcess.stderr?.removeListener("data", checkComplete);
|
|
104879
|
-
|
|
104910
|
+
resolve4();
|
|
104880
104911
|
}
|
|
104881
104912
|
};
|
|
104882
104913
|
genProcess.stdout?.on("data", checkComplete);
|
|
@@ -105067,7 +105098,7 @@ async function start(args) {
|
|
|
105067
105098
|
`);
|
|
105068
105099
|
const genCommand = useShell ? `${rerouteCmd} gen ${genArgs.join(" ")}` : rerouteCmd;
|
|
105069
105100
|
const genArgsWithCmd = useShell ? [] : ["gen", ...genArgs];
|
|
105070
|
-
await new Promise((
|
|
105101
|
+
await new Promise((resolve4, reject) => {
|
|
105071
105102
|
const genProcess = spawn2(genCommand, genArgsWithCmd, {
|
|
105072
105103
|
stdio: ["ignore", "pipe", "pipe"],
|
|
105073
105104
|
shell: useShell
|
|
@@ -105078,7 +105109,7 @@ async function start(args) {
|
|
|
105078
105109
|
if (code !== null && code !== 0) {
|
|
105079
105110
|
reject(new Error(`Gen exited with code ${code}`));
|
|
105080
105111
|
} else {
|
|
105081
|
-
|
|
105112
|
+
resolve4();
|
|
105082
105113
|
}
|
|
105083
105114
|
});
|
|
105084
105115
|
genProcess.on("error", (error) => {
|
|
@@ -105120,13 +105151,13 @@ async function start(args) {
|
|
|
105120
105151
|
serverProcess.kill("SIGINT");
|
|
105121
105152
|
process.exit(0);
|
|
105122
105153
|
});
|
|
105123
|
-
await new Promise((
|
|
105154
|
+
await new Promise((resolve4, reject) => {
|
|
105124
105155
|
serverProcess.on("exit", (code) => {
|
|
105125
105156
|
if (code !== null && code !== 0) {
|
|
105126
105157
|
console.error(colorizeLogPrefixAnsi(`[reroute/start] Server exited with code ${code}`));
|
|
105127
105158
|
reject(new Error(`Server exited with code ${code}`));
|
|
105128
105159
|
} else {
|
|
105129
|
-
|
|
105160
|
+
resolve4();
|
|
105130
105161
|
}
|
|
105131
105162
|
});
|
|
105132
105163
|
serverProcess.on("error", (error) => {
|
|
@@ -105258,7 +105289,7 @@ async function cleanRerouteFolder(cwd) {
|
|
|
105258
105289
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Cleaning .reroute folder...
|
|
105259
105290
|
`));
|
|
105260
105291
|
rmSync(rerouteDir, { recursive: true, force: true });
|
|
105261
|
-
await new Promise((
|
|
105292
|
+
await new Promise((resolve4) => setTimeout(resolve4, 100));
|
|
105262
105293
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] ✓ .reroute folder cleaned
|
|
105263
105294
|
`));
|
|
105264
105295
|
}
|
|
@@ -105284,7 +105315,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
105284
105315
|
const genArgs = useShell ? [] : ["gen", "--prod", noCompression ? "--no-compression" : ""];
|
|
105285
105316
|
const genBuffer = { current: "" };
|
|
105286
105317
|
const handleGenOutput = createOutputHandler(genBuffer);
|
|
105287
|
-
await new Promise((
|
|
105318
|
+
await new Promise((resolve4, reject) => {
|
|
105288
105319
|
const genProcess = spawn3(genCommand, genArgs, {
|
|
105289
105320
|
stdio: ["ignore", "pipe", "pipe"],
|
|
105290
105321
|
shell: useShell
|
|
@@ -105295,7 +105326,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
105295
105326
|
if (code !== null && code !== 0) {
|
|
105296
105327
|
reject(new Error(`Gen exited with code ${code}`));
|
|
105297
105328
|
} else {
|
|
105298
|
-
|
|
105329
|
+
resolve4();
|
|
105299
105330
|
}
|
|
105300
105331
|
});
|
|
105301
105332
|
genProcess.on("error", (error) => {
|
|
@@ -107470,7 +107501,7 @@ async function analyze(args) {
|
|
|
107470
107501
|
const useShell = rerouteCmd.includes(" ");
|
|
107471
107502
|
const buildCommand = useShell ? `${rerouteCmd} build` : rerouteCmd;
|
|
107472
107503
|
const buildArgs = useShell ? [] : ["build"];
|
|
107473
|
-
await new Promise((
|
|
107504
|
+
await new Promise((resolve4, reject) => {
|
|
107474
107505
|
const buildProcess = spawn4(buildCommand, buildArgs, {
|
|
107475
107506
|
stdio: "inherit",
|
|
107476
107507
|
shell: useShell
|
|
@@ -107479,7 +107510,7 @@ async function analyze(args) {
|
|
|
107479
107510
|
if (code !== null && code !== 0) {
|
|
107480
107511
|
reject(new Error(`Build exited with code ${code}`));
|
|
107481
107512
|
} else {
|
|
107482
|
-
|
|
107513
|
+
resolve4();
|
|
107483
107514
|
}
|
|
107484
107515
|
});
|
|
107485
107516
|
buildProcess.on("error", (error) => {
|
|
@@ -107686,8 +107717,8 @@ async function killProcessOnPort(port) {
|
|
|
107686
107717
|
const proc = spawn4("bunx", ["kill-port", String(port)], {
|
|
107687
107718
|
stdio: "ignore"
|
|
107688
107719
|
});
|
|
107689
|
-
await new Promise((
|
|
107690
|
-
proc.on("close", () =>
|
|
107720
|
+
await new Promise((resolve4) => {
|
|
107721
|
+
proc.on("close", () => resolve4());
|
|
107691
107722
|
});
|
|
107692
107723
|
} catch {}
|
|
107693
107724
|
}
|
|
@@ -108050,7 +108081,7 @@ async function getVersionString2() {
|
|
|
108050
108081
|
}
|
|
108051
108082
|
async function getVersion2() {
|
|
108052
108083
|
if (true) {
|
|
108053
|
-
return "1.0.0-alpha.
|
|
108084
|
+
return "1.0.0-alpha.24";
|
|
108054
108085
|
}
|
|
108055
108086
|
const possiblePaths = [
|
|
108056
108087
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -108067,10 +108098,10 @@ async function getVersion2() {
|
|
|
108067
108098
|
}
|
|
108068
108099
|
async function getCommit2() {
|
|
108069
108100
|
if (true) {
|
|
108070
|
-
return "
|
|
108101
|
+
return "ab63579";
|
|
108071
108102
|
}
|
|
108072
108103
|
return "dev";
|
|
108073
108104
|
}
|
|
108074
108105
|
main();
|
|
108075
108106
|
|
|
108076
|
-
//# debugId=
|
|
108107
|
+
//# debugId=6277845B47C49F9964756E2164756E21
|