blodemd 0.0.12 → 0.0.13

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.
@@ -3,12 +3,29 @@ import { fileURLToPath } from "node:url";
3
3
 
4
4
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
5
  const packagesDir = process.env.BLODEMD_PACKAGES_DIR;
6
+ const isStandalone = Boolean(packagesDir);
6
7
  const turbopackRoot =
7
8
  process.env.BLODEMD_TURBOPACK_ROOT ||
8
- (packagesDir
9
+ (isStandalone
9
10
  ? path.resolve(__dirname, "..")
10
11
  : path.resolve(__dirname, "../.."));
11
12
 
13
+ // In monorepo mode we transpile @repo/* from source so edits to the
14
+ // package src/ files hot-reload. In standalone mode the @repo packages
15
+ // ship pre-built `dist/` via their package.json `exports`; transpiling
16
+ // their `src/` would make Turbopack miss the `.js` → `.ts` resolution
17
+ // for same-package imports, so we let Next consume the compiled output.
18
+ const repoTranspilePackages = isStandalone
19
+ ? []
20
+ : [
21
+ "@repo/common",
22
+ "@repo/contracts",
23
+ "@repo/models",
24
+ "@repo/prebuild",
25
+ "@repo/previewing",
26
+ "@repo/validation",
27
+ ];
28
+
12
29
  /** @type {import('next').NextConfig} */
13
30
  const nextConfig = {
14
31
  allowedDevOrigins: ["127.0.0.1"],
@@ -26,14 +43,7 @@ const nextConfig = {
26
43
  images: {
27
44
  unoptimized: true,
28
45
  },
29
- transpilePackages: [
30
- "@repo/common",
31
- "@repo/contracts",
32
- "@repo/models",
33
- "@repo/prebuild",
34
- "@repo/previewing",
35
- "@repo/validation",
36
- ],
46
+ transpilePackages: repoTranspilePackages,
37
47
  turbopack: {
38
48
  // The dev server consumes sibling docs/ and workspace packages/
39
49
  // directories, so Turbopack needs a root that includes them.
@@ -23,9 +23,6 @@
23
23
  ],
24
24
  "@dev/*": [
25
25
  "./*"
26
- ],
27
- "@repo/*": [
28
- "../packages/@repo/*/src/index.ts"
29
26
  ]
30
27
  },
31
28
  "plugins": [
package/dist/cli.mjs CHANGED
@@ -1196,6 +1196,19 @@ const createStandaloneRuntimeRoot = async (configDir = CONFIG_DIR) => {
1196
1196
  await cleanupStandaloneRuntimeRoots(configDir);
1197
1197
  return await fs.mkdtemp(path.join(configDir, STANDALONE_RUNTIME_PREFIX));
1198
1198
  };
1199
+ /**
1200
+ * Locate the `node_modules` directory that actually contains the CLI's
1201
+ * transitive dependencies. Package managers like npm/yarn-classic (and
1202
+ * `npx` caches) hoist shared deps above the package directory, so
1203
+ * `<cliPackageRoot>/node_modules` may not exist or may not contain `next`.
1204
+ * Resolve `next/package.json` and use the directory that owns it.
1205
+ */
1206
+ const resolveRuntimeNodeModules = async (cliPackageRoot) => {
1207
+ const localNodeModules = path.join(cliPackageRoot, "node_modules");
1208
+ if (await fileExists(path.join(localNodeModules, "next", "package.json"))) return localNodeModules;
1209
+ const nextPkgPath = createRequire(path.join(cliPackageRoot, "package.json")).resolve("next/package.json");
1210
+ return path.dirname(path.dirname(nextPkgPath));
1211
+ };
1199
1212
  const materializeStandaloneRuntime = async (cliPackageRoot) => {
1200
1213
  const runtimeRoot = await createStandaloneRuntimeRoot();
1201
1214
  try {
@@ -1204,9 +1217,17 @@ const materializeStandaloneRuntime = async (cliPackageRoot) => {
1204
1217
  "docs",
1205
1218
  "packages"
1206
1219
  ]) await copyStandaloneTree(path.join(cliPackageRoot, dir), path.join(runtimeRoot, dir));
1207
- await fs.symlink(path.join(cliPackageRoot, "node_modules"), path.join(runtimeRoot, "node_modules"), process.platform === "win32" ? "junction" : "dir");
1208
- await fs.mkdir(path.join(runtimeRoot, "dev-server", "node_modules"), { recursive: true });
1209
- await fs.symlink(path.join(runtimeRoot, "packages", "@repo"), path.join(runtimeRoot, "dev-server", "node_modules", "@repo"), process.platform === "win32" ? "junction" : "dir");
1220
+ const runtimeNodeModules = await resolveRuntimeNodeModules(cliPackageRoot);
1221
+ await fs.symlink(runtimeNodeModules, path.join(runtimeRoot, "node_modules"), process.platform === "win32" ? "junction" : "dir");
1222
+ const linkTarget = path.join(runtimeRoot, "packages", "@repo");
1223
+ for (const consumer of [
1224
+ "dev-server",
1225
+ "docs",
1226
+ "packages"
1227
+ ]) {
1228
+ await fs.mkdir(path.join(runtimeRoot, consumer, "node_modules"), { recursive: true });
1229
+ await fs.symlink(linkTarget, path.join(runtimeRoot, consumer, "node_modules", "@repo"), process.platform === "win32" ? "junction" : "dir");
1230
+ }
1210
1231
  await fs.writeFile(path.join(runtimeRoot, "dev-server", "package.json"), `${JSON.stringify({
1211
1232
  dependencies: {
1212
1233
  next: "16.2.1",