@@ -272,6 +272,40 @@ model User {
272272 expect ( fs . existsSync ( path . join ( workDir , 'zenstack/schema.ts' ) ) ) . toBe ( true ) ;
273273 } ) ;
274274
275+ it ( 'should load plugin from a bare package specifier via jiti' , async ( ) => {
276+ const modelWithBarePlugin = `
277+ plugin foo {
278+ provider = 'my-test-plugin'
279+ }
280+
281+ model User {
282+ id String @id @default(cuid())
283+ }
284+ ` ;
285+ const { workDir } = await createProject ( modelWithBarePlugin ) ;
286+ // Create a fake node_modules package with a TS entry point
287+ // This can only be resolved by jiti, not by native import() or fs.existsSync checks
288+ const pkgDir = path . join ( workDir , 'node_modules/my-test-plugin' ) ;
289+ fs . mkdirSync ( pkgDir , { recursive : true } ) ;
290+ fs . writeFileSync (
291+ path . join ( pkgDir , 'package.json' ) ,
292+ JSON . stringify ( { name : 'my-test-plugin' , main : './index.ts' } ) ,
293+ ) ;
294+ fs . writeFileSync (
295+ path . join ( pkgDir , 'index.ts' ) ,
296+ `
297+ const plugin = {
298+ name: 'test-bare-plugin',
299+ statusText: 'Testing bare plugin',
300+ async generate() {},
301+ };
302+ export default plugin;
303+ ` ,
304+ ) ;
305+ runCli ( 'generate' , workDir ) ;
306+ expect ( fs . existsSync ( path . join ( workDir , 'zenstack/schema.ts' ) ) ) . toBe ( true ) ;
307+ } ) ;
308+
275309 it ( 'should prefer CLI options over @core/typescript plugin settings for generateModels and generateInput' , async ( ) => {
276310 const modelWithPlugin = `
277311plugin typescript {
0 commit comments