babelfhir-ts 1.5.5 → 1.5.6
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.
|
@@ -125,47 +125,53 @@ function npmInstall(packagePath) {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
128
|
+
* Bust stale bun cache entries for a local-tarball dependency.
|
|
129
|
+
*
|
|
130
|
+
* Bun caches extracted tgz content keyed by file *path*, not content hash.
|
|
131
|
+
* Replacing a tgz at the same path silently serves stale content — even with
|
|
132
|
+
* `--force`. Two cache locations are relevant:
|
|
133
|
+
*
|
|
134
|
+
* 1. **node_modules/.bun/** (bun ≥ 1.1) — per-project extraction cache.
|
|
135
|
+
* 2. **node_modules/<packageName>/** — the already-installed copy. When we run
|
|
136
|
+
* `bun install` (bare, dep already in package.json) bun skips re-extraction
|
|
137
|
+
* if the directory already exists, regardless of whether the underlying tgz
|
|
138
|
+
* changed.
|
|
139
|
+
*
|
|
140
|
+
* We walk up the directory tree (monorepo-safe) to find both locations and
|
|
141
|
+
* remove matching entries so the next install re-extracts the fresh tarball.
|
|
142
|
+
*
|
|
143
|
+
* No-op when bun is not the package manager.
|
|
135
144
|
*/
|
|
136
145
|
function clearBunCache(packageName) {
|
|
137
146
|
const pm = detectPackageManager();
|
|
138
147
|
if (!pm.cmd.includes('bun'))
|
|
139
148
|
return;
|
|
140
|
-
// Walk up to find node_modules/.bun — in monorepos it's at the workspace root.
|
|
141
|
-
let bunCacheDir = null;
|
|
142
149
|
let dir = process.cwd();
|
|
143
150
|
while (true) {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
const nodeModules = path.join(dir, 'node_modules');
|
|
152
|
+
// (1) Remove .bun/<pkg>@… extraction cache (bun ≥ 1.1)
|
|
153
|
+
const bunCacheDir = path.join(nodeModules, '.bun');
|
|
154
|
+
if (fs.existsSync(bunCacheDir)) {
|
|
155
|
+
const prefix = `${packageName}@`;
|
|
156
|
+
for (const entry of fs.readdirSync(bunCacheDir, { withFileTypes: true })) {
|
|
157
|
+
if (entry.isDirectory() && entry.name.startsWith(prefix)) {
|
|
158
|
+
fs.rmSync(path.join(bunCacheDir, entry.name), { recursive: true, force: true });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// (2) Remove the already-installed node_modules/<pkg> directory.
|
|
163
|
+
// Without this, `bun install` (bare) sees the existing directory and
|
|
164
|
+
// skips re-extraction even though the tarball content has changed.
|
|
165
|
+
const installedDir = path.join(nodeModules, packageName);
|
|
166
|
+
if (fs.existsSync(installedDir)) {
|
|
167
|
+
fs.rmSync(installedDir, { recursive: true, force: true });
|
|
168
|
+
console.log(`Cleared stale node_modules/${packageName} for re-extraction`);
|
|
148
169
|
}
|
|
149
170
|
const parent = path.dirname(dir);
|
|
150
171
|
if (parent === dir)
|
|
151
172
|
break;
|
|
152
173
|
dir = parent;
|
|
153
174
|
}
|
|
154
|
-
if (!bunCacheDir)
|
|
155
|
-
return;
|
|
156
|
-
// Entries look like: <pkg>@<encoded-path>+<hash>
|
|
157
|
-
// The package name may contain dots/scopes — match by startsWith.
|
|
158
|
-
const prefix = `${packageName}@`;
|
|
159
|
-
let removed = 0;
|
|
160
|
-
for (const entry of fs.readdirSync(bunCacheDir, { withFileTypes: true })) {
|
|
161
|
-
if (entry.isDirectory() && entry.name.startsWith(prefix)) {
|
|
162
|
-
fs.rmSync(path.join(bunCacheDir, entry.name), { recursive: true, force: true });
|
|
163
|
-
removed++;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (removed > 0) {
|
|
167
|
-
console.log(`Cleared ${removed} stale bun cache entr${removed === 1 ? 'y' : 'ies'} for ${packageName}`);
|
|
168
|
-
}
|
|
169
175
|
}
|
|
170
176
|
export async function handleInstallCommand(opts) {
|
|
171
177
|
const { packageToInstall, registry, generationFlags, downloadPackage } = opts;
|
|
@@ -405,7 +405,9 @@ function clearBunCacheForPackage(packageName) {
|
|
|
405
405
|
return;
|
|
406
406
|
let dir = process.cwd();
|
|
407
407
|
while (true) {
|
|
408
|
-
const
|
|
408
|
+
const nm = path.join(dir, 'node_modules');
|
|
409
|
+
// Remove .bun/<pkg>@… extraction cache (bun ≥ 1.1)
|
|
410
|
+
const candidate = path.join(nm, '.bun');
|
|
409
411
|
if (fs.existsSync(candidate)) {
|
|
410
412
|
const prefix = `${packageName}@`;
|
|
411
413
|
for (const entry of fs.readdirSync(candidate, { withFileTypes: true })) {
|
|
@@ -413,7 +415,11 @@ function clearBunCacheForPackage(packageName) {
|
|
|
413
415
|
fs.rmSync(path.join(candidate, entry.name), { recursive: true, force: true });
|
|
414
416
|
}
|
|
415
417
|
}
|
|
416
|
-
|
|
418
|
+
}
|
|
419
|
+
// Remove the installed node_modules/<pkg> directory so bun re-extracts
|
|
420
|
+
const installedDir = path.join(nm, packageName);
|
|
421
|
+
if (fs.existsSync(installedDir)) {
|
|
422
|
+
fs.rmSync(installedDir, { recursive: true, force: true });
|
|
417
423
|
}
|
|
418
424
|
const parent = path.dirname(dir);
|
|
419
425
|
if (parent === dir)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babelfhir-ts",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "BabelFHIR-TS: generate TypeScript interfaces, validators, and helper classes from FHIR R4/R4B/R5 StructureDefinitions (profiles) directly inside package archives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/src/main.js",
|