OpenAPI: fix broken dereference-json-schema import in dist (#3074)

* OpenAPI: fix broken dereference-json-schema import in dist

unbundle + inlineOnly produces hardcoded .pnpm/ paths in the built
output, breaking consumers. Move dereference-json-schema to dependencies
and use default import for CJS interop.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Add changeset and update lockfile

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Vitor Bari Buccianti
2026-03-07 00:01:21 +08:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 3e8d4f43c4
commit e2e07824c3
5 changed files with 493 additions and 235 deletions
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
Fix broken `dereference-json-schema` import in built output caused by `unbundle + inlineOnly` producing hardcoded `.pnpm/` paths
+2 -2
View File
@@ -69,7 +69,8 @@
"remark": "^15.0.1",
"remark-rehype": "^11.1.2",
"tailwind-merge": "^3.5.0",
"xml-js": "^1.6.11"
"xml-js": "^1.6.11",
"dereference-json-schema": "^0.2.1"
},
"devDependencies": {
"@fumadocs/tailwind": "workspace:*",
@@ -78,7 +79,6 @@
"@types/node": "25.3.3",
"@types/openapi-sampler": "^1.0.3",
"@types/react": "^19.2.14",
"dereference-json-schema": "^0.2.1",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
@@ -4,7 +4,7 @@ import { bundle } from '@scalar/json-magic/bundle';
import { upgrade } from '@scalar/openapi-upgrader';
import { fetchUrls, readFiles } from '@scalar/json-magic/bundle/plugins/node';
import type { JSONSchema } from 'json-schema-typed/draft-2020-12';
import { resolveRefSync } from 'dereference-json-schema';
import dereference from 'dereference-json-schema';
export interface ProcessedDocument {
/**
@@ -84,7 +84,7 @@ function dereferenceSync(
// object
if ('$ref' in current && typeof current['$ref'] === 'string') {
const ref = current['$ref'];
const out = resolveRefSync(cloned as never, ref) as JSONSchema;
const out = dereference.resolveRefSync(cloned as never, ref) as JSONSchema;
onDereference(ref, out);
return out;
}
+1 -1
View File
@@ -20,7 +20,7 @@ export default defineConfig({
async onSuccess() {
await compileInline();
},
inlineOnly: ['dereference-json-schema'],
inlineOnly: [],
exports: {
enabled: true,
customExports(v) {
+483 -230
View File
File diff suppressed because it is too large Load Diff