blodemd 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +50 -174
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -36
- package/dev-server/app/[[...slug]]/page.tsx +0 -140
- package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
- package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
- package/dev-server/app/blodemd-dev/version/route.ts +0 -14
- package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
- package/dev-server/app/error.tsx +0 -24
- package/dev-server/app/favicon.ico +0 -0
- package/dev-server/app/globals.css +0 -4
- package/dev-server/app/layout.tsx +0 -38
- package/dev-server/app/not-found.tsx +0 -18
- package/dev-server/app/search/route.ts +0 -17
- package/dev-server/components/dev-reload-script.tsx +0 -86
- package/dev-server/components/providers.tsx +0 -15
- package/dev-server/lib/dev-state.ts +0 -8
- package/dev-server/lib/local-content-source.ts +0 -103
- package/dev-server/lib/local-runtime.tsx +0 -555
- package/dev-server/next-env.d.ts +0 -5
- package/dev-server/next.config.js +0 -54
- package/dev-server/package.json +0 -61
- package/dev-server/postcss.config.mjs +0 -7
- package/dev-server/public/glide-variable.woff2 +0 -0
- package/dev-server/tsconfig.json +0 -50
- package/docs/app/globals.css +0 -471
- package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
- package/docs/components/api/api-playground.tsx +0 -467
- package/docs/components/api/api-reference.tsx +0 -157
- package/docs/components/content/collection-index.tsx +0 -114
- package/docs/components/docs/contextual-menu.tsx +0 -495
- package/docs/components/docs/copy-page-menu.tsx +0 -364
- package/docs/components/docs/doc-header.tsx +0 -223
- package/docs/components/docs/doc-shell.tsx +0 -355
- package/docs/components/docs/doc-sidebar.tsx +0 -256
- package/docs/components/docs/doc-toc.tsx +0 -46
- package/docs/components/docs/mobile-nav.tsx +0 -195
- package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
- package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
- package/docs/components/git/repo-picker.tsx +0 -529
- package/docs/components/icons/doc-icon.tsx +0 -96
- package/docs/components/mdx/accordion.tsx +0 -83
- package/docs/components/mdx/agent-instructions.tsx +0 -17
- package/docs/components/mdx/badge.tsx +0 -79
- package/docs/components/mdx/callout.tsx +0 -88
- package/docs/components/mdx/card.tsx +0 -110
- package/docs/components/mdx/code-block.tsx +0 -80
- package/docs/components/mdx/code-group.tsx +0 -203
- package/docs/components/mdx/color.tsx +0 -87
- package/docs/components/mdx/columns.tsx +0 -25
- package/docs/components/mdx/expandable.tsx +0 -45
- package/docs/components/mdx/field-layout.tsx +0 -77
- package/docs/components/mdx/frame.tsx +0 -23
- package/docs/components/mdx/get-text-content.ts +0 -18
- package/docs/components/mdx/icon.tsx +0 -12
- package/docs/components/mdx/iframe.tsx +0 -62
- package/docs/components/mdx/index.tsx +0 -121
- package/docs/components/mdx/installer.tsx +0 -20
- package/docs/components/mdx/panel.tsx +0 -11
- package/docs/components/mdx/param-field.tsx +0 -56
- package/docs/components/mdx/preview.tsx +0 -36
- package/docs/components/mdx/prompt.tsx +0 -63
- package/docs/components/mdx/request-example.tsx +0 -27
- package/docs/components/mdx/response-field.tsx +0 -42
- package/docs/components/mdx/steps.tsx +0 -92
- package/docs/components/mdx/tabs.tsx +0 -193
- package/docs/components/mdx/tile.tsx +0 -43
- package/docs/components/mdx/tooltip.tsx +0 -71
- package/docs/components/mdx/tree.tsx +0 -120
- package/docs/components/mdx/type-table.tsx +0 -71
- package/docs/components/mdx/update.tsx +0 -44
- package/docs/components/mdx/video.tsx +0 -45
- package/docs/components/mdx/view.tsx +0 -66
- package/docs/components/posthog-provider.tsx +0 -42
- package/docs/components/providers.tsx +0 -15
- package/docs/components/tenant-analytics.tsx +0 -49
- package/docs/components/third-parties.tsx +0 -32
- package/docs/components/ui/badge.tsx +0 -61
- package/docs/components/ui/breadcrumb.tsx +0 -112
- package/docs/components/ui/button-group.tsx +0 -83
- package/docs/components/ui/button.tsx +0 -65
- package/docs/components/ui/card.tsx +0 -92
- package/docs/components/ui/command.tsx +0 -167
- package/docs/components/ui/copy-button.tsx +0 -129
- package/docs/components/ui/dialog.tsx +0 -146
- package/docs/components/ui/field.tsx +0 -237
- package/docs/components/ui/input.tsx +0 -23
- package/docs/components/ui/kbd.tsx +0 -98
- package/docs/components/ui/label.tsx +0 -22
- package/docs/components/ui/morph-icon.tsx +0 -79
- package/docs/components/ui/popover.tsx +0 -267
- package/docs/components/ui/search-dialog.tsx +0 -431
- package/docs/components/ui/search.tsx +0 -101
- package/docs/components/ui/separator.tsx +0 -26
- package/docs/components/ui/sheet.tsx +0 -133
- package/docs/components/ui/sidebar.tsx +0 -758
- package/docs/components/ui/skeleton.tsx +0 -11
- package/docs/components/ui/switch.tsx +0 -32
- package/docs/components/ui/tabs.tsx +0 -138
- package/docs/components/ui/theme-toggle.tsx +0 -62
- package/docs/components/ui/tooltip.tsx +0 -53
- package/docs/components/web-mcp.tsx +0 -115
- package/docs/lib/agent-skills.ts +0 -48
- package/docs/lib/api-client.ts +0 -72
- package/docs/lib/config.ts +0 -6
- package/docs/lib/content-root.ts +0 -33
- package/docs/lib/content-source.ts +0 -70
- package/docs/lib/contextual-options.ts +0 -222
- package/docs/lib/dashboard-session.ts +0 -167
- package/docs/lib/db.ts +0 -13
- package/docs/lib/docs-collection.ts +0 -7
- package/docs/lib/docs-runtime.tsx +0 -745
- package/docs/lib/edge-config.ts +0 -95
- package/docs/lib/env.ts +0 -23
- package/docs/lib/etag.ts +0 -22
- package/docs/lib/github-install.ts +0 -33
- package/docs/lib/llms-full.ts +0 -82
- package/docs/lib/marketing-markdown.ts +0 -79
- package/docs/lib/marketing-site.ts +0 -31
- package/docs/lib/mdx.ts +0 -98
- package/docs/lib/navigation.ts +0 -288
- package/docs/lib/openapi-proxy.ts +0 -88
- package/docs/lib/openapi.ts +0 -158
- package/docs/lib/platform-config.ts +0 -6
- package/docs/lib/project-authz.ts +0 -46
- package/docs/lib/routes.ts +0 -103
- package/docs/lib/server-cache.ts +0 -83
- package/docs/lib/shiki.ts +0 -44
- package/docs/lib/supabase.ts +0 -37
- package/docs/lib/tenancy.ts +0 -364
- package/docs/lib/tenant-headers.ts +0 -43
- package/docs/lib/tenant-static.ts +0 -705
- package/docs/lib/tenant-utility-context.ts +0 -62
- package/docs/lib/tenants.ts +0 -72
- package/docs/lib/theme.ts +0 -29
- package/docs/lib/time-ago.ts +0 -24
- package/docs/lib/toc.ts +0 -2
- package/docs/lib/use-mobile.ts +0 -19
- package/docs/lib/use-tab-observer.ts +0 -71
- package/docs/lib/utils.ts +0 -5
- package/packages/@repo/common/dist/index.d.ts +0 -16
- package/packages/@repo/common/dist/index.d.ts.map +0 -1
- package/packages/@repo/common/dist/index.js +0 -84
- package/packages/@repo/common/package.json +0 -34
- package/packages/@repo/common/src/index.ts +0 -101
- package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
- package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/analytics.js +0 -18
- package/packages/@repo/contracts/dist/api-key.d.ts +0 -27
- package/packages/@repo/contracts/dist/api-key.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/api-key.js +0 -20
- package/packages/@repo/contracts/dist/dates.d.ts +0 -4
- package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/dates.js +0 -2
- package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
- package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/deployment.js +0 -46
- package/packages/@repo/contracts/dist/domain.d.ts +0 -94
- package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/domain.js +0 -36
- package/packages/@repo/contracts/dist/git.d.ts +0 -28
- package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/git.js +0 -24
- package/packages/@repo/contracts/dist/ids.d.ts +0 -14
- package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/ids.js +0 -11
- package/packages/@repo/contracts/dist/index.d.ts +0 -12
- package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/index.js +0 -13
- package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
- package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/pagination.js +0 -15
- package/packages/@repo/contracts/dist/project.d.ts +0 -42
- package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/project.js +0 -25
- package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
- package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/tenant.js +0 -58
- package/packages/@repo/contracts/dist/user.d.ts +0 -9
- package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/user.js +0 -9
- package/packages/@repo/contracts/package.json +0 -37
- package/packages/@repo/contracts/src/analytics.ts +0 -33
- package/packages/@repo/contracts/src/api-key.ts +0 -27
- package/packages/@repo/contracts/src/dates.ts +0 -4
- package/packages/@repo/contracts/src/deployment.ts +0 -73
- package/packages/@repo/contracts/src/domain.ts +0 -51
- package/packages/@repo/contracts/src/git.ts +0 -31
- package/packages/@repo/contracts/src/ids.ts +0 -23
- package/packages/@repo/contracts/src/index.ts +0 -13
- package/packages/@repo/contracts/src/pagination.ts +0 -21
- package/packages/@repo/contracts/src/project.ts +0 -32
- package/packages/@repo/contracts/src/tenant.ts +0 -94
- package/packages/@repo/contracts/src/user.ts +0 -12
- package/packages/@repo/models/dist/docs-config.d.ts +0 -961
- package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
- package/packages/@repo/models/dist/docs-config.js +0 -531
- package/packages/@repo/models/dist/index.d.ts +0 -3
- package/packages/@repo/models/dist/index.d.ts.map +0 -1
- package/packages/@repo/models/dist/index.js +0 -3
- package/packages/@repo/models/dist/tenant.d.ts +0 -37
- package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/models/dist/tenant.js +0 -1
- package/packages/@repo/models/package.json +0 -37
- package/packages/@repo/models/src/docs-config.ts +0 -629
- package/packages/@repo/models/src/index.ts +0 -3
- package/packages/@repo/models/src/tenant.ts +0 -44
- package/packages/@repo/prebuild/dist/index.d.ts +0 -2
- package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/index.js +0 -2
- package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
- package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/openapi.js +0 -86
- package/packages/@repo/prebuild/package.json +0 -39
- package/packages/@repo/prebuild/src/index.ts +0 -2
- package/packages/@repo/prebuild/src/openapi.ts +0 -154
- package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
- package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/blob-source.js +0 -128
- package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
- package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/config-loader.js +0 -231
- package/packages/@repo/previewing/dist/constants.d.ts +0 -15
- package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/constants.js +0 -14
- package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-index.js +0 -291
- package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
- package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-source.js +0 -1
- package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
- package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/fs-source.js +0 -71
- package/packages/@repo/previewing/dist/index.d.ts +0 -16
- package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/index.js +0 -13
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
- package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
- package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/format.js +0 -43
- package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/links.js +0 -31
- package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
- package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
- package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
- package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/search-index.js +0 -23
- package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
- package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/serialization.js +0 -108
- package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
- package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/toc-index.js +0 -53
- package/packages/@repo/previewing/dist/types.d.ts +0 -92
- package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/types.js +0 -1
- package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/utility-index.js +0 -201
- package/packages/@repo/previewing/package.json +0 -41
- package/packages/@repo/previewing/src/blob-source.ts +0 -185
- package/packages/@repo/previewing/src/config-loader.ts +0 -316
- package/packages/@repo/previewing/src/constants.ts +0 -16
- package/packages/@repo/previewing/src/content-index.ts +0 -384
- package/packages/@repo/previewing/src/content-source.ts +0 -12
- package/packages/@repo/previewing/src/fs-source.ts +0 -103
- package/packages/@repo/previewing/src/index.ts +0 -71
- package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
- package/packages/@repo/previewing/src/markdown/format.ts +0 -63
- package/packages/@repo/previewing/src/markdown/links.ts +0 -46
- package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
- package/packages/@repo/previewing/src/search-index.ts +0 -38
- package/packages/@repo/previewing/src/serialization.ts +0 -191
- package/packages/@repo/previewing/src/toc-index.ts +0 -72
- package/packages/@repo/previewing/src/types.ts +0 -105
- package/packages/@repo/previewing/src/utility-index.ts +0 -304
- package/packages/@repo/validation/dist/index.d.ts +0 -12
- package/packages/@repo/validation/dist/index.d.ts.map +0 -1
- package/packages/@repo/validation/dist/index.js +0 -30
- package/packages/@repo/validation/package.json +0 -38
- package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
- package/packages/@repo/validation/src/index.ts +0 -59
- package/scripts/prepare-package.mjs +0 -53
- package/scripts/repo-packages.mjs +0 -8
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
import { Command, InvalidArgumentError } from "commander";
|
|
4
3
|
import { confirm, intro, isCancel, log, select, spinner, text } from "@clack/prompts";
|
|
5
4
|
import chalk from "chalk";
|
|
@@ -1973,51 +1972,7 @@ const DEV_READY_TIMEOUT_MS = 45e3;
|
|
|
1973
1972
|
const DEV_PORT_SCAN_LIMIT = 10;
|
|
1974
1973
|
const DEV_SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
1975
1974
|
const LOCALHOST = "127.0.0.1";
|
|
1976
|
-
const
|
|
1977
|
-
".next",
|
|
1978
|
-
".turbo",
|
|
1979
|
-
"node_modules"
|
|
1980
|
-
]);
|
|
1981
|
-
const STANDALONE_RUNTIME_MAX_AGE_MS = 1440 * 60 * 1e3;
|
|
1982
|
-
const STANDALONE_RUNTIME_PREFIX = "standalone-runtime-";
|
|
1983
|
-
const TURBOPACK_ARGS = ["dev", "--turbopack"];
|
|
1984
|
-
const fileExists = async (filePath) => {
|
|
1985
|
-
try {
|
|
1986
|
-
await fs.access(filePath);
|
|
1987
|
-
return true;
|
|
1988
|
-
} catch {
|
|
1989
|
-
return false;
|
|
1990
|
-
}
|
|
1991
|
-
};
|
|
1992
|
-
const resolveCommonAncestor = (pathsToCompare) => {
|
|
1993
|
-
const [firstPath, ...restPaths] = pathsToCompare;
|
|
1994
|
-
if (!firstPath) return path.sep;
|
|
1995
|
-
const first = path.resolve(firstPath);
|
|
1996
|
-
const { root } = path.parse(first);
|
|
1997
|
-
const firstSegments = first.slice(root.length).split(path.sep).filter(Boolean);
|
|
1998
|
-
const sharedSegments = [];
|
|
1999
|
-
for (const [index, segment] of firstSegments.entries()) {
|
|
2000
|
-
if (!restPaths.every((candidatePath) => {
|
|
2001
|
-
const candidate = path.resolve(candidatePath);
|
|
2002
|
-
if (path.parse(candidate).root !== root) return false;
|
|
2003
|
-
return candidate.slice(root.length).split(path.sep).filter(Boolean)[index] === segment;
|
|
2004
|
-
})) break;
|
|
2005
|
-
sharedSegments.push(segment);
|
|
2006
|
-
}
|
|
2007
|
-
return path.join(root, ...sharedSegments);
|
|
2008
|
-
};
|
|
2009
|
-
const cleanupStandaloneRuntimeRoots = async (configDir, maxAgeMs = STANDALONE_RUNTIME_MAX_AGE_MS) => {
|
|
2010
|
-
const cutoff = Date.now() - maxAgeMs;
|
|
2011
|
-
const entries = await fs.readdir(configDir, { withFileTypes: true });
|
|
2012
|
-
await Promise.all(entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(STANDALONE_RUNTIME_PREFIX)).map(async (entry) => {
|
|
2013
|
-
const entryPath = path.join(configDir, entry.name);
|
|
2014
|
-
if ((await fs.stat(entryPath)).mtimeMs >= cutoff) return;
|
|
2015
|
-
await fs.rm(entryPath, {
|
|
2016
|
-
force: true,
|
|
2017
|
-
recursive: true
|
|
2018
|
-
});
|
|
2019
|
-
}));
|
|
2020
|
-
};
|
|
1975
|
+
const DEV_PACKAGE_NAME = "blodemd-dev";
|
|
2021
1976
|
const probePortAvailability = async (port) => {
|
|
2022
1977
|
const server = createServer$1();
|
|
2023
1978
|
const listening = (async () => {
|
|
@@ -2070,122 +2025,33 @@ const shutdownChildProcess = async (child, timeoutMs = DEV_SHUTDOWN_TIMEOUT_MS)
|
|
|
2070
2025
|
clearTimeout(timer);
|
|
2071
2026
|
});
|
|
2072
2027
|
};
|
|
2073
|
-
|
|
2074
|
-
* Derive the CLI npm package root from the running script path.
|
|
2075
|
-
* The CLI entry point is at `<pkg-root>/dist/cli.mjs`.
|
|
2076
|
-
*/
|
|
2077
|
-
const resolveCliPackageRoot = (cliFilePath) => path.dirname(path.dirname(cliFilePath));
|
|
2078
|
-
const copyStandaloneTree = async (sourceDir, targetDir) => {
|
|
2079
|
-
await fs.cp(sourceDir, targetDir, {
|
|
2080
|
-
filter: (source) => {
|
|
2081
|
-
const relative = path.relative(sourceDir, source);
|
|
2082
|
-
if (!relative) return true;
|
|
2083
|
-
const topSegment = relative.split(path.sep)[0] ?? "";
|
|
2084
|
-
return !RUNTIME_EXCLUDE_DIRS.has(topSegment);
|
|
2085
|
-
},
|
|
2086
|
-
recursive: true
|
|
2087
|
-
});
|
|
2088
|
-
};
|
|
2089
|
-
const isStandaloneCliInstall = async (cliPackageRoot) => {
|
|
2028
|
+
const fileExists = async (filePath) => {
|
|
2090
2029
|
try {
|
|
2091
|
-
|
|
2030
|
+
await fs.access(filePath);
|
|
2031
|
+
return true;
|
|
2092
2032
|
} catch {
|
|
2093
|
-
return
|
|
2033
|
+
return false;
|
|
2094
2034
|
}
|
|
2095
2035
|
};
|
|
2096
|
-
const createStandaloneRuntimeRoot = async (configDir = CONFIG_DIR) => {
|
|
2097
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
2098
|
-
await cleanupStandaloneRuntimeRoots(configDir);
|
|
2099
|
-
return await fs.mkdtemp(path.join(configDir, STANDALONE_RUNTIME_PREFIX));
|
|
2100
|
-
};
|
|
2101
2036
|
/**
|
|
2102
|
-
*
|
|
2103
|
-
*
|
|
2104
|
-
* `npx` caches) hoist shared deps above the package directory, so
|
|
2105
|
-
* `<cliPackageRoot>/node_modules` may not exist or may not contain `next`.
|
|
2106
|
-
* Resolve `next/package.json` and use the directory that owns it.
|
|
2037
|
+
* Derive the CLI npm package root from the running script path.
|
|
2038
|
+
* The CLI entry point is at `<pkg-root>/dist/cli.mjs`.
|
|
2107
2039
|
*/
|
|
2108
|
-
const
|
|
2109
|
-
const localNodeModules = path.join(cliPackageRoot, "node_modules");
|
|
2110
|
-
if (await fileExists(path.join(localNodeModules, "next", "package.json"))) return localNodeModules;
|
|
2111
|
-
const nextPkgPath = createRequire(path.join(cliPackageRoot, "package.json")).resolve("next/package.json");
|
|
2112
|
-
return path.dirname(path.dirname(nextPkgPath));
|
|
2113
|
-
};
|
|
2114
|
-
const materializeStandaloneRuntime = async (cliPackageRoot) => {
|
|
2115
|
-
const runtimeRoot = await createStandaloneRuntimeRoot();
|
|
2116
|
-
try {
|
|
2117
|
-
for (const dir of [
|
|
2118
|
-
"dev-server",
|
|
2119
|
-
"docs",
|
|
2120
|
-
"packages"
|
|
2121
|
-
]) await copyStandaloneTree(path.join(cliPackageRoot, dir), path.join(runtimeRoot, dir));
|
|
2122
|
-
const runtimeNodeModules = await resolveRuntimeNodeModules(cliPackageRoot);
|
|
2123
|
-
await fs.symlink(runtimeNodeModules, path.join(runtimeRoot, "node_modules"), process.platform === "win32" ? "junction" : "dir");
|
|
2124
|
-
const linkTarget = path.join(runtimeRoot, "packages", "@repo");
|
|
2125
|
-
for (const consumer of [
|
|
2126
|
-
"dev-server",
|
|
2127
|
-
"docs",
|
|
2128
|
-
"packages"
|
|
2129
|
-
]) {
|
|
2130
|
-
await fs.mkdir(path.join(runtimeRoot, consumer, "node_modules"), { recursive: true });
|
|
2131
|
-
await fs.symlink(linkTarget, path.join(runtimeRoot, consumer, "node_modules", "@repo"), process.platform === "win32" ? "junction" : "dir");
|
|
2132
|
-
}
|
|
2133
|
-
await fs.writeFile(path.join(runtimeRoot, "dev-server", "package.json"), `${JSON.stringify({
|
|
2134
|
-
dependencies: {
|
|
2135
|
-
next: "16.2.1",
|
|
2136
|
-
react: "^19.2.0",
|
|
2137
|
-
"react-dom": "^19.2.0"
|
|
2138
|
-
},
|
|
2139
|
-
devDependencies: {
|
|
2140
|
-
"@types/node": "^24.12.2",
|
|
2141
|
-
"@types/react": "19.2.14",
|
|
2142
|
-
"@types/react-dom": "19.2.3",
|
|
2143
|
-
typescript: "6.0.2"
|
|
2144
|
-
},
|
|
2145
|
-
name: "blodemd-dev-server",
|
|
2146
|
-
private: true,
|
|
2147
|
-
type: "module"
|
|
2148
|
-
}, null, 2)}\n`);
|
|
2149
|
-
return {
|
|
2150
|
-
devServerDir: path.join(runtimeRoot, "dev-server"),
|
|
2151
|
-
runtimeRoot
|
|
2152
|
-
};
|
|
2153
|
-
} catch (error) {
|
|
2154
|
-
await fs.rm(runtimeRoot, {
|
|
2155
|
-
force: true,
|
|
2156
|
-
recursive: true
|
|
2157
|
-
});
|
|
2158
|
-
throw error;
|
|
2159
|
-
}
|
|
2160
|
-
};
|
|
2040
|
+
const resolveCliPackageRoot = (cliFilePath) => path.dirname(path.dirname(cliFilePath));
|
|
2161
2041
|
/**
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2042
|
+
* Read the CLI's own version so the delegated `blodemd-dev` invocation is
|
|
2043
|
+
* pinned to the exact matching release (they version together via changesets).
|
|
2164
2044
|
*/
|
|
2165
|
-
const
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
try {
|
|
2170
|
-
createRequire(path.join(cliPackageRoot, "package.json")).resolve("next/package.json");
|
|
2171
|
-
} catch {
|
|
2172
|
-
return null;
|
|
2173
|
-
}
|
|
2174
|
-
const runtime = await materializeStandaloneRuntime(cliPackageRoot);
|
|
2175
|
-
return {
|
|
2176
|
-
devServerDir: runtime.devServerDir,
|
|
2177
|
-
mode: "standalone",
|
|
2178
|
-
nextPackageRoot: cliPackageRoot,
|
|
2179
|
-
runtimeRoot: runtime.runtimeRoot
|
|
2180
|
-
};
|
|
2045
|
+
const readCliPackageVersion = async (cliFilePath) => {
|
|
2046
|
+
const packageJsonPath = path.join(resolveCliPackageRoot(cliFilePath), "package.json");
|
|
2047
|
+
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
2048
|
+
return JSON.parse(raw).version ?? "0.0.0";
|
|
2181
2049
|
};
|
|
2182
2050
|
/**
|
|
2183
|
-
*
|
|
2051
|
+
* Walk up from the running CLI looking for the blodemd monorepo checkout.
|
|
2052
|
+
* Returns the repo root when found (development mode), otherwise `null`
|
|
2053
|
+
* (installed mode, which delegates to `blodemd-dev`).
|
|
2184
2054
|
*/
|
|
2185
|
-
const resolveNextBin = (cliPackageRoot) => {
|
|
2186
|
-
const nextPkgPath = createRequire(path.join(cliPackageRoot, "package.json")).resolve("next/package.json");
|
|
2187
|
-
return path.join(path.dirname(nextPkgPath), "dist", "bin", "next");
|
|
2188
|
-
};
|
|
2189
2055
|
const findMonorepoRoot = async (start) => {
|
|
2190
2056
|
let current = start;
|
|
2191
2057
|
while (true) {
|
|
@@ -2193,35 +2059,50 @@ const findMonorepoRoot = async (start) => {
|
|
|
2193
2059
|
if (await fileExists(packageJsonPath)) {
|
|
2194
2060
|
const raw = await fs.readFile(packageJsonPath, "utf8");
|
|
2195
2061
|
const workspaces = JSON.parse(raw).workspaces ?? [];
|
|
2196
|
-
|
|
2062
|
+
const hasWorkspaces = workspaces.includes("apps/*") && workspaces.includes("packages/*");
|
|
2063
|
+
const hasDevServer = await fileExists(path.join(current, "apps", "dev-server", "next.config.js"));
|
|
2064
|
+
if (hasWorkspaces && hasDevServer) return current;
|
|
2197
2065
|
}
|
|
2198
2066
|
const parent = path.dirname(current);
|
|
2199
2067
|
if (parent === current) break;
|
|
2200
2068
|
current = parent;
|
|
2201
2069
|
}
|
|
2202
|
-
|
|
2070
|
+
return null;
|
|
2203
2071
|
};
|
|
2204
2072
|
const resolveDevServer = async (cliFilePath) => {
|
|
2205
|
-
const
|
|
2206
|
-
if (
|
|
2207
|
-
return {
|
|
2073
|
+
const repoRoot = await findMonorepoRoot(path.dirname(cliFilePath));
|
|
2074
|
+
if (repoRoot) return {
|
|
2208
2075
|
mode: "monorepo",
|
|
2209
|
-
repoRoot
|
|
2076
|
+
repoRoot
|
|
2077
|
+
};
|
|
2078
|
+
return {
|
|
2079
|
+
devPackageVersion: await readCliPackageVersion(cliFilePath),
|
|
2080
|
+
mode: "delegated"
|
|
2210
2081
|
};
|
|
2211
2082
|
};
|
|
2212
2083
|
const buildDevServerLaunch = (server, { root, port }) => {
|
|
2213
|
-
if (server.mode === "
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2084
|
+
if (server.mode === "delegated") {
|
|
2085
|
+
const npxCommand = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
2086
|
+
return {
|
|
2087
|
+
args: [
|
|
2088
|
+
"-y",
|
|
2089
|
+
`${DEV_PACKAGE_NAME}@${server.devPackageVersion}`,
|
|
2090
|
+
"dev",
|
|
2091
|
+
"--port",
|
|
2092
|
+
String(port),
|
|
2093
|
+
"--dir",
|
|
2094
|
+
root,
|
|
2095
|
+
"--no-open"
|
|
2096
|
+
],
|
|
2097
|
+
command: npxCommand,
|
|
2098
|
+
cwd: process.cwd(),
|
|
2099
|
+
env: {
|
|
2100
|
+
...process.env,
|
|
2101
|
+
DOCS_ROOT: root,
|
|
2102
|
+
PORT: String(port)
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2225
2106
|
return {
|
|
2226
2107
|
args: [
|
|
2227
2108
|
"run",
|
|
@@ -2267,7 +2148,6 @@ const defaultDevCommandDependencies = {
|
|
|
2267
2148
|
getLog: log,
|
|
2268
2149
|
getOpen: open,
|
|
2269
2150
|
parsePortValue: parsePort,
|
|
2270
|
-
removeDirectory: fs.rm,
|
|
2271
2151
|
resolveDevPortValue: resolveDevPort,
|
|
2272
2152
|
resolveDocsRootValue: resolveDocsRoot,
|
|
2273
2153
|
resolveServer: resolveDevServer,
|
|
@@ -2302,10 +2182,6 @@ const devCommand = async ({ dir, openBrowser, port: portValue }, dependencies =
|
|
|
2302
2182
|
watcher = null;
|
|
2303
2183
|
}
|
|
2304
2184
|
await dependencies.shutdownChild(child);
|
|
2305
|
-
if (server.mode === "standalone") await dependencies.removeDirectory(server.runtimeRoot, {
|
|
2306
|
-
force: true,
|
|
2307
|
-
recursive: true
|
|
2308
|
-
});
|
|
2309
2185
|
};
|
|
2310
2186
|
process.once("SIGINT", closeAll);
|
|
2311
2187
|
process.once("SIGTERM", closeAll);
|