File tree Expand file tree Collapse file tree 5 files changed +40
-8
lines changed
Expand file tree Collapse file tree 5 files changed +40
-8
lines changed Original file line number Diff line number Diff line change 4949 "generate" : " bun scripts/generate-preview.ts" ,
5050 "prebuild" : " bun scripts/build-inline.js" ,
5151 "build" : " tsc" ,
52+ "test:esm" : " node test-esm.mjs" ,
5253 "prepublishOnly" : " bun run build"
5354 },
5455 "type" : " module" ,
Original file line number Diff line number Diff line change 1- import { RouteInfo } from './collect-routes' ;
2- import { DocsGeneratorOptions , RouteMeta } from './types' ;
3- import { getStyles , getScripts , getLogo } from './assets-inline' ;
1+ import { RouteInfo } from './collect-routes.js ' ;
2+ import { DocsGeneratorOptions , RouteMeta } from './types.js ' ;
3+ import { getStyles , getScripts , getLogo } from './assets-inline.js ' ;
44
55/**
66 * Generate beautiful HTML documentation from route information
Original file line number Diff line number Diff line change 77 * @packageDocumentation
88 */
99
10- export { collectRoutes , type RouteInfo } from './collect-routes' ;
11- export { generateDocsHtml } from './generate-html' ;
12- export { type RouteMeta , type DocsGeneratorOptions } from './types' ;
10+ export { collectRoutes , type RouteInfo } from './collect-routes.js ' ;
11+ export { generateDocsHtml } from './generate-html.js ' ;
12+ export { type RouteMeta , type DocsGeneratorOptions } from './types.js ' ;
Original file line number Diff line number Diff line change 1+ /**
2+ * ESM Smoke Test - Verifies Node.js native ESM compatibility
3+ * This should run without ERR_MODULE_NOT_FOUND errors
4+ */
5+
6+ console . log ( 'Testing ESM imports...' ) ;
7+
8+ try {
9+ // Test direct imports work without crashes
10+ const { collectRoutes, generateDocsHtml } = await import ( './dist/index.js' ) ;
11+
12+ console . log ( '✅ Successfully imported collectRoutes:' , typeof collectRoutes ) ;
13+ console . log ( '✅ Successfully imported generateDocsHtml:' , typeof generateDocsHtml ) ;
14+
15+ // Verify they are the expected types
16+ if ( typeof collectRoutes !== 'function' ) {
17+ throw new Error ( 'collectRoutes should be a function' ) ;
18+ }
19+ if ( typeof generateDocsHtml !== 'function' ) {
20+ throw new Error ( 'generateDocsHtml should be a function' ) ;
21+ }
22+
23+ console . log ( '\n✅ ESM compatibility test PASSED' ) ;
24+ console . log ( 'All imports resolved correctly with .js extensions' ) ;
25+ process . exit ( 0 ) ;
26+ } catch ( error ) {
27+ console . error ( '\n❌ ESM compatibility test FAILED' ) ;
28+ console . error ( 'Error:' , error . message ) ;
29+ console . error ( '\nStack:' , error . stack ) ;
30+ process . exit ( 1 ) ;
31+ }
Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
33 "target" : " ES2022" ,
4- "module" : " ES2022 " ,
4+ "module" : " Node16 " ,
55 "lib" : [" ES2022" ],
6- "moduleResolution" : " bundler " ,
6+ "moduleResolution" : " node16 " ,
77 "declaration" : true ,
88 "declarationMap" : true ,
99 "outDir" : " ./dist" ,
You can’t perform that action at this time.
0 commit comments