@@ -2,74 +2,89 @@ import { cp, glob } from "node:fs/promises";
22import { join , sep } from "node:path" ;
33import { defineConfig } from "tsdown" ;
44
5- export default defineConfig ( {
6- entry : [
7- "./mod.ts" ,
8- "./compat/mod.ts" ,
9- "./federation/mod.ts" ,
10- "./nodeinfo/mod.ts" ,
11- "./runtime/mod.ts" ,
12- "./sig/mod.ts" ,
13- "./testing/mod.ts" ,
14- "./vocab/mod.ts" ,
15- "./webfinger/mod.ts" ,
16- "./x/cfworkers.ts" ,
17- "./x/hono.ts" ,
18- "./x/sveltekit.ts" ,
19- ...( await Array . fromAsync ( glob ( `**/*.test.ts` ) ) )
20- . filter ( ( f ) =>
21- ! f . startsWith ( `codegen${ sep } ` ) && f !== `x${ sep } denokv.test.ts`
22- )
23- . map ( ( f ) => f . replace ( sep , "/" ) ) ,
24- ] ,
25- dts : true ,
26- unbundle : true ,
27- external : [ / ^ n o d e : / ] ,
28- inputOptions : {
29- onwarn ( warning , defaultHandler ) {
30- if (
31- warning . code === "UNRESOLVED_IMPORT" &&
32- warning . id ?. endsWith ( join ( "vocab" , "vocab.test.ts" ) ) &&
33- warning . exporter === "@std/testing/snapshot"
34- ) {
35- return ;
36- } else if (
37- warning . code === "UNRESOLVED_IMPORT" &&
38- warning . id ?. endsWith ( join ( "testing" , "mod.ts" ) ) &&
39- warning . exporter === "bun:test"
40- ) {
41- return ;
42- }
43- defaultHandler ( warning ) ;
5+ export default [
6+ defineConfig ( {
7+ entry : [
8+ "./mod.ts" ,
9+ "./compat/mod.ts" ,
10+ "./federation/mod.ts" ,
11+ "./nodeinfo/mod.ts" ,
12+ "./runtime/mod.ts" ,
13+ "./sig/mod.ts" ,
14+ "./vocab/mod.ts" ,
15+ "./webfinger/mod.ts" ,
16+ "./x/cfworkers.ts" ,
17+ "./x/hono.ts" ,
18+ "./x/sveltekit.ts" ,
19+ ] ,
20+ dts : true ,
21+ platform : "neutral" ,
22+ external : [ / ^ n o d e : / ] ,
23+ outputOptions : {
24+ intro : `
25+ import { Temporal } from "@js-temporal/polyfill";
26+ import { URLPattern } from "urlpattern-polyfill";
27+ ` ,
28+ } ,
29+ } ) ,
30+ defineConfig ( {
31+ entry : [
32+ "./testing/mod.ts" ,
33+ ...( await Array . fromAsync ( glob ( `**/*.test.ts` ) ) )
34+ . filter ( ( f ) =>
35+ ! f . startsWith ( `codegen${ sep } ` ) && f !== `x${ sep } denokv.test.ts`
36+ )
37+ . map ( ( f ) => f . replace ( sep , "/" ) ) ,
38+ ] ,
39+ dts : true ,
40+ external : [ / ^ n o d e : / ] ,
41+ inputOptions : {
42+ onwarn ( warning , defaultHandler ) {
43+ if (
44+ warning . code === "UNRESOLVED_IMPORT" &&
45+ warning . id ?. endsWith ( join ( "vocab" , "vocab.test.ts" ) ) &&
46+ warning . exporter === "@std/testing/snapshot"
47+ ) {
48+ return ;
49+ } else if (
50+ warning . code === "UNRESOLVED_IMPORT" &&
51+ warning . id ?. endsWith ( join ( "testing" , "mod.ts" ) ) &&
52+ warning . exporter === "bun:test"
53+ ) {
54+ return ;
55+ }
56+ defaultHandler ( warning ) ;
57+ } ,
4458 } ,
45- } ,
46- outputOptions : {
47- intro : `
59+ outputOptions : {
60+ intro : `
4861 import { Temporal } from "@js-temporal/polyfill";
4962 import { URLPattern } from "urlpattern-polyfill";
63+ globalThis.addEventListener = () => {};
5064 ` ,
51- } ,
52- hooks : {
53- "build:done" : async ( ctx ) => {
54- await cp (
55- join ( "testing" , "fixtures" ) ,
56- join ( ctx . options . outDir , "testing" , "fixtures" ) ,
57- { recursive : true } ,
58- ) ;
59- await cp (
60- join ( "codegen" , "schema.yaml" ) ,
61- join ( ctx . options . outDir , "codegen" , "schema.yaml" ) ,
62- { force : true } ,
63- ) ;
64- for await ( const file of glob ( `vocab/**/*.yaml` ) ) {
65+ } ,
66+ hooks : {
67+ "build:done" : async ( ctx ) => {
68+ await cp (
69+ join ( "testing" , "fixtures" ) ,
70+ join ( ctx . options . outDir , "fixtures" ) ,
71+ { recursive : true } ,
72+ ) ;
6573 await cp (
66- file ,
67- join ( ctx . options . outDir , file ) ,
74+ join ( "codegen" , "schema.yaml" ) ,
75+ join ( ctx . options . outDir , "vocab" , "schema.yaml" ) ,
6876 { force : true } ,
6977 ) ;
70- }
78+ for await ( const file of glob ( `vocab/**/*.yaml` ) ) {
79+ await cp (
80+ file ,
81+ join ( ctx . options . outDir , file ) ,
82+ { force : true } ,
83+ ) ;
84+ }
85+ } ,
7186 } ,
72- } ,
73- } ) ;
87+ } ) ,
88+ ] ;
7489
7590// cSpell: ignore unbundle
0 commit comments