@mandujs/core 0.9.43 → 0.9.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bundler/css.ts +26 -7
- package/src/runtime/server.ts +11 -1
- package/src/runtime/ssr.ts +6 -4
- package/src/runtime/streaming-ssr.ts +6 -4
package/package.json
CHANGED
package/src/bundler/css.ts
CHANGED
|
@@ -176,8 +176,15 @@ export async function startCSSWatch(options: CSSBuildOptions): Promise<CSSWatche
|
|
|
176
176
|
const inputPath = path.join(rootDir, input);
|
|
177
177
|
const outputPath = path.join(rootDir, output);
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
try {
|
|
180
|
+
// 출력 디렉토리 생성
|
|
181
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
182
|
+
} catch (error) {
|
|
183
|
+
const err = new Error(`CSS 출력 디렉토리 생성 실패: ${error instanceof Error ? error.message : error}`);
|
|
184
|
+
console.error(`❌ ${err.message}`);
|
|
185
|
+
onError?.(err);
|
|
186
|
+
throw err;
|
|
187
|
+
}
|
|
181
188
|
|
|
182
189
|
// Tailwind CLI 인자 구성
|
|
183
190
|
const args = [
|
|
@@ -196,11 +203,23 @@ export async function startCSSWatch(options: CSSBuildOptions): Promise<CSSWatche
|
|
|
196
203
|
console.log(` 출력: ${output}`);
|
|
197
204
|
|
|
198
205
|
// Bun subprocess로 Tailwind CLI 실행
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
206
|
+
let proc;
|
|
207
|
+
try {
|
|
208
|
+
proc = spawn(["bunx", ...args], {
|
|
209
|
+
cwd: rootDir,
|
|
210
|
+
stdout: "pipe",
|
|
211
|
+
stderr: "pipe",
|
|
212
|
+
});
|
|
213
|
+
} catch (error) {
|
|
214
|
+
const err = new Error(
|
|
215
|
+
`Tailwind CLI 실행 실패. @tailwindcss/cli가 설치되어 있는지 확인하세요.\n` +
|
|
216
|
+
`설치: bun add -d @tailwindcss/cli tailwindcss\n` +
|
|
217
|
+
`원인: ${error instanceof Error ? error.message : error}`
|
|
218
|
+
);
|
|
219
|
+
console.error(`❌ ${err.message}`);
|
|
220
|
+
onError?.(err);
|
|
221
|
+
throw err;
|
|
222
|
+
}
|
|
204
223
|
|
|
205
224
|
// stdout 모니터링 (빌드 완료 감지)
|
|
206
225
|
(async () => {
|
package/src/runtime/server.ts
CHANGED
|
@@ -949,10 +949,20 @@ export function startServer(manifest: RoutesManifest, options: ServerOptions = {
|
|
|
949
949
|
publicDir = "public",
|
|
950
950
|
cors = false,
|
|
951
951
|
streaming = false,
|
|
952
|
-
cssPath,
|
|
952
|
+
cssPath: cssPathOption,
|
|
953
953
|
registry = defaultRegistry,
|
|
954
954
|
} = options;
|
|
955
955
|
|
|
956
|
+
// cssPath 처리:
|
|
957
|
+
// - string: 해당 경로로 <link> 주입
|
|
958
|
+
// - false: CSS 링크 주입 비활성화
|
|
959
|
+
// - undefined: false로 처리 (기본적으로 링크 미삽입 - 404 방지)
|
|
960
|
+
//
|
|
961
|
+
// dev/build에서 Tailwind 감지 시 명시적으로 cssPath 전달 필요:
|
|
962
|
+
// - dev.ts: cssPath: hasTailwind ? cssWatcher?.serverPath : false
|
|
963
|
+
// - 프로덕션: 빌드 후 .mandu/client/globals.css 존재 시 경로 전달
|
|
964
|
+
const cssPath: string | false = cssPathOption ?? false;
|
|
965
|
+
|
|
956
966
|
// CORS 옵션 파싱
|
|
957
967
|
const corsOptions: CorsOptions | false = cors === true ? {} : cors;
|
|
958
968
|
|
package/src/runtime/ssr.ts
CHANGED
|
@@ -156,10 +156,12 @@ export function renderToHTML(element: ReactElement, options: SSROptions = {}): s
|
|
|
156
156
|
cssPath,
|
|
157
157
|
} = options;
|
|
158
158
|
|
|
159
|
-
// CSS 링크 태그 생성
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
// CSS 링크 태그 생성
|
|
160
|
+
// - cssPath가 string이면 해당 경로 사용
|
|
161
|
+
// - cssPath가 false 또는 undefined이면 링크 미삽입 (404 방지)
|
|
162
|
+
const cssLinkTag = cssPath && cssPath !== false
|
|
163
|
+
? `<link rel="stylesheet" href="${cssPath}${isDev ? `?t=${Date.now()}` : ""}">`
|
|
164
|
+
: "";
|
|
163
165
|
|
|
164
166
|
let content = renderToString(element);
|
|
165
167
|
|
|
@@ -373,10 +373,12 @@ function generateHTMLShell(options: StreamingSSROptions): string {
|
|
|
373
373
|
isDev = false,
|
|
374
374
|
} = options;
|
|
375
375
|
|
|
376
|
-
// CSS 링크 태그 생성
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
376
|
+
// CSS 링크 태그 생성
|
|
377
|
+
// - cssPath가 string이면 해당 경로 사용
|
|
378
|
+
// - cssPath가 false 또는 undefined이면 링크 미삽입 (404 방지)
|
|
379
|
+
const cssLinkTag = cssPath && cssPath !== false
|
|
380
|
+
? `<link rel="stylesheet" href="${cssPath}${isDev ? `?t=${Date.now()}` : ""}">`
|
|
381
|
+
: "";
|
|
380
382
|
|
|
381
383
|
// Import map (module scripts 전에 위치해야 함)
|
|
382
384
|
let importMapScript = "";
|