fix: imports ESM avec extensions .js — NodeNext compatible Render — 117/117 tests

This commit is contained in:
Hermann_Kitio 2026-04-17 01:04:16 +03:00
parent dd2dfaa662
commit f08be960b0
13 changed files with 44 additions and 43 deletions

View file

@ -1,7 +1,8 @@
{ {
"permissions": { "permissions": {
"allow": [ "allow": [
"Bash(npm run:*)" "Bash(npm run:*)",
"Bash(SUPABASE_URL=https://dummy.supabase.co SUPABASE_SERVICE_ROLE_KEY=dummy node -e \"import\\('./dist/index.js'\\).then\\(\\(\\) => { console.log\\('IMPORT_OK'\\); process.exit\\(0\\); }\\).catch\\(e => { console.error\\('IMPORT_FAIL:', e.message\\); process.exit\\(1\\); }\\)\")"
] ]
} }
} }

View file

@ -1,7 +1,7 @@
import { supabase } from '../lib/supabase' import { supabase } from '../lib/supabase.js'
import { correctEE as deepseekCorrectEE, correctEO as deepseekCorrectEO } from '../lib/deepseek' import { correctEE as deepseekCorrectEE, correctEO as deepseekCorrectEO } from '../lib/deepseek.js'
import type { EERapport, EORapport } from '../lib/deepseek' import type { EERapport, EORapport } from '../lib/deepseek.js'
import type { AuthProfile } from '../middleware/auth' import type { AuthProfile } from '../middleware/auth.js'
type CorrectionError = { type CorrectionError = {
error: true error: true

View file

@ -1,7 +1,7 @@
import { supabase } from '../lib/supabase' import { supabase } from '../lib/supabase.js'
import { canUserSimulate, getPlanPermissions } from '../lib/access' import { canUserSimulate, getPlanPermissions } from '../lib/access.js'
import type { Plan } from '../lib/access' import type { Plan } from '../lib/access.js'
import type { AuthProfile } from '../middleware/auth' import type { AuthProfile } from '../middleware/auth.js'
export type Tache = 'EE_T1' | 'EE_T2' | 'EE_T3' | 'EO_T1' | 'EO_T3' | 'EO_T2_LIVE' export type Tache = 'EE_T1' | 'EE_T2' | 'EE_T3' | 'EO_T1' | 'EO_T3' | 'EO_T2_LIVE'
export type Mode = 'entrainement' | 'examen' export type Mode = 'entrainement' | 'examen'

View file

@ -1,11 +1,11 @@
import 'dotenv/config' import 'dotenv/config'
import { Hono } from 'hono' import { Hono } from 'hono'
import { serve } from '@hono/node-server' import { serve } from '@hono/node-server'
import authRoutes from './routes/auth' import authRoutes from './routes/auth.js'
import plansRoutes from './routes/plans' import plansRoutes from './routes/plans.js'
import simulationsRoutes from './routes/simulations' import simulationsRoutes from './routes/simulations.js'
import correctionsRoutes from './routes/corrections' import correctionsRoutes from './routes/corrections.js'
import stripeRoutes from './routes/stripe' import stripeRoutes from './routes/stripe.js'
const app = new Hono() const app = new Hono()

View file

@ -1,6 +1,6 @@
import { supabase } from './supabase' import { supabase } from './supabase.js'
import { PLANS } from './access' import { PLANS } from './access.js'
import type { Plan } from './access' import type { Plan } from './access.js'
export async function updateUserPlan( export async function updateUserPlan(
userId: string, userId: string,

View file

@ -1,5 +1,5 @@
import type { Context, Next } from 'hono' import type { Context, Next } from 'hono'
import { supabase } from '../lib/supabase' import { supabase } from '../lib/supabase.js'
export type AuthUser = { export type AuthUser = {
id: string id: string

View file

@ -1,7 +1,7 @@
import type { Context, Next } from 'hono' import type { Context, Next } from 'hono'
import { checkFeatureAccess, getPlanPermissions } from '../lib/access' import { checkFeatureAccess, getPlanPermissions } from '../lib/access.js'
import type { Feature, Plan } from '../lib/access' import type { Feature, Plan } from '../lib/access.js'
import type { AppVariables } from './auth' import type { AppVariables } from './auth.js'
/** /**
* Vérifie que le profil de l'utilisateur (posé par authMiddleware) * Vérifie que le profil de l'utilisateur (posé par authMiddleware)

View file

@ -1,6 +1,6 @@
import { Hono } from 'hono' import { Hono } from 'hono'
import { authMiddleware } from '../middleware/auth' import { authMiddleware } from '../middleware/auth.js'
import type { AppVariables } from '../middleware/auth' import type { AppVariables } from '../middleware/auth.js'
const auth = new Hono<{ Variables: AppVariables }>() const auth = new Hono<{ Variables: AppVariables }>()

View file

@ -1,7 +1,7 @@
import { Hono } from 'hono' import { Hono } from 'hono'
import { authMiddleware } from '../middleware/auth' import { authMiddleware } from '../middleware/auth.js'
import type { AppVariables } from '../middleware/auth' import type { AppVariables } from '../middleware/auth.js'
import * as correctionController from '../controllers/correctionController' import * as correctionController from '../controllers/correctionController.js'
const VALID_TACHES_EE = ['EE_T1', 'EE_T2', 'EE_T3'] const VALID_TACHES_EE = ['EE_T1', 'EE_T2', 'EE_T3']
const VALID_TACHES_EO = ['EO_T1', 'EO_T3'] const VALID_TACHES_EO = ['EO_T1', 'EO_T3']

View file

@ -1,8 +1,8 @@
import { Hono } from 'hono' import { Hono } from 'hono'
import Stripe from 'stripe' import Stripe from 'stripe'
import { authMiddleware } from '../middleware/auth' import { authMiddleware } from '../middleware/auth.js'
import type { AppVariables } from '../middleware/auth' import type { AppVariables } from '../middleware/auth.js'
import { getPlanPermissions, PLANS } from '../lib/access' import { getPlanPermissions, PLANS } from '../lib/access.js'
const plans = new Hono<{ Variables: AppVariables }>() const plans = new Hono<{ Variables: AppVariables }>()

View file

@ -1,10 +1,10 @@
import { Hono } from 'hono' import { Hono } from 'hono'
import { authMiddleware } from '../middleware/auth' import { authMiddleware } from '../middleware/auth.js'
import type { AppVariables } from '../middleware/auth' import type { AppVariables } from '../middleware/auth.js'
import { getPlanPermissions } from '../lib/access' import { getPlanPermissions } from '../lib/access.js'
import type { Plan } from '../lib/access' import type { Plan } from '../lib/access.js'
import * as simulationController from '../controllers/simulationController' import * as simulationController from '../controllers/simulationController.js'
import type { Tache, Mode } from '../controllers/simulationController' import type { Tache, Mode } from '../controllers/simulationController.js'
const VALID_TACHES: Tache[] = ['EE_T1', 'EE_T2', 'EE_T3', 'EO_T1', 'EO_T3', 'EO_T2_LIVE'] const VALID_TACHES: Tache[] = ['EE_T1', 'EE_T2', 'EE_T3', 'EO_T1', 'EO_T3', 'EO_T2_LIVE']
const VALID_MODES: Mode[] = ['entrainement', 'examen'] const VALID_MODES: Mode[] = ['entrainement', 'examen']

View file

@ -1,15 +1,15 @@
import { Hono } from 'hono' import { Hono } from 'hono'
import type Stripe from 'stripe' import type Stripe from 'stripe'
import { authMiddleware } from '../middleware/auth' import { authMiddleware } from '../middleware/auth.js'
import type { AppVariables } from '../middleware/auth' import type { AppVariables } from '../middleware/auth.js'
import { createCheckoutSession, verifyStripeWebhook } from '../lib/stripe' import { createCheckoutSession, verifyStripeWebhook } from '../lib/stripe.js'
import { import {
updateUserPlan, updateUserPlan,
updateUserStripeInfo, updateUserStripeInfo,
findUserBySubscriptionId, findUserBySubscriptionId,
} from '../lib/planController' } from '../lib/planController.js'
import type { Plan } from '../lib/access' import type { Plan } from '../lib/access.js'
import { PLANS } from '../lib/access' import { PLANS } from '../lib/access.js'
const stripeRoutes = new Hono<{ Variables: AppVariables }>() const stripeRoutes = new Hono<{ Variables: AppVariables }>()

View file

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"module": "ESNext", "module": "NodeNext",
"moduleResolution": "Bundler", "moduleResolution": "NodeNext",
"lib": ["ES2022"], "lib": ["ES2022"],
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",