Skip to content

Commit 0d24ede

Browse files
committed
chore: migrate to tsdown
1 parent 59cdc94 commit 0d24ede

File tree

8 files changed

+167
-138
lines changed

8 files changed

+167
-138
lines changed
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Slot, component$, useSignal } from "@builder.io/qwik";
2-
import { type RenderOptions } from "@builder.io/qwik/server";
2+
import type { RenderOptions } from "@builder.io/qwik/server";
33

4-
export const Counter = component$<{ initial: number; renderOpts?: RenderOptions }>((props) => {
5-
const counter = useSignal(props.initial);
4+
export const Counter = component$<{ initial: number; renderOpts?: RenderOptions }>(
5+
(props) => {
6+
const counter = useSignal(props.initial);
67

7-
return (
8-
<button type="button" onClick$={() => counter.value++}>
9-
<Slot /> {counter.value}
10-
</button>
11-
);
12-
});
8+
return (
9+
<button type="button" onClick$={() => counter.value++}>
10+
<Slot /> {counter.value}
11+
</button>
12+
);
13+
}
14+
);

libs/create-qwikdev-astro/package.json

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,59 +34,84 @@
3434
"url": "https://github.com/QwikDev/astro",
3535
"directory": "libs/create-qwikdev-astro"
3636
},
37-
"types": "./dist/index.d.ts",
38-
"main": "./dist/index.js",
39-
"module": "./dist/index.js",
37+
"types": "./dist/index.d.mts",
38+
"main": "./dist/index.mjs",
39+
"module": "./dist/index.mjs",
4040
"exports": {
4141
".": {
42-
"types": "./dist/index.d.ts",
43-
"import": "./dist/index.js",
44-
"require": "./dist/index.cjs",
45-
"default": "./dist/index.js"
42+
"import": {
43+
"types": "./dist/index.d.mts",
44+
"default": "./dist/index.mjs"
45+
},
46+
"require": {
47+
"types": "./dist/index.d.cts",
48+
"default": "./dist/index.cjs"
49+
}
4650
},
4751
"./app": {
48-
"types": "./dist/app.d.ts",
49-
"import": "./dist/app.js",
50-
"require": "./dist/app.cjs",
51-
"default": "./dist/app.js"
52+
"import": {
53+
"types": "./dist/app.d.mts",
54+
"default": "./dist/app.mjs"
55+
},
56+
"require": {
57+
"types": "./dist/app.d.cts",
58+
"default": "./dist/app.cjs"
59+
}
5260
},
5361
"./cli": {
54-
"types": "./dist/cli.d.ts",
55-
"import": "./dist/cli.js",
56-
"require": "./dist/cli.cjs",
57-
"default": "./dist/cli.js"
62+
"import": {
63+
"types": "./dist/cli.d.mts",
64+
"default": "./dist/cli.mjs"
65+
},
66+
"require": {
67+
"types": "./dist/cli.d.cts",
68+
"default": "./dist/cli.cjs"
69+
}
5870
},
5971
"./console": {
60-
"types": "./dist/console.d.ts",
61-
"import": "./dist/console.js",
62-
"require": "./dist/console.cjs",
63-
"default": "./dist/console.js"
72+
"import": {
73+
"types": "./dist/console.d.mts",
74+
"default": "./dist/console.mjs"
75+
},
76+
"require": {
77+
"types": "./dist/console.d.cts",
78+
"default": "./dist/console.cjs"
79+
}
6480
},
6581
"./core": {
66-
"types": "./dist/core.d.ts",
67-
"import": "./dist/core.js",
68-
"require": "./dist/core.cjs",
69-
"default": "./dist/core.js"
82+
"import": {
83+
"types": "./dist/core.d.mts",
84+
"default": "./dist/core.mjs"
85+
},
86+
"require": {
87+
"types": "./dist/core.d.cts",
88+
"default": "./dist/core.cjs"
89+
}
7090
},
7191
"./tester": {
72-
"types": "./dist/tester.d.ts",
73-
"import": "./dist/tester.js",
74-
"require": "./dist/tester.cjs",
75-
"default": "./dist/tester.js"
92+
"import": {
93+
"types": "./dist/tester.d.mts",
94+
"default": "./dist/tester.mjs"
95+
},
96+
"require": {
97+
"types": "./dist/tester.d.cts",
98+
"default": "./dist/tester.cjs"
99+
}
76100
},
77101
"./utils": {
78-
"types": "./dist/utils.d.ts",
79-
"import": "./dist/utils.js",
80-
"require": "./dist/utils.cjs",
81-
"default": "./dist/utils.js"
102+
"import": {
103+
"types": "./dist/utils.d.mts",
104+
"default": "./dist/utils.mjs"
105+
},
106+
"require": {
107+
"types": "./dist/utils.d.cts",
108+
"default": "./dist/utils.cjs"
109+
}
82110
},
83111
"./package.json": "./package.json"
84112
},
85-
"files": [
86-
"dist",
87-
"stubs"
88-
],
89-
"bin": "./dist/cli.js",
113+
"files": ["dist", "stubs"],
114+
"bin": "./dist/cli.mjs",
90115
"keywords": [
91116
"astro-integration",
92117
"astro-component",
@@ -131,6 +156,7 @@
131156
"@types/which-pm-runs": "^1.0.2",
132157
"@types/yargs": "^17.0.33",
133158
"rimraf": "^6.0.1",
159+
"tsdown": "^0.20.1",
134160
"typescript": "^5.8.3"
135161
}
136162
}

libs/create-qwikdev-astro/tsdown.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ export default defineConfig((options) => {
55
format: ["esm", "cjs"],
66
clean: true,
77
minify: !options.watch,
8-
dts: true,
8+
dts: {
9+
hashFilename: false
10+
},
11+
hashFilename: false,
912
entry: [
1013
"src/app.ts",
1114
"src/cli.ts",

libs/qwikdev-astro/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@
4040
"./utils": "./src/utils.ts",
4141
"./q-astro-manifest.json": "./q-astro-manifest.json"
4242
},
43-
"files": [
44-
"src",
45-
"src/index.ts",
46-
"server.ts",
47-
"env.d.ts"
48-
],
43+
"files": ["src", "src/index.ts", "server.ts", "env.d.ts"],
4944
"keywords": [
5045
"astro-integration",
5146
"astro-component",

libs/qwikdev-astro/server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { renderOpts as globalRenderOpts } from "virtual:qwikdev-astro";
12
import { type JSXNode, jsx } from "@builder.io/qwik";
23
import { isDev } from "@builder.io/qwik/build";
34
import type { QwikManifest } from "@builder.io/qwik/optimizer";
45
import { type RenderToStreamOptions, renderToStream } from "@builder.io/qwik/server";
56
import type { SSRResult } from "astro";
6-
import { renderOpts as globalRenderOpts } from "virtual:qwikdev-astro";
77

88
const containerMap = new WeakMap<SSRResult, boolean>();
99

@@ -62,7 +62,6 @@ export async function renderToStaticMarkup(
6262
props: Record<string, unknown>,
6363
slotted: any
6464
) {
65-
6665
try {
6766
if (!isQwikComponent(component)) {
6867
return;
@@ -93,7 +92,7 @@ export async function renderToStaticMarkup(
9392
write: (chunk) => {
9493
html += chunk;
9594
}
96-
},
95+
}
9796
};
9897

9998
// https://qwik.dev/docs/components/overview/#inline-components

libs/qwikdev-astro/src/index.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,29 @@ import type {
77
SymbolMapperFn
88
} from "@builder.io/qwik/optimizer";
99
import type { RenderOptions } from "@builder.io/qwik/server";
10+
import aikMod from "@inox-tools/aik-mod";
1011
import type { AstroConfig, AstroIntegration } from "astro";
11-
import { createResolver, defineIntegration, watchDirectory, withPlugins } from "astro-integration-kit";
12+
import {
13+
createResolver,
14+
defineIntegration,
15+
watchDirectory,
16+
withPlugins
17+
} from "astro-integration-kit";
1218
import { z } from "astro/zod";
1319
import { type PluginOption, build, createFilter } from "vite";
1420
import type { InlineConfig } from "vite";
15-
import aikMod from '@inox-tools/aik-mod';
1621

1722
// TODO: contributing this back to aik-mod where we export the type
1823
type DefineModuleOptions = {
1924
constExports?: Record<string, unknown>;
2025
defaultExport?: unknown;
2126
};
2227

23-
type SetupPropsWithAikMod =
24-
Parameters<
25-
NonNullable<AstroIntegration["hooks"]["astro:config:setup"]>
26-
>[0] & {
27-
defineModule: (
28-
name: string,
29-
options: DefineModuleOptions
30-
) => string;
31-
};
28+
type SetupPropsWithAikMod = Parameters<
29+
NonNullable<AstroIntegration["hooks"]["astro:config:setup"]>
30+
>[0] & {
31+
defineModule: (name: string, options: DefineModuleOptions) => string;
32+
};
3233

3334
declare global {
3435
var symbolMapperFn: SymbolMapperFn;
@@ -69,11 +70,13 @@ export default defineIntegration({
6970
*/
7071
debug: z.boolean().optional(),
7172
/**
72-
* Options passed into each Qwik component's `renderToStream` call.
73+
* Options passed into each Qwik component's `renderToStream` call.
7374
*/
74-
renderOpts: z.custom<RenderOptions>((data) => {
75-
return typeof data === "object" && data !== null;
76-
}).optional()
75+
renderOpts: z
76+
.custom<RenderOptions>((data) => {
77+
return typeof data === "object" && data !== null;
78+
})
79+
.optional()
7780
})
7881
.optional(),
7982

@@ -98,7 +101,8 @@ export default defineIntegration({
98101

99102
const lifecycleHooks: AstroIntegration["hooks"] = {
100103
"astro:config:setup": async (setupProps) => {
101-
const { addRenderer, updateConfig, config, defineModule } = setupProps as SetupPropsWithAikMod;
104+
const { addRenderer, updateConfig, config, defineModule } =
105+
setupProps as SetupPropsWithAikMod;
102106
astroConfig = config;
103107
// integration HMR support
104108
watchDirectory(setupProps, resolver());
@@ -107,7 +111,7 @@ export default defineIntegration({
107111
serverEntrypoint: resolver("../server.ts")
108112
});
109113

110-
defineModule('virtual:qwikdev-astro', {
114+
defineModule("virtual:qwikdev-astro", {
111115
constExports: {
112116
renderOpts: options?.renderOpts ?? {}
113117
}
@@ -356,4 +360,4 @@ export default defineIntegration({
356360

357361
function getRelativePath(from: string, to: string) {
358362
return to.replace(from, "") || ".";
359-
}
363+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module "virtual:qwikdev-astro" {
22
import type { RenderOptions } from "@builder.io/qwik/server";
3-
3+
44
const renderOpts: RenderOptions;
55
export { renderOpts };
66
}

0 commit comments

Comments
 (0)