@zntc/core 0.1.1 → 0.1.3
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/README.md +35 -25
- package/bin/cli-flags.mjs +16 -0
- package/bin/rn-dev-input.mjs +11 -0
- package/bin/zntc.mjs +816 -48
- package/dist/core/index.d.cts +300 -3
- package/dist/core/index.d.ts +300 -3
- package/dist/core/src/config-loader.d.ts +1 -1
- package/dist/core/src/schema-allowlists.d.ts +2 -2
- package/dist/index.cjs +283 -82
- package/dist/index.js +361 -83
- package/dist/shared/compat-engines.d.ts +1 -1
- package/package.json +11 -11
package/dist/core/index.d.cts
CHANGED
|
@@ -168,6 +168,100 @@ export declare function transpile(source: string, options?: TranspileOptions & {
|
|
|
168
168
|
export declare function tokenize(source: string, options?: TokenizeOptions): TokenizeToken[];
|
|
169
169
|
export declare function configureProfile(profile: string[], level?: 'summary' | 'detailed' | 'per-module' | 'per-pass'): void;
|
|
170
170
|
export declare function profileReport(format?: 'table' | 'tree' | 'json' | 'csv'): string;
|
|
171
|
+
/** @see {@link NativeModule.tlsSelfCheck} */
|
|
172
|
+
export interface TlsSelfCheckOptions {
|
|
173
|
+
certPath: string;
|
|
174
|
+
keyPath: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* TLS context init/deinit 만 호출하는 BoringSSL sanity 진입점.
|
|
178
|
+
*
|
|
179
|
+
* cert/key 파일을 한 번 로드해 BoringSSL 의 SSL_CTX 가 정상 생성되는지 검증.
|
|
180
|
+
* Throw 시 message 에 Zig error name 이 포함되어 caller 가 분류 가능
|
|
181
|
+
* (CertLoadFailed / KeyLoadFailed / KeyMismatch 등).
|
|
182
|
+
*
|
|
183
|
+
* NAPI binary 에 BoringSSL 이 static link 되어 있는지 + dlopen 후 symbol resolve
|
|
184
|
+
* 가 동작하는지 빠르게 확인하는 용도. 향후 본격 HTTPS dev server NAPI entry 가
|
|
185
|
+
* 추가되면 그 entry 가 같은 path 사용.
|
|
186
|
+
*/
|
|
187
|
+
export declare function tlsSelfCheck(options: TlsSelfCheckOptions): void;
|
|
188
|
+
/** @see {@link NativeModule.startDevServer} */
|
|
189
|
+
export interface StartDevServerOptions {
|
|
190
|
+
rootDir: string;
|
|
191
|
+
/**
|
|
192
|
+
* TCP port (0-65535). Default 12300. 0 은 OS-assigned ephemeral port —
|
|
193
|
+
* `getDevServerPort(handle)` 로 실제 값 조회.
|
|
194
|
+
*/
|
|
195
|
+
port?: number;
|
|
196
|
+
/** Bind host. "localhost"/"127.0.0.1" (default) 또는 "0.0.0.0". */
|
|
197
|
+
host?: string;
|
|
198
|
+
/** `--bundle` entry. 지정 시 dev server 가 bundle 결과 서빙. */
|
|
199
|
+
entry?: string;
|
|
200
|
+
/** Open default browser at server URL. Default false. */
|
|
201
|
+
open?: boolean;
|
|
202
|
+
/** HTTPS cert (PEM). keyPath 와 함께 줘야. */
|
|
203
|
+
certPath?: string;
|
|
204
|
+
/** HTTPS key (PEM). certPath 와 함께 줘야. */
|
|
205
|
+
keyPath?: string;
|
|
206
|
+
/**
|
|
207
|
+
* stderr 의 banner + 모든 routine log silence. NAPI embed default true
|
|
208
|
+
* (자체 logger 가정). false 로 명시하면 stderr 출력. quiet 가드되는 카테고리
|
|
209
|
+
* 전체 리스트는 `src/server/dev_server.zig` 의 `DevServer.routineLog` doc
|
|
210
|
+
* (CANONICAL SCOPE LIST) 참조 — 단일 진실 소스.
|
|
211
|
+
*
|
|
212
|
+
* **critical 진단은 quiet 와 무관 항상 stderr** — init failure (cert 로드 /
|
|
213
|
+
* 디렉토리 못 찾음 / overlay sentinel), start fatal (host parse / listen 실패
|
|
214
|
+
* / watch thread spawn), deinit UAF 경고. 사용자가 throw 메시지 너머의 root
|
|
215
|
+
* cause 를 추적할 수 있도록 보장.
|
|
216
|
+
*/
|
|
217
|
+
quiet?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Lazy on-demand compilation. Default false. When true, the dev server builds
|
|
220
|
+
* with code-splitting + lazy mode (IIFE registry): only the entry chunk is
|
|
221
|
+
* served at `/bundle.js`, and each dynamic `import()` target is compiled on
|
|
222
|
+
* demand when the browser requests its chunk URL. Reduces cold-start time for
|
|
223
|
+
* large apps (parse work is deferred to first use).
|
|
224
|
+
*
|
|
225
|
+
* **Note**: this is honored by the native (`startDevServer`) dev server only.
|
|
226
|
+
* The `zntc dev` web CLI runs a separate JS dev server that does not yet
|
|
227
|
+
* support lazy compilation — tracked as a backlog item.
|
|
228
|
+
*/
|
|
229
|
+
lazyCompilation?: boolean;
|
|
230
|
+
}
|
|
231
|
+
/** Opaque handle from {@link startDevServer}. */
|
|
232
|
+
export type DevServerHandle = object;
|
|
233
|
+
/**
|
|
234
|
+
* In-process dev server (HTTP / HTTPS) 를 native thread 에서 시작.
|
|
235
|
+
*
|
|
236
|
+
* 일반 `zntc --serve` 와 동일한 listener / routing / HMR / SSE 동작. NAPI 임베드라
|
|
237
|
+
* Node event loop 는 자유 (별도 thread 에서 listen).
|
|
238
|
+
*
|
|
239
|
+
* 반환된 handle 은 opaque. `stopDevServer(handle)` 로 graceful shutdown. JS GC
|
|
240
|
+
* 가 handle 수거 시 finalizer 가 자동 stop (safety net) — 명시 stop 권장.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* const handle = startDevServer({ rootDir: './public', port: 5173 });
|
|
244
|
+
* try {
|
|
245
|
+
* await new Promise(r => setTimeout(r, 60_000));
|
|
246
|
+
* } finally {
|
|
247
|
+
* stopDevServer(handle);
|
|
248
|
+
* }
|
|
249
|
+
*/
|
|
250
|
+
export declare function startDevServer(options: StartDevServerOptions): DevServerHandle;
|
|
251
|
+
/** Graceful shutdown — idempotent. */
|
|
252
|
+
export declare function stopDevServer(handle: DevServerHandle): void;
|
|
253
|
+
/**
|
|
254
|
+
* startDevServer handle 의 실제 listen port.
|
|
255
|
+
*
|
|
256
|
+
* port=0 (OS-assigned ephemeral) 로 시작했을 때 실 bound port 조회. 일반적인
|
|
257
|
+
* test fixture / dynamic 환경에서 free port 자동 할당받고 그 값을 즉시 사용.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* const handle = startDevServer({ rootDir: './public', port: 0 });
|
|
261
|
+
* const port = getDevServerPort(handle);
|
|
262
|
+
* const res = await fetch(`http://127.0.0.1:${port}/`);
|
|
263
|
+
*/
|
|
264
|
+
export declare function getDevServerPort(handle: DevServerHandle): number;
|
|
171
265
|
export type { OutputFile, Diagnostic };
|
|
172
266
|
/** Return value of `meta.getModuleInfo(id)` in Rollup `manualChunks(id, meta)`. */
|
|
173
267
|
export interface ManualChunksModuleInfo {
|
|
@@ -217,6 +311,9 @@ export interface ManualChunksModuleInfo {
|
|
|
217
311
|
/** Modules that this module dynamically imports (`import()`). Includes
|
|
218
312
|
* external modules. */
|
|
219
313
|
dynamicallyImportedIds: string[];
|
|
314
|
+
/** Plugin이 load hook의 `{ meta }`로 부여한 메타데이터 (Rollup `info.meta` 호환).
|
|
315
|
+
* plugin이 meta를 설정하지 않은 모듈은 빈 객체 `{}` (#1880 PR2). */
|
|
316
|
+
meta: Record<string, unknown>;
|
|
220
317
|
}
|
|
221
318
|
/** The second argument of the `manualChunks` callback — module graph topology lookup. */
|
|
222
319
|
export interface ManualChunksMeta {
|
|
@@ -297,7 +394,13 @@ export interface EmotionOptions {
|
|
|
297
394
|
canonicalImport: [string, string];
|
|
298
395
|
}>>;
|
|
299
396
|
}
|
|
300
|
-
/**
|
|
397
|
+
/**
|
|
398
|
+
* Vite-style dev server options used by `zntc dev` / `zntc --serve`.
|
|
399
|
+
*
|
|
400
|
+
* Note: `startDevServer()` (native NAPI) accepts extra options such as
|
|
401
|
+
* `lazyCompilation` — see {@link StartDevServerOptions}. The `zntc dev` web CLI
|
|
402
|
+
* runs a separate JS dev server and does not honor those yet (backlog).
|
|
403
|
+
*/
|
|
301
404
|
export interface DevServerOptions {
|
|
302
405
|
/** Port to listen on. CLI `--port` overrides this value. */
|
|
303
406
|
port?: number;
|
|
@@ -344,11 +447,51 @@ interface BuildOptionsCommon {
|
|
|
344
447
|
entryPoints: string[];
|
|
345
448
|
format?: 'esm' | 'cjs' | 'iife' | 'umd' | 'amd';
|
|
346
449
|
external?: string[];
|
|
450
|
+
/**
|
|
451
|
+
* React Native version target — e.g. `'0.80'`, `'>=0.74'`, `'<=0.84'`, `'==0.76'`.
|
|
452
|
+
* Implies `platform: 'react-native'` and applies a per-version downlevel matrix
|
|
453
|
+
* derived from the RN javascript-environment docs (syntax the docs list as supported
|
|
454
|
+
* stays native; everything else is downleveled) instead of the blunt Hermes preset.
|
|
455
|
+
* `>=`/bare/`==` target that version; `<=`/`<` use the most conservative matrix.
|
|
456
|
+
* Conflicts with `platform: 'node' | 'neutral'`.
|
|
457
|
+
*/
|
|
458
|
+
rnVersion?: string;
|
|
459
|
+
/**
|
|
460
|
+
* #4438 Disk cache: persist parse/semantic across builds for faster cold rebuilds.
|
|
461
|
+
* `true` enables it at the default dir `node_modules/.cache/zntc`; pass `cacheDir`
|
|
462
|
+
* for a custom path. Opt-in (off by default). Mirrors CLI `--disk-cache`.
|
|
463
|
+
*/
|
|
464
|
+
diskCache?: boolean;
|
|
465
|
+
/** #4438 Disk cache directory (implies `diskCache`). Mirrors CLI `--cache-dir`. */
|
|
466
|
+
cacheDir?: string;
|
|
347
467
|
minify?: boolean;
|
|
348
468
|
minifyWhitespace?: boolean;
|
|
349
469
|
minifyIdentifiers?: boolean;
|
|
350
470
|
minifySyntax?: boolean;
|
|
351
471
|
splitting?: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Lazy on-demand compilation primitive (dev-only). Requires `splitting: true` +
|
|
474
|
+
* `devMode: true`. When true, dynamic `import()` targets are left as UNPARSED
|
|
475
|
+
* "lazy seeds" (emit-skipped); the entry references them by stable path-hash name
|
|
476
|
+
* (`__zntc_load_chunk("<stem>-<pathHash>.js")`), and the result exposes
|
|
477
|
+
* {@link NativeBuildResult.lazySeeds}. A dev server compiles each seed on demand
|
|
478
|
+
* by rebuilding with `lazyForceParse: [seedPath]`. Low-level primitive — the web
|
|
479
|
+
* CLI dev server orchestrates this; most users use it indirectly.
|
|
480
|
+
*/
|
|
481
|
+
lazyCompilation?: boolean;
|
|
482
|
+
/**
|
|
483
|
+
* Force-parse specific lazy seeds even under `lazyCompilation: true` — array of
|
|
484
|
+
* dynamic-import target paths to compile eagerly instead of deferring. A dev
|
|
485
|
+
* server passes the requested seed's path here to materialize exactly that
|
|
486
|
+
* on-demand chunk. No effect without `lazyCompilation: true`.
|
|
487
|
+
*
|
|
488
|
+
* **Contract**: each entry must be the EXACT path from a {@link NativeBuildResult.lazySeeds}
|
|
489
|
+
* entry's `.path` (the bundler-resolved absolute path — e.g. symlink-resolved
|
|
490
|
+
* `/private/tmp/...`, not your own `./x` specifier). A path that doesn't match a
|
|
491
|
+
* seed is **silently ignored** (that seed stays lazy). Source these from a prior
|
|
492
|
+
* `lazySeeds` result, never reconstruct them.
|
|
493
|
+
*/
|
|
494
|
+
lazyForceParse?: string[];
|
|
352
495
|
/** Rollup `output.inlineDynamicImports` — absorbs the dynamic import target
|
|
353
496
|
* into the importer's chunk and rewrites the `import("./x")` call into an
|
|
354
497
|
* `__esm` wrapper init/exports call. Combine with `splitting: true`. The
|
|
@@ -424,6 +567,18 @@ interface BuildOptionsCommon {
|
|
|
424
567
|
entryNames?: string;
|
|
425
568
|
chunkNames?: string;
|
|
426
569
|
assetNames?: string;
|
|
570
|
+
/** 이 byte 수 **이하**의 asset 은 별도 파일로 emit 하지 않고 data URL 로 인라인한다
|
|
571
|
+
* (#4466). Vite 의 `assetsInlineLimit` 상당.
|
|
572
|
+
*
|
|
573
|
+
* - 기본값: `4096` (4KB)
|
|
574
|
+
* - `0`: 인라인 끔 — 크기와 무관하게 항상 파일로 emit
|
|
575
|
+
*
|
|
576
|
+
* 인라인된 asset 은 `assetNames` 패턴을 타지 않고, CSS `url()` / import 값이
|
|
577
|
+
* `data:` URI 로 치환된다. */
|
|
578
|
+
assetInlineLimit?: number;
|
|
579
|
+
/** CSS chunk path pattern. Default: `[dir]/[name]` (PR B-4b sub-2; esbuild parity).
|
|
580
|
+
* Supports `[name]`, `[hash]` (content), and `[dir]` (entry-relative). */
|
|
581
|
+
cssNames?: string;
|
|
427
582
|
/** Metro AssetRegistry module path (React Native-only layer).
|
|
428
583
|
* - `undefined`: determined by the platform preset (with
|
|
429
584
|
* `platform: "react-native"`, the default path is used automatically)
|
|
@@ -470,6 +625,17 @@ interface BuildOptionsCommon {
|
|
|
470
625
|
find: string | RegExp;
|
|
471
626
|
replacement: string;
|
|
472
627
|
}>;
|
|
628
|
+
/** alias 의 prefix matching 을 끄는 from 목록 — exact 매칭만 허용.
|
|
629
|
+
*
|
|
630
|
+
* `alias` object form 의 기본 동작은 esbuild 처럼 정확/접두사 둘 다 매칭이라
|
|
631
|
+
* `react: "preact/compat"` 가 `react/hooks → preact/compat/hooks` 로도 동작한다.
|
|
632
|
+
* 그러나 alias 값이 **단일 파일** 인 경우 prefix 매칭이 `from/subpath → file.js/subpath`
|
|
633
|
+
* (파일을 디렉토리 취급) 로 깨진다. 이 list 에 from 을 적으면 그 entry 는 exact
|
|
634
|
+
* 매칭만 적용 — subpath import 는 alias 미적용되어 원본 패키지로 resolve.
|
|
635
|
+
*
|
|
636
|
+
* 일반적인 package-to-package alias (`react → preact/compat`) 는 list 에 안 넣음.
|
|
637
|
+
* 주로 wrapper / shim 파일 alias 에서 사용. */
|
|
638
|
+
aliasExact?: string[];
|
|
473
639
|
/** Fallback resolution — applied **only when** normal resolution fails
|
|
474
640
|
* (webpack `resolve.fallback` / Metro `resolver.extraNodeModules`-compatible).
|
|
475
641
|
* If the value is a string, re-resolve to that specifier; if `false`,
|
|
@@ -665,6 +831,15 @@ interface BuildOptionsCommon {
|
|
|
665
831
|
reactRefresh?: boolean;
|
|
666
832
|
/** Collect dev mode per-module codes (for HMR rebuilds). */
|
|
667
833
|
collectModuleCodes?: boolean;
|
|
834
|
+
/**
|
|
835
|
+
* `watch()` 가 *initial* 빌드 결과를 outdir 에 쓰지 않는다 (#3779 follow-up).
|
|
836
|
+
* caller 가 이미 별도 `build()` / `buildSync()` 로 outdir 를 채워 둔 상태에서
|
|
837
|
+
* watch handle 만 띄울 때 사용 — `runServe` 가 `runBundle` 1회 후 `watch()` 를
|
|
838
|
+
* 띄우는 패턴. caller 가 outdir 를 미리 준비하지 않으면 dev server 가 404 — 위험은
|
|
839
|
+
* caller 책임. incremental rebuild 의 출력 동작은 watch handle 이 자동으로 별도
|
|
840
|
+
* 제어. 기본 false (RN dev 등 기존 단독 watch 사용자 호환).
|
|
841
|
+
*/
|
|
842
|
+
skipInitialOutput?: boolean;
|
|
668
843
|
/** Add configurable: true to Object.defineProperty (RN/Hermes-compatible). */
|
|
669
844
|
configurableExports?: boolean;
|
|
670
845
|
/** Guarantee ESM execution order — downgrade function declarations to
|
|
@@ -711,6 +886,12 @@ interface BuildOptionsCommon {
|
|
|
711
886
|
* Avoids the Fabric early-register race (`View config not found for
|
|
712
887
|
* component 'X'`). */
|
|
713
888
|
codegenTransform?: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* PR-3: HMR 위상 보존에서 plugin 게이트를 완화하는 **빌드 수준** opt-in 신호(per-plugin 아님).
|
|
891
|
+
* 이 빌드의 모든 plugin 이 결정적·모듈별 순수(ModuleGraph 무접근, 전역 상태/lifecycle 출력 영향
|
|
892
|
+
* 없음)임을 호출자가 보장할 때만 true. RN preset 이 내장 plugin 구성에 대해 자동으로 켠다.
|
|
893
|
+
* 임의 custom plugin 은 비결정 가능하므로 default false. */
|
|
894
|
+
preserveSafePlugins?: boolean;
|
|
714
895
|
/** Global identifiers to reserve during scope hoisting. */
|
|
715
896
|
globalIdentifiers?: string[];
|
|
716
897
|
/** Paths of polyfills to run immediately at bundle start. */
|
|
@@ -744,6 +925,14 @@ interface BuildOptionsCommon {
|
|
|
744
925
|
onReady?: (event: WatchReadyEvent) => void | Promise<void>;
|
|
745
926
|
/** watch-mode rebuild callback. */
|
|
746
927
|
onRebuild?: (event: WatchRebuildEvent) => void | Promise<void>;
|
|
928
|
+
/**
|
|
929
|
+
* watch debounce window in milliseconds — after the first file event, the
|
|
930
|
+
* watcher waits this long for idle before rebuilding, merging rapid saves
|
|
931
|
+
* into one rebuild. Default `16`. Set `0` to rebuild immediately (no debounce;
|
|
932
|
+
* lower latency, but rapid saves may trigger multiple rebuilds). Mirrors the
|
|
933
|
+
* CLI `--watch-delay` flag. Only affects the NAPI `watch()` path.
|
|
934
|
+
*/
|
|
935
|
+
watchDelay?: number;
|
|
747
936
|
/**
|
|
748
937
|
* Whether to write the `.map` file to disk (Issue #1727 Phase B).
|
|
749
938
|
*
|
|
@@ -797,10 +986,40 @@ export type BuildOptions = (BuildOptionsCommon & {
|
|
|
797
986
|
export interface WatchReadyEvent {
|
|
798
987
|
files: number;
|
|
799
988
|
bytes: number;
|
|
989
|
+
/**
|
|
990
|
+
* #3796 — initial 빌드의 output 파일 path 목록. caller (예: `runServe`) 가 outdir scan 없이
|
|
991
|
+
* 정확한 outputFiles 정보를 받아 후속 hook (예: `injectBundleCssLinks`) 호출 가능. contents
|
|
992
|
+
* 는 메모리 비용이 커 path 만 노출 — caller 가 fs read 또는 path 기반 분기.
|
|
993
|
+
*/
|
|
994
|
+
outputs?: string[];
|
|
995
|
+
/**
|
|
996
|
+
* D105 PR-B-1 — lazy 빌드(`lazyCompilation: true`)일 때만. 미파싱 lazy seed 들의
|
|
997
|
+
* `{ pathHash, path }` (build 결과 {@link NativeBuildResult.lazySeeds} 와 동일 shape).
|
|
998
|
+
* dev 서버가 watch(lazy)로 HMR 을 유지하며 on-demand lazy 라우팅을 구현하기 위한 **토대 데이터**
|
|
999
|
+
* — 요청 청크 URL `<stem>-<pathHash>.js` 의 해시로 seed 경로를 역참조해 on-demand 컴파일
|
|
1000
|
+
* (`build({ lazyForceParse: [path] })`)할 수 있다.
|
|
1001
|
+
*
|
|
1002
|
+
* **범위**: *initial* 빌드(onReady)에서만 노출. rebuild(HMR)에서 동적 import 추가/삭제로
|
|
1003
|
+
* seed 집합이 바뀌는 경우의 갱신 전략(델타 vs full-reload)은 PR-B-2(dev 서버 연동)에서 정한다.
|
|
1004
|
+
*/
|
|
1005
|
+
lazySeeds?: Array<{
|
|
1006
|
+
pathHash: string;
|
|
1007
|
+
path: string;
|
|
1008
|
+
}>;
|
|
800
1009
|
}
|
|
801
1010
|
export interface WatchRebuildEvent {
|
|
802
1011
|
success: boolean;
|
|
1012
|
+
/** Single error tag from native `@errorName(err)` (catch path). */
|
|
803
1013
|
error?: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* #3799 — Multiple error diagnostics from bundler (success-but-errors path). When the
|
|
1016
|
+
* bundler 자체가 throw 하지 않고 success-결과를 반환했지만 diagnostics 에 error severity
|
|
1017
|
+
* 가 있는 경우 채워진다. `error` (single tag) 와 별개 — `errors` 가 있으면 우선 사용.
|
|
1018
|
+
*/
|
|
1019
|
+
errors?: Array<{
|
|
1020
|
+
file: string;
|
|
1021
|
+
message: string;
|
|
1022
|
+
}>;
|
|
804
1023
|
changed?: string[];
|
|
805
1024
|
graphChanged?: boolean;
|
|
806
1025
|
updates?: Array<{
|
|
@@ -886,10 +1105,36 @@ export interface WatchRebuildEvent {
|
|
|
886
1105
|
emitConcat: number;
|
|
887
1106
|
/** Source map V3 JSON generation (VLQ encode + sources content + debugId). */
|
|
888
1107
|
emitSourcemapFinalize: number;
|
|
1108
|
+
/** Link: per-module export map build. */
|
|
1109
|
+
linkBuildExportMap: number;
|
|
1110
|
+
/** Link: import resolution (binding cross-reference). */
|
|
1111
|
+
linkResolveImports: number;
|
|
1112
|
+
/**
|
|
1113
|
+
* Link: canonical_name 계산. lodash 측정에서 ~50ms — RFC #3940 의 RenameTable
|
|
1114
|
+
* 도입 (Phase 2) 후 baseline 으로 활용.
|
|
1115
|
+
*/
|
|
1116
|
+
linkComputeRenames: number;
|
|
1117
|
+
/** Link: re-export alias 채우기 (cross-module export name 매핑). */
|
|
1118
|
+
linkPopulateReExportAliases: number;
|
|
1119
|
+
/** Link: import symbol 채우기. */
|
|
1120
|
+
linkPopulateImportSymbols: number;
|
|
1121
|
+
/** Link: namespace access 채우기 (namespace import 사용처). */
|
|
1122
|
+
linkPopulateNamespaceAccesses: number;
|
|
889
1123
|
};
|
|
890
1124
|
/** Number of modules reparsed in the incremental graph. Counts cache-missed
|
|
891
1125
|
* modules only. Not exposed for full builds. */
|
|
892
1126
|
reparsedModules?: number;
|
|
1127
|
+
/**
|
|
1128
|
+
* D105 PR-C-1: lazy 빌드의 미파싱 seed 목록 `{ pathHash, path }`
|
|
1129
|
+
* ({@link WatchReadyEvent.lazySeeds} 와 동일 shape/공식). `lazyCompilation` 이 켜진
|
|
1130
|
+
* watch 세션에서 매 rebuild 마다 노출 → dev 서버가 rebuild 중 새로 추가/제거된 동적
|
|
1131
|
+
* import seed 집합을 갱신할 수 있다 (onReady 한정이던 PR-B-1 의 rebuild 확장).
|
|
1132
|
+
* lazy 빌드가 아니거나 동적 import 가 없으면 생략(`undefined`).
|
|
1133
|
+
*/
|
|
1134
|
+
lazySeeds?: Array<{
|
|
1135
|
+
pathHash: string;
|
|
1136
|
+
path: string;
|
|
1137
|
+
}>;
|
|
893
1138
|
}
|
|
894
1139
|
export interface WatchHandle {
|
|
895
1140
|
stop(): void;
|
|
@@ -914,6 +1159,18 @@ export interface WatchHandle {
|
|
|
914
1159
|
* `null` if `moduleId` was not included in this rebuild.
|
|
915
1160
|
*/
|
|
916
1161
|
getHmrSourceMap(moduleId: string): string | null;
|
|
1162
|
+
/**
|
|
1163
|
+
* #4079 PR-2 — 요청된 lazy seed(동적 import 타겟)를 watch 그래프에서 force-parse 하도록
|
|
1164
|
+
* 누적 등록한다. `path` 는 {@link WatchReadyEvent.lazySeeds} / {@link WatchRebuildEvent.lazySeeds}
|
|
1165
|
+
* 의 *정확한* 절대경로여야 한다(번들러 해석 경로 — `resolve()` 로 재구성 금지).
|
|
1166
|
+
*
|
|
1167
|
+
* 호출 즉시 worker 가 다음 rebuild(파일 변경 없이도, ≤200ms 내)에서 그 seed 를 정식 파싱·
|
|
1168
|
+
* emit 하고 그 transitive 정적 deps 를 감시 대상에 포함시킨다(dev materialize — `--lazy`
|
|
1169
|
+
* 라우트를 방문하면 그 안쪽 파일 편집도 HMR 동작). 중복/`stop()` 후 호출은 no-op.
|
|
1170
|
+
*
|
|
1171
|
+
* `lazyCompilation`+`splitting` watch 세션에서만 의미 있다.
|
|
1172
|
+
*/
|
|
1173
|
+
requestLazySeed(path: string): void;
|
|
917
1174
|
}
|
|
918
1175
|
export interface ZntcPlugin {
|
|
919
1176
|
name: string;
|
|
@@ -945,6 +1202,8 @@ export interface PluginBuild {
|
|
|
945
1202
|
contents: string | Uint8Array;
|
|
946
1203
|
loader?: string;
|
|
947
1204
|
map?: unknown;
|
|
1205
|
+
/** Rollup `ModuleInfo.meta` 호환 — getModuleInfo(id).meta 로 노출 (#1880 PR2). */
|
|
1206
|
+
meta?: Record<string, unknown>;
|
|
948
1207
|
}>): void;
|
|
949
1208
|
onTransform(options: {
|
|
950
1209
|
filter: RegExp;
|
|
@@ -1092,6 +1351,12 @@ export interface AppBuildOptions {
|
|
|
1092
1351
|
* the same option representation.
|
|
1093
1352
|
*/
|
|
1094
1353
|
compiler?: CompilerOptions;
|
|
1354
|
+
/**
|
|
1355
|
+
* Rollup-compatible JS plugins. Same `resolveId`/`load`/`transform` hooks as
|
|
1356
|
+
* `BuildOptions.plugins` — app build pipeline 도 같은 dispatcher 를 받는다
|
|
1357
|
+
* (#2538 4-4 PR-1).
|
|
1358
|
+
*/
|
|
1359
|
+
plugins?: ZntcPlugin[];
|
|
1095
1360
|
}
|
|
1096
1361
|
/**
|
|
1097
1362
|
* Options for preparing a Vite-style application for the development server.
|
|
@@ -1123,6 +1388,20 @@ export interface AppDevPrepareResult {
|
|
|
1123
1388
|
/** Number of files emitted while preparing the dev app, when available. */
|
|
1124
1389
|
outputCount?: number;
|
|
1125
1390
|
}
|
|
1391
|
+
/**
|
|
1392
|
+
* 단일 출력 파일의 디스크 경로를 결정한다(순수 함수 — 단위 테스트용 분리).
|
|
1393
|
+
*
|
|
1394
|
+
* outfile 모드에선 메인 번들(`bundle.js`)을 outfile 로, 그 짝 sourcemap(`bundle.js.map`)을
|
|
1395
|
+
* `outfile.map` 으로 보낸다. **메인 map 에만 특정**(`=== 'bundle.js.map'`) — 과거 `endsWith('.map')`
|
|
1396
|
+
* 광범위 매칭은 메인이 아닌 map(다중 청크 등)도 같은 `outfile.map` 으로 보내 덮어썼다. 그 외
|
|
1397
|
+
* 파일은 outdir 가 있으면 그 아래로, 없으면 cwd 기준으로 해석.
|
|
1398
|
+
*
|
|
1399
|
+
* @internal
|
|
1400
|
+
*/
|
|
1401
|
+
export declare function resolveOutputPath(filePath: string, opts: {
|
|
1402
|
+
outfileResolved: string | null;
|
|
1403
|
+
outdir?: string;
|
|
1404
|
+
}): string;
|
|
1126
1405
|
/**
|
|
1127
1406
|
* Runs bundling asynchronously. Does not block the event loop.
|
|
1128
1407
|
* Promise/async hooks of JS plugins are supported in this function.
|
|
@@ -1257,13 +1536,31 @@ export interface RollupPluginContext {
|
|
|
1257
1536
|
warn(message: unknown): void;
|
|
1258
1537
|
/** Register an additional file to watch in watch mode. Currently a no-op (graph mutation not supported). */
|
|
1259
1538
|
addWatchFile(id: string): void;
|
|
1260
|
-
/** Module resolve
|
|
1539
|
+
/** Module resolve (Rollup `this.resolve` 호환, #1880 PR4). async build() 의 resolveId/load/transform
|
|
1540
|
+
* hook 에서 native resolver(순수 path resolution)로 해석 → `{ id, external }` 또는 null(미해결).
|
|
1541
|
+
* `options`(skipSelf 등)는 현재 no-op (native resolver 가 plugin 을 재진입하지 않아 skipSelf 자명 충족).
|
|
1542
|
+
* 그 외 hook / buildSync / vitePlugin() 어댑터에서는 throw. */
|
|
1261
1543
|
resolve(source: string, importer?: string | null, options?: unknown): Promise<{
|
|
1262
1544
|
id: string;
|
|
1263
1545
|
external?: boolean;
|
|
1264
1546
|
} | null>;
|
|
1265
|
-
/** Emit an additional asset
|
|
1547
|
+
/** Emit an additional asset (Rollup `this.emitFile` 호환, #1880 PR5/6). async build() 의
|
|
1548
|
+
* resolveId/load/transform hook 에서 `{ type: 'asset', fileName | name, source }` 를 emit →
|
|
1549
|
+
* reference id 반환, 해당 asset 은 `result.outputFiles` 에 나타난다. `fileName` 은 그대로,
|
|
1550
|
+
* `name` 은 source hash 로 파일명 자동 생성(file/copy loader 와 동일 `assetNames` 패턴).
|
|
1551
|
+
* vitePlugin() 어댑터의 resolveId/load/transform hook 에서도 동작(#1880 PR7).
|
|
1552
|
+
* `{ type: 'chunk', id }` 는 id(이미 graph 에 있는 모듈)를 별도 chunk 로 분리(#1880 PR7-2b-i,
|
|
1553
|
+
* splitting:true). 신규 모듈 chunk emit 은 미지원(build 진단). 그 외 hook / buildSync 는 throw.
|
|
1554
|
+
* **반드시 hook 본문에서 동기적으로 호출**해야 한다 — `await` 이후나 detached promise 에서
|
|
1555
|
+
* 호출하면 EmitStore 수명을 벗어나 asset 이 누락되거나 정의되지 않은 동작이 된다 (follow-up). */
|
|
1266
1556
|
emitFile(file: unknown): string;
|
|
1557
|
+
/** Resolve an emitted file's final output name (Rollup `this.getFileName` 호환, #1880 PR6).
|
|
1558
|
+
* `this.emitFile` 이 돌려준 reference id → 최종 출력 파일명. asset hash 는 source 기반이라 emit
|
|
1559
|
+
* 시점에 확정되므로 같은(또는 먼저 완료된) hook 에서 즉시 조회 가능. 미등록 id 는 throw. */
|
|
1560
|
+
getFileName(referenceId: string): string;
|
|
1561
|
+
/** 모듈 그래프 정보(+plugin meta) 조회 (Rollup `this.getModuleInfo` 호환).
|
|
1562
|
+
* async build() 의 transform hook 에서만 사용 가능 (#1880 PR3). 그 외 hook/buildSync 에선 throw. */
|
|
1563
|
+
getModuleInfo(id: string): ManualChunksModuleInfo | null;
|
|
1267
1564
|
}
|
|
1268
1565
|
type ResolveIdResult = string | null | undefined | void | {
|
|
1269
1566
|
id: string;
|