mirror of
https://github.com/IliesAllali/parenthese.git
synced 2026-11-08 23:42:42 +00:00
Galaxie familiale : personnes, unions et filiations, photos, vidéos et voix sur chaque personne, partage par lien avec consultation sans compte et contributions validées par le propriétaire. Auto-hébergeable avec Docker. Licence PolyForm Noncommercial 1.0.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
15 lines
649 B
JavaScript
15 lines
649 B
JavaScript
// Resolver : imports relatifs sans extension (style Vite) → .js / .jsx / index.js
|
|
import { existsSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
export async function resolve(specifier, context, nextResolve) {
|
|
if ((specifier.startsWith('./') || specifier.startsWith('../')) && !/\.[a-z]+$/i.test(specifier) && context.parentURL) {
|
|
const base = new URL(specifier, context.parentURL)
|
|
for (const ext of ['.js', '.mjs', '.jsx', '/index.js']) {
|
|
const candidate = base.href + ext
|
|
if (existsSync(fileURLToPath(candidate))) return nextResolve(candidate, context)
|
|
}
|
|
}
|
|
return nextResolve(specifier, context)
|
|
}
|