@mandujs/core 0.7.0 → 0.7.2
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/build.ts +131 -18
- package/src/filling/context.ts +438 -464
- package/src/filling/filling.ts +220 -552
- package/src/filling/tmpclaude-2f8d-cwd +1 -0
- package/src/filling/tmpclaude-fb5a-cwd +1 -0
package/package.json
CHANGED
package/src/bundler/build.ts
CHANGED
|
@@ -55,8 +55,12 @@ function generateRuntimeSource(): string {
|
|
|
55
55
|
* Mandu Hydration Runtime (Generated)
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// 글로벌 레지스트리 사용 (Island 번들과 공유)
|
|
59
|
+
window.__MANDU_ISLANDS__ = window.__MANDU_ISLANDS__ || new Map();
|
|
60
|
+
window.__MANDU_ROOTS__ = window.__MANDU_ROOTS__ || new Map();
|
|
61
|
+
|
|
62
|
+
const islandRegistry = window.__MANDU_ISLANDS__;
|
|
63
|
+
const hydratedRoots = window.__MANDU_ROOTS__;
|
|
60
64
|
|
|
61
65
|
// 서버 데이터
|
|
62
66
|
const serverData = window.__MANDU_DATA__ || {};
|
|
@@ -65,7 +69,7 @@ const serverData = window.__MANDU_DATA__ || {};
|
|
|
65
69
|
* Island 등록
|
|
66
70
|
*/
|
|
67
71
|
export function registerIsland(id, loader) {
|
|
68
|
-
|
|
72
|
+
window.__MANDU_ISLANDS__.set(id, loader);
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/**
|
|
@@ -208,6 +212,7 @@ export { islandRegistry, hydratedRoots };
|
|
|
208
212
|
|
|
209
213
|
/**
|
|
210
214
|
* React shim 소스 생성 (import map용)
|
|
215
|
+
* 주의: export *는 Bun bundler에서 제대로 작동하지 않으므로 명시적 export 필요
|
|
211
216
|
*/
|
|
212
217
|
function generateReactShimSource(): string {
|
|
213
218
|
return `
|
|
@@ -215,42 +220,139 @@ function generateReactShimSource(): string {
|
|
|
215
220
|
* Mandu React Shim (Generated)
|
|
216
221
|
* import map을 통해 bare specifier 해결
|
|
217
222
|
*/
|
|
218
|
-
import
|
|
219
|
-
|
|
223
|
+
import React, {
|
|
224
|
+
// Core
|
|
225
|
+
createElement,
|
|
226
|
+
cloneElement,
|
|
227
|
+
createContext,
|
|
228
|
+
createRef,
|
|
229
|
+
forwardRef,
|
|
230
|
+
isValidElement,
|
|
231
|
+
memo,
|
|
232
|
+
lazy,
|
|
233
|
+
// Hooks
|
|
234
|
+
useState,
|
|
235
|
+
useEffect,
|
|
236
|
+
useContext,
|
|
237
|
+
useReducer,
|
|
238
|
+
useCallback,
|
|
239
|
+
useMemo,
|
|
240
|
+
useRef,
|
|
241
|
+
useLayoutEffect,
|
|
242
|
+
useImperativeHandle,
|
|
243
|
+
useDebugValue,
|
|
244
|
+
useDeferredValue,
|
|
245
|
+
useTransition,
|
|
246
|
+
useId,
|
|
247
|
+
useSyncExternalStore,
|
|
248
|
+
useInsertionEffect,
|
|
249
|
+
// Components
|
|
250
|
+
Fragment,
|
|
251
|
+
Suspense,
|
|
252
|
+
StrictMode,
|
|
253
|
+
Profiler,
|
|
254
|
+
// Types
|
|
255
|
+
Component,
|
|
256
|
+
PureComponent,
|
|
257
|
+
Children,
|
|
258
|
+
} from 'react';
|
|
259
|
+
|
|
260
|
+
// Named exports
|
|
261
|
+
export {
|
|
262
|
+
createElement,
|
|
263
|
+
cloneElement,
|
|
264
|
+
createContext,
|
|
265
|
+
createRef,
|
|
266
|
+
forwardRef,
|
|
267
|
+
isValidElement,
|
|
268
|
+
memo,
|
|
269
|
+
lazy,
|
|
270
|
+
useState,
|
|
271
|
+
useEffect,
|
|
272
|
+
useContext,
|
|
273
|
+
useReducer,
|
|
274
|
+
useCallback,
|
|
275
|
+
useMemo,
|
|
276
|
+
useRef,
|
|
277
|
+
useLayoutEffect,
|
|
278
|
+
useImperativeHandle,
|
|
279
|
+
useDebugValue,
|
|
280
|
+
useDeferredValue,
|
|
281
|
+
useTransition,
|
|
282
|
+
useId,
|
|
283
|
+
useSyncExternalStore,
|
|
284
|
+
useInsertionEffect,
|
|
285
|
+
Fragment,
|
|
286
|
+
Suspense,
|
|
287
|
+
StrictMode,
|
|
288
|
+
Profiler,
|
|
289
|
+
Component,
|
|
290
|
+
PureComponent,
|
|
291
|
+
Children,
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// Default export
|
|
220
295
|
export default React;
|
|
221
296
|
`;
|
|
222
297
|
}
|
|
223
298
|
|
|
224
299
|
/**
|
|
225
300
|
* React DOM shim 소스 생성
|
|
301
|
+
* 주의: export *는 Bun bundler에서 제대로 작동하지 않으므로 명시적 export 필요
|
|
226
302
|
*/
|
|
227
303
|
function generateReactDOMShimSource(): string {
|
|
228
304
|
return `
|
|
229
305
|
/**
|
|
230
306
|
* Mandu React DOM Shim (Generated)
|
|
231
307
|
*/
|
|
232
|
-
import
|
|
233
|
-
|
|
308
|
+
import ReactDOM, {
|
|
309
|
+
createPortal,
|
|
310
|
+
flushSync,
|
|
311
|
+
render,
|
|
312
|
+
unmountComponentAtNode,
|
|
313
|
+
findDOMNode,
|
|
314
|
+
hydrate,
|
|
315
|
+
version,
|
|
316
|
+
} from 'react-dom';
|
|
317
|
+
|
|
318
|
+
// Named exports
|
|
319
|
+
export {
|
|
320
|
+
createPortal,
|
|
321
|
+
flushSync,
|
|
322
|
+
render,
|
|
323
|
+
unmountComponentAtNode,
|
|
324
|
+
findDOMNode,
|
|
325
|
+
hydrate,
|
|
326
|
+
version,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// Default export
|
|
234
330
|
export default ReactDOM;
|
|
235
331
|
`;
|
|
236
332
|
}
|
|
237
333
|
|
|
238
334
|
/**
|
|
239
335
|
* React DOM Client shim 소스 생성
|
|
336
|
+
* 주의: export *는 Bun bundler에서 제대로 작동하지 않으므로 명시적 export 필요
|
|
240
337
|
*/
|
|
241
338
|
function generateReactDOMClientShimSource(): string {
|
|
242
339
|
return `
|
|
243
340
|
/**
|
|
244
341
|
* Mandu React DOM Client Shim (Generated)
|
|
245
342
|
*/
|
|
246
|
-
import
|
|
247
|
-
|
|
248
|
-
|
|
343
|
+
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
344
|
+
|
|
345
|
+
// Named exports (명시적으로 re-export)
|
|
346
|
+
export { createRoot, hydrateRoot };
|
|
347
|
+
|
|
348
|
+
// Default export
|
|
349
|
+
export default { createRoot, hydrateRoot };
|
|
249
350
|
`;
|
|
250
351
|
}
|
|
251
352
|
|
|
252
353
|
/**
|
|
253
354
|
* JSX Runtime shim 소스 생성
|
|
355
|
+
* 주의: export *는 Bun bundler에서 제대로 작동하지 않으므로 명시적 export 필요
|
|
254
356
|
*/
|
|
255
357
|
function generateJsxRuntimeShimSource(): string {
|
|
256
358
|
return `
|
|
@@ -258,14 +360,19 @@ function generateJsxRuntimeShimSource(): string {
|
|
|
258
360
|
* Mandu JSX Runtime Shim (Generated)
|
|
259
361
|
* Production JSX 변환용
|
|
260
362
|
*/
|
|
261
|
-
import
|
|
262
|
-
|
|
263
|
-
|
|
363
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
364
|
+
|
|
365
|
+
// Named exports
|
|
366
|
+
export { jsx, jsxs, Fragment };
|
|
367
|
+
|
|
368
|
+
// Default export
|
|
369
|
+
export default { jsx, jsxs, Fragment };
|
|
264
370
|
`;
|
|
265
371
|
}
|
|
266
372
|
|
|
267
373
|
/**
|
|
268
374
|
* JSX Dev Runtime shim 소스 생성
|
|
375
|
+
* 주의: export *는 Bun bundler에서 제대로 작동하지 않으므로 명시적 export 필요
|
|
269
376
|
*/
|
|
270
377
|
function generateJsxDevRuntimeShimSource(): string {
|
|
271
378
|
return `
|
|
@@ -273,9 +380,13 @@ function generateJsxDevRuntimeShimSource(): string {
|
|
|
273
380
|
* Mandu JSX Dev Runtime Shim (Generated)
|
|
274
381
|
* Development JSX 변환용
|
|
275
382
|
*/
|
|
276
|
-
import
|
|
277
|
-
|
|
278
|
-
|
|
383
|
+
import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
|
|
384
|
+
|
|
385
|
+
// Named exports
|
|
386
|
+
export { jsxDEV, Fragment };
|
|
387
|
+
|
|
388
|
+
// Default export
|
|
389
|
+
export default { jsxDEV, Fragment };
|
|
279
390
|
`;
|
|
280
391
|
}
|
|
281
392
|
|
|
@@ -498,6 +609,7 @@ async function buildRouterRuntime(
|
|
|
498
609
|
|
|
499
610
|
/**
|
|
500
611
|
* Island 엔트리 래퍼 생성
|
|
612
|
+
* 주의: 글로벌 레지스트리 직접 사용 (번들러 인라인 문제 방지)
|
|
501
613
|
*/
|
|
502
614
|
function generateIslandEntry(routeId: string, clientModulePath: string): string {
|
|
503
615
|
// Windows 경로의 백슬래시를 슬래시로 변환 (JS escape 문제 방지)
|
|
@@ -508,9 +620,10 @@ function generateIslandEntry(routeId: string, clientModulePath: string): string
|
|
|
508
620
|
*/
|
|
509
621
|
|
|
510
622
|
import island from "${normalizedPath}";
|
|
511
|
-
import { registerIsland } from "./_runtime.js";
|
|
512
623
|
|
|
513
|
-
|
|
624
|
+
// 글로벌 레지스트리에 직접 등록 (런타임과 공유)
|
|
625
|
+
window.__MANDU_ISLANDS__ = window.__MANDU_ISLANDS__ || new Map();
|
|
626
|
+
window.__MANDU_ISLANDS__.set("${routeId}", () => island);
|
|
514
627
|
|
|
515
628
|
export default island;
|
|
516
629
|
`;
|