Skip to content

Commit b756cea

Browse files
committed
build(shared): nest internal build chunks under _chunks/
Rolldown's content-hashed shared chunks were emitted flat in dist/runtime alongside the entry points. Since the package exposes "./*" mapping to dist/runtime/*, those chunks were enumerated as public subpaths and surfaced as phantom breaking changes in API-diff tooling whenever a chunk hash changed. Route them into dist/runtime/_chunks/ so the single-segment wildcard glob only matches real entry points. Runtime and type resolution are unchanged.
1 parent da93ece commit b756cea

4 files changed

Lines changed: 31 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Nest rolldown's shared build chunks under `dist/runtime/_chunks/` instead of emitting them flat next to the entry points. The package exposes `"./*"`, which resolves to `dist/runtime/*`, so the content-hashed internal chunks were being picked up by API-diff tooling whenever a chunk hash shifted. Entry and type resolution are unchanged; the chunks are still referenced by relative path, and external `./_chunks/*` package subpaths are blocked.

break-check.config.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,12 @@
2323
"snapshotDir": ".api-snapshots",
2424
"mainBranch": "main",
2525
"checkVersionBump": true,
26-
"outputFormat": "markdown"
26+
"outputFormat": "markdown",
27+
"ignoreSubpaths": [
28+
"./handleValueOrFn-BWsoUzyL",
29+
"./index-CTKNTj8t",
30+
"./moduleManager-BsmFyRrH",
31+
"./url-BIKflgSC",
32+
"./waitForElement-DZxkXjac"
33+
]
2734
}

packages/shared/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"default": "./dist/runtime/internal/clerk-js/*.js"
3131
}
3232
},
33+
"./_chunks/*": null,
3334
"./*": {
3435
"import": {
3536
"types": "./dist/runtime/*.d.mts",

packages/shared/tsdown.config.mts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ export default defineConfig(({ watch, env }) => {
5555
],
5656
outDir: './dist/runtime',
5757
unbundle: false,
58+
// Route rolldown's shared chunks into a nested `_chunks/` directory. The
59+
// package's `"./*"` wildcard export resolves to `dist/runtime/*`, and
60+
// break-check expands that surface with a single-segment `*`, so
61+
// content-hashed internal chunks sitting flat in `dist/runtime` get
62+
// enumerated as phantom public subpaths. Nesting them one level down keeps
63+
// them out of that API-snapshot expansion; package subpath imports are
64+
// blocked separately by the `./_chunks/*` null export.
65+
outputOptions: options => {
66+
const { chunkFileNames } = options;
67+
return {
68+
...options,
69+
chunkFileNames:
70+
typeof chunkFileNames === 'function'
71+
? info => `_chunks/${chunkFileNames(info)}`
72+
: `_chunks/${chunkFileNames ?? '[name]-[hash].js'}`,
73+
};
74+
},
5875
},
5976
];
6077
});

0 commit comments

Comments
 (0)