@markless/bundler 0.8.0 → 0.9.0

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.
@@ -1,11 +1,10 @@
1
1
  import { c as createCompileErrorPayload, s as MarklessCompileError } from "./dev-error-BEduK_R3.js";
2
- import { $ as MARKLESS_BUNDLE_GRAPH, A as isSymbolOnlySourceRequest, At as executionLogVirtualModuleSource, B as sourceForResumeVirtualImporter, C as isMarklessRuntimeModule, Ct as symbolVirtualModuleId, D as isResumeSourceRequest, Dt as MARKLESS_EXECUTION_LOG_GLOBAL, E as isRenderDataSourceRequest, Et as EXECUTION_LOG_DISPATCH_MODULE_IDS, F as resolveVirtualId, Ft as requalifyExecutionLogModuleHook, G as virtualModuleSourceForLoad, H as sourceForSymbolVirtualImporter, I as resolverVirtualModuleSourceFile, J as planPrerenderTriggerGroups, K as emitPrerenderBoundaryRendererModule, L as serverSharedSourceRequest, Lt as planModulePreloads, M as normalizeVirtualId$2, Mt as injectExecutionLogModuleHook, N as pathname$1, O as isRouteNavigationSourceRequest, Ot as MARKLESS_EXECUTION_LOG_MODULE_ID, P as renderDataReachedFromQuery, Pt as normalizeExecutionLogMode, Q as MARKLESS_BUILD_PREFIX, R as sharedReachedRenderDataRequest, S as isClientPrimarySourceRequest, St as symbolEntryVirtualModuleId, T as isRelativeImport, Tt as withoutFirstUse, U as sourceForTriggerGroupVirtualImporter, V as sourceForSettleVirtualImporter, W as stripBuildPrefix, X as adaptImportedCaptureResolver, Y as triggerGroupVirtualModuleId, Z as MARKLESS_BUILD_METADATA_FILES, _ as clientSymbolEntries, a as isStartupPack, at as outputDefaults, b as emittedBundleModuleIds, bt as scopedSymbolExportName, c as planRoutePackGroups, d as warmPacksSuffix, dt as emitResumeModule, et as MARKLESS_BYTE_ATTRIBUTION, f as MARKLESS_INTERACTION_CLOSURES_ASSET, ft as emitSettleModule, g as clientRouteArtifactReference, gt as prerenderWakeVirtualModuleId, h as TSRX_SOURCE_FILE$1, ht as payloadModule, it as MARKLESS_PUBLIC_BUILD_METADATA_FILES, j as materializedReachedRenderDataSource, jt as hasExecutionLogModuleHook, k as isScalarPlanSourceRequest, kt as executionLogActivationInjection, l as startupPackOfLazy, lt as demandsOverlay, m as MARKLESS_ROUTE_SOURCE_QUERY_RE, mt as encodedSymbolSource, nt as MARKLESS_EXECUTION_SIZES, ot as MARKLESS_VIRTUAL_PREFIX, pt as emitSourceModule, q as emitPrerenderTriggerGroupModule, rt as MARKLESS_INTERACTION_CLOSURES, s as marklessDeferredChunkFileNames, tt as MARKLESS_EXECUTION_DEMAND, ut as emitOverlayLoaderInstall, v as devBrowserSourceModuleUrl, vt as resumeVirtualModuleId, w as isPrerenderWakeSourceRequest, wt as symbolVirtualModuleSourceFile, x as executionLogRuntimeModuleId, xt as settleVirtualModuleId, y as devBrowserVirtualModuleUrl, yt as rewriteSymbolModuleExport, z as sourceForPrerenderWakeVirtualImporter } from "./route-pack-groups-BLS6xeVV.js";
2
+ import { $ as MARKLESS_BUILD_PREFIX, A as isScalarPlanSourceRequest, At as compileInlineResumerSources, B as sourceForPrerenderWakeVirtualImporter, Bt as hasExecutionLogModuleHook, C as isCompilerStatefulModuleId, Ct as symbolEntryVirtualModuleId, D as isRenderDataSourceRequest, Dt as isSharedInlineSourcesModuleId, E as isRelativeImport, Et as withoutFirstUse, F as renderDataReachedFromQuery, Ft as EXECUTION_LOG_DISPATCH_MODULE_IDS, G as stripBuildPrefix, H as sourceForSettleVirtualImporter, I as resolveVirtualId, It as MARKLESS_EXECUTION_LOG_GLOBAL, J as emitPrerenderTriggerGroupModule, K as virtualModuleSourceForLoad, Kt as planModulePreloads, L as resolverVirtualModuleSourceFile, Lt as MARKLESS_EXECUTION_LOG_MODULE_ID, M as materializedReachedRenderDataSource, N as normalizeVirtualId$2, O as isResumeSourceRequest, Ot as sharedInlineSourcesModuleId, P as pathname$1, Q as MARKLESS_BUILD_METADATA_FILES, R as serverSharedSourceRequest, Rt as executionLogActivationInjection, S as isClientPrimarySourceRequest, St as settleVirtualModuleId, T as isPrerenderWakeSourceRequest, Tt as symbolVirtualModuleSourceFile, U as sourceForSymbolVirtualImporter, Ut as normalizeExecutionLogMode, V as sourceForResumeVirtualImporter, Vt as injectExecutionLogModuleHook, W as sourceForTriggerGroupVirtualImporter, Wt as requalifyExecutionLogModuleHook, X as triggerGroupVirtualModuleId, Y as planPrerenderTriggerGroups, Z as adaptImportedCaptureResolver, _ as clientSymbolEntries, _t as prerenderWakeVirtualModuleId, a as isStartupPack, at as MARKLESS_PUBLIC_BUILD_METADATA_FILES, b as emittedBundleModuleIds, bt as rewriteSymbolModuleExport, c as planRoutePackGroups, d as warmPacksSuffix, dt as emitOverlayLoaderInstall, et as MARKLESS_BUNDLE_GRAPH, f as MARKLESS_INTERACTION_CLOSURES_ASSET, ft as emitResumeModule, g as clientRouteArtifactReference, gt as payloadModule, h as TSRX_SOURCE_FILE$1, ht as encodedSymbolSource, it as MARKLESS_INTERACTION_CLOSURES, j as isSymbolOnlySourceRequest, jt as compilePrerenderInlineResumerSources, k as isRouteNavigationSourceRequest, kt as sharedInlineSourcesModuleSource, l as startupPackOfLazy, m as MARKLESS_ROUTE_SOURCE_QUERY_RE, mt as emitSourceModule, nt as MARKLESS_EXECUTION_DEMAND, ot as outputDefaults, pt as emitSettleModule, q as emitPrerenderBoundaryRendererModule, rt as MARKLESS_EXECUTION_SIZES, s as marklessDeferredChunkFileNames, st as MARKLESS_VIRTUAL_PREFIX, tt as MARKLESS_BYTE_ATTRIBUTION, ut as demandsOverlay, v as devBrowserSourceModuleUrl, w as isMarklessRuntimeModule, wt as symbolVirtualModuleId, x as executionLogRuntimeModuleId, xt as scopedSymbolExportName, y as devBrowserVirtualModuleUrl, yt as resumeVirtualModuleId, z as sharedReachedRenderDataRequest, zt as executionLogVirtualModuleSource } from "./route-pack-groups-0vHmSVdv.js";
3
3
  import { joinURL, parsePath, withLeadingSlash, withQuery, withoutLeadingSlash } from "ufo";
4
4
  import { PROTOCOL_EVENT_ACTION_KIND, PROTOCOL_IDLE_EVENT_NAME, createStorageSeedMetadataFromGraphNodeId, jsonSourceWithNonFiniteNumbers } from "@markless/serializer";
5
5
  import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
6
6
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve } from "pathe";
7
7
  import { DEBUGGING_PLAYBOOK_HINT, LEAN_DISPATCH_MARKER_MODULES, RUNTIME_CAPABILITY_MODULE_IDS, artifactChildCandidates, callsImportedOrFreeName, collectTsrxModuleDiagnostics, compileTsrxModule, compileTsrxModuleLinkArtifact, componentEdgeSymbolRoutes, computeExecutionAttribution, computeLinkedInterfaces, delegateChildRenderPlan, delegateChildRendering, delegateChildResolutionRequests, delegateMaterializationScope, emitSymbolResolverModule, evaluateModuleConstants, importedNestedRepeats, importedRowComponentMints, importedRowSlotReaders, importedRowTemplateMints, importedSymbolRoutes, linkBarrelComponents, linkClaimManifests, linkDelegateChildren, linkImportedModules, linkedChildrenHaveBrowserTriggers, linkedImportedClaimsMissing, linkedImportedSymbolInputs, linkedManifestHasBrowserTriggers, linkedModuleChildDiagnostics, linkedModuleChildKey, linkedModuleClaimPlan, linkedModuleImportRequests, linkedModuleLoadSource, linkedRenderDataBoundarySymbols, linkedRenderDataOnlyChange, linkedRenderDataReachRoot, linkedResolverClaimVerdict, linkedRouteArtifactRegistration, linkedSymbolRouteRequests, moduleInterfaceHash, moduleLinkResolutionKey, overlayBarrelInterfaces, parseJavaScriptModule, planDelegateChildren, planEmittedClaimOwnership, planLinkedModuleChildren, planRenderDataModule, planTransformRequest, prerenderInterfacesComplete, renderDataClaimManifest, renderDataReachImportSources, uniqueLinkedModuleChildren } from "@markless/compiler";
8
- import { INLINE_RESUMER_PAGE_TOKEN, PRERENDER_INLINE_EVENT_NAMES_TOKEN, createInlineResumerDebugRegistrationSource, createInlineResumerSelfWakeSource, createInlineResumerSource, createPrerenderInlineResumerSource, createPrerenderSettleInlineResumerSource } from "@markless/web/inline/resumer";
9
8
  import { parse, parseSync } from "rolldown/experimental";
10
9
  import { copyFile, mkdir, readFile, readdir, rename, rm, rmdir } from "node:fs/promises";
11
10
  import { defDGraph } from "@thi.ng/dgraph";
@@ -253,10 +252,16 @@ function rootRelativeRegionComments(bundle, root) {
253
252
  //#region src/module-id.ts
254
253
  const linkedPackagesByRoot = /* @__PURE__ */ new Map();
255
254
  const mintedSources = /* @__PURE__ */ new Map();
255
+ const mintedIds = /* @__PURE__ */ new Map();
256
256
  function moduleIdFor(filename, root) {
257
257
  if (!root || !isAbsolute(filename)) return filename;
258
- const relativeId = relative(root, filename);
259
- const id = !relativeId.startsWith("..") && !relativeId.includes("node_modules/") ? relativeId : packageRootedModuleId(filename, root) ?? (outsideCheckout(filename, root) ? namedPackageModuleId(filename) : null) ?? relativeId;
258
+ const key = `${root}\0${filename}`;
259
+ let id = mintedIds.get(key);
260
+ if (id === void 0) {
261
+ const relativeId = relative(root, filename);
262
+ id = !relativeId.startsWith("..") && !relativeId.includes("node_modules/") ? relativeId : packageRootedModuleId(filename, root) ?? (outsideCheckout(filename, root) ? namedPackageModuleId(filename) : null) ?? relativeId;
263
+ mintedIds.set(key, id);
264
+ }
260
265
  mintedSources.set(`${root}\0${id}`, filename);
261
266
  return id;
262
267
  }
@@ -363,503 +368,6 @@ function rootRelativeId(id, root) {
363
368
  return `${prefix}${spelled === source ? moduleId : encodeURIComponent(moduleId)}${rest}`;
364
369
  }
365
370
  //#endregion
366
- //#region ../web/src/debug-channel.ts
367
- function installDebugChannelLayer(root, initialPhase, initiallyActive = true) {
368
- const global = globalThis;
369
- const previous = global.__MARKLESS_DEBUG__?.version === 1 ? global.__MARKLESS_DEBUG__ : void 0;
370
- let priorRoot;
371
- try {
372
- priorRoot = previous?.explainInteraction(root, "__markless_debug_root__");
373
- } catch {}
374
- const priorContainer = priorRoot && "containerId" in priorRoot ? previous?.containers.find((entry) => entry.id === priorRoot.containerId) : void 0;
375
- const seed = `${Date.now().toString(36)}:${Math.random().toString(36).slice(2)}`;
376
- const id = priorContainer?.id ?? `container:${seed}`;
377
- const rootKey = priorContainer?.root.key ?? `root:${seed}`;
378
- const rootRef = new WeakRef(root);
379
- const events = /* @__PURE__ */ new WeakMap();
380
- const delegatedEvents = /* @__PURE__ */ new Set();
381
- const keys = /* @__PURE__ */ new WeakMap();
382
- const invalidated = /* @__PURE__ */ new WeakSet();
383
- const routerSources = global[Symbol.for("markless.debug.channel.v1.router-sources")] ??= /* @__PURE__ */ new Set();
384
- const ownViolations = [];
385
- let phase = initialPhase;
386
- let lifecycle = initiallyActive ? "active" : "registered";
387
- let boundarySnapshots = Object.freeze([]);
388
- let nextElement = 1;
389
- let nextSequence = (previous?.violations.at(-1)?.sequence ?? 0) + 1;
390
- let dropped = 0;
391
- let pruned = false;
392
- const freeze = (value) => Object.freeze(value);
393
- const contains = (element) => {
394
- const currentRoot = rootRef.deref();
395
- return !!currentRoot && (currentRoot === element || currentRoot.contains?.(element) === true);
396
- };
397
- const keyFor = (element) => {
398
- let key = keys.get(element);
399
- if (!key) {
400
- key = `${rootKey}:element:${nextElement++}`;
401
- keys.set(element, key);
402
- }
403
- return key;
404
- };
405
- const eligibleAnchor = (element) => {
406
- const anchor = element.closest?.("a[href]");
407
- if (!anchor?.hasAttribute("data-markless-router-link") || anchor.hasAttribute("download")) return false;
408
- const target = anchor.getAttribute("target");
409
- if (target && target !== "_self" || anchor.relList?.contains("external")) return false;
410
- try {
411
- const base = global.location?.href ?? "http://localhost/";
412
- return new URL(anchor.href ?? "", base).origin === new URL(base).origin;
413
- } catch {
414
- return false;
415
- }
416
- };
417
- const none = (element, eventName, reason) => freeze({
418
- kind: "none",
419
- eventName,
420
- reason,
421
- containerId: id,
422
- elementKey: keyFor(element)
423
- });
424
- const explain = (element, eventName) => {
425
- if (lifecycle === "disposed" && (contains(element) || keys.has(element))) return none(element, eventName, "container-disposed");
426
- if (!contains(element)) try {
427
- return previous?.explainInteraction(element, eventName) ?? freeze({
428
- kind: "none",
429
- eventName,
430
- reason: "outside-known-container"
431
- });
432
- } catch {
433
- return freeze({
434
- kind: "none",
435
- eventName,
436
- reason: "outside-known-container"
437
- });
438
- }
439
- if (element.isConnected === false) return none(element, eventName, "element-disconnected");
440
- if (eligibleAnchor(element)) {
441
- const source = eventName === "navigate" && routerSources.has("navigation-event") ? "navigation-event" : eventName === "click" && routerSources.has("spa-click-listener") ? "spa-click-listener" : eventName === "click" && routerSources.has("ssr-link-bridge") ? "ssr-link-bridge" : void 0;
442
- if (source) return freeze({
443
- kind: "router-delegation",
444
- source,
445
- containerId: id,
446
- elementKey: keyFor(element),
447
- eventName
448
- });
449
- }
450
- const interaction = events.get(element)?.get(eventName);
451
- if (interaction) return freeze({ ...interaction });
452
- if (delegatedEvents.has(eventName)) return freeze({
453
- kind: "inline-resumer",
454
- source: "ssr-inline",
455
- containerId: id,
456
- elementKey: keyFor(element),
457
- eventName
458
- });
459
- if (invalidated.has(element)) return none(element, eventName, "not-registered");
460
- try {
461
- const prior = previous?.explainInteraction(element, eventName);
462
- if (prior && prior.kind !== "none") return prior;
463
- } catch {}
464
- return none(element, eventName, "not-registered");
465
- };
466
- const cloneJson = (value, seen = /* @__PURE__ */ new Set()) => {
467
- if (value === null) return null;
468
- if (typeof value === "boolean" || typeof value === "string") return value;
469
- if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
470
- if (!value || typeof value !== "object" || seen.has(value)) return void 0;
471
- seen.add(value);
472
- if (Array.isArray(value)) {
473
- const copy = value.map((entry) => cloneJson(entry, seen));
474
- return copy.some((entry) => entry === void 0) ? void 0 : freeze(copy);
475
- }
476
- if (Object.getPrototypeOf(value) !== Object.prototype) return void 0;
477
- const copy = {};
478
- for (const [name, entry] of Object.entries(value)) {
479
- const cloned = cloneJson(entry, seen);
480
- if (cloned === void 0) return void 0;
481
- copy[name] = cloned;
482
- }
483
- return freeze(copy);
484
- };
485
- const pushViolation = (input) => {
486
- const cloned = input.details === void 0 ? void 0 : cloneJson(input.details);
487
- const details = cloned && !Array.isArray(cloned) && typeof cloned === "object" ? cloned : void 0;
488
- const { details: _details, ...metadata } = input;
489
- ownViolations.push(freeze({
490
- ...metadata,
491
- ...details ? { details } : {},
492
- sequence: nextSequence++,
493
- timestamp: Date.now()
494
- }));
495
- if (input.details !== void 0 && !details) ownViolations.push(freeze({
496
- code: "MARKLESS_DEBUG_DETAILS_DROPPED",
497
- message: "Debug violation details were not JSON-safe and were dropped.",
498
- sequence: nextSequence++,
499
- timestamp: Date.now()
500
- }));
501
- while (ownViolations.length > 100) {
502
- ownViolations.shift();
503
- dropped++;
504
- }
505
- };
506
- const channel = freeze({
507
- version: 1,
508
- get containers() {
509
- const inherited = previous?.containers.filter((entry) => entry.id !== id) ?? [];
510
- if (pruned || lifecycle === "disposed") return freeze([...inherited]);
511
- const currentRoot = rootRef.deref();
512
- const connected = !!currentRoot && currentRoot.isConnected !== false;
513
- const snapshot = freeze({
514
- id,
515
- phase,
516
- lifecycle: connected ? lifecycle : "disposed",
517
- root: freeze({
518
- key: rootKey,
519
- connected
520
- }),
521
- boundaries: freeze([...boundarySnapshots])
522
- });
523
- if (!connected) pruned = true;
524
- return freeze([...inherited, snapshot]);
525
- },
526
- get violations() {
527
- return freeze([...previous?.violations ?? [], ...ownViolations].slice(-100));
528
- },
529
- violationCapacity: 100,
530
- get droppedViolationCount() {
531
- return (previous?.droppedViolationCount ?? 0) + dropped;
532
- },
533
- explainInteraction: explain
534
- });
535
- Object.defineProperty(global, "__MARKLESS_DEBUG__", {
536
- configurable: true,
537
- enumerable: false,
538
- value: channel,
539
- writable: false
540
- });
541
- return {
542
- start(nextPhase, active = true) {
543
- phase = nextPhase === "ssr-resume" && phase === "csr" ? "csr" : nextPhase;
544
- if (active) lifecycle = "active";
545
- return id;
546
- },
547
- activate: () => void (lifecycle === "disposed" || (lifecycle = "active")),
548
- dispose() {
549
- lifecycle = "disposed";
550
- boundarySnapshots = freeze([]);
551
- },
552
- invalidate(element) {
553
- events.delete(element);
554
- invalidated.add(element);
555
- },
556
- record(element, eventName, input) {
557
- if (lifecycle === "disposed") return;
558
- let byName = events.get(element);
559
- if (!byName) events.set(element, byName = /* @__PURE__ */ new Map());
560
- const symbolIds = "symbolIds" in input ? freeze([...input.symbolIds]) : void 0;
561
- byName.set(eventName, freeze({
562
- ...input,
563
- ...symbolIds ? { symbolIds } : {},
564
- containerId: id,
565
- elementKey: keyFor(element),
566
- eventName
567
- }));
568
- },
569
- delegated(eventNames) {
570
- if (lifecycle === "disposed") return;
571
- for (const eventName of eventNames) delegatedEvents.add(eventName);
572
- },
573
- violation: pushViolation,
574
- router: (source) => void routerSources.add(source),
575
- boundaries(value) {
576
- boundarySnapshots = freeze(value.map((entry) => freeze({ ...entry })));
577
- },
578
- disposed: () => lifecycle === "disposed"
579
- };
580
- }
581
- function __marklessDebugBootstrapSource() {
582
- return `((root,phase,active)=>{const controls=(${installDebugChannelLayer.toString()})(root,phase,active);return Object.freeze({record:(element,eventName,input)=>controls.record(element,eventName,input),delegated:(eventNames)=>controls.delegated(eventNames),router:(source)=>controls.router(source),activate:()=>controls.activate()})})`;
583
- }
584
- //#endregion
585
- //#region ../serializer/src/protocol-event-names.ts
586
- const PROTOCOL_VISIBLE_EVENT_NAME = "visible";
587
- const PROTOCOL_IDLE_EVENT_NAME$1 = "idle";
588
- //#endregion
589
- //#region ../serializer/src/protocol-locator-paths.ts
590
- /**
591
- * The container attribute that lets resume find each located element by its
592
- * position under its parent, so a node a third-party script adds or swaps
593
- * elsewhere cannot shift it. Format: protocol-locator-paths-format.ts.
594
- */
595
- const PROTOCOL_LOCATOR_PATHS_ATTRIBUTE = "data-markless-paths";
596
- //#endregion
597
- //#region ../serializer/src/protocol-event-host.ts
598
- /**
599
- * The attribute the server writes on each served element that hosts an event
600
- * record. The inline boot reads it from the event target up, so it finds a
601
- * press's handler and sync policy without parsing a payload or knowing the
602
- * element's position. Grammar: entries joined by `;`, each
603
- * `name[:ref][!policy]`, where `ref` is the record's index in its region's event
604
- * list (or `-` for an event an external delegate owns) and `policy` is `p`, `s`,
605
- * `ps` or an index into the container's sync-policy table.
606
- */
607
- const PROTOCOL_EVENT_HOST_ATTRIBUTE = "m:on";
608
- //#endregion
609
- //#region ../serializer/src/protocol-page-markers.ts
610
- const PROTOCOL_CONTAINER_START_COMMENT = "markless:page-start";
611
- const PROTOCOL_CONTAINER_END_COMMENT = "markless:page-end";
612
- //#endregion
613
- //#region ../web/src/inline/defer.ts
614
- const PROTOCOL_EVENT_HOST_SELECTOR = PROTOCOL_EVENT_HOST_ATTRIBUTE.replace(":", "\\:");
615
- /**
616
- * The one startup helper deferred triggers share. Serialized whole into a served
617
- * page that has one; a client mount and the runtime call it directly. Hosts are
618
- * the elements whose event host attribute (`hostSelector`, escaped for a CSS
619
- * attribute selector) names the lane's event with a record;
620
- * `ownsRoot` adds the container itself, which hands records the runtime owns
621
- * (arms, rows) to the runtime.
622
- */
623
- function createMarklessDefer(loadModule, pageStart, pageEnd, pathsAttribute, hostSelector) {
624
- const scope = globalThis;
625
- const clockOf = (root) => root.__mClock || {
626
- frame: (run) => requestAnimationFrame(run),
627
- idle: (run) => scope.scheduler?.postTask ? scope.scheduler.postTask(run, { priority: "background" }) : typeof requestIdleCallback === "function" ? requestIdleCallback(run, { timeout: 2e3 }) : setTimeout(run, 200)
628
- };
629
- const census = (root) => {
630
- const live = [root];
631
- const walker = document.createTreeWalker(root, 129);
632
- for (let next = walker.nextNode(); next; next = walker.nextNode()) if (next.nodeType !== 8) live.push(next);
633
- else if (next.data === pageStart) live.length = 1;
634
- else if (next.data === pageEnd) break;
635
- const paths = pathsAttribute && root.getAttribute?.(pathsAttribute);
636
- const order = paths && paths.split("|")[3];
637
- let signature = 0;
638
- if (order) for (const element of live.slice(1)) {
639
- const name = element.localName ?? element.tagName ?? "";
640
- signature = signature * 31 + name.length * 32 + (name.charCodeAt(0) | 32) | 0;
641
- }
642
- if (paths && (parseInt(paths) !== live.length || order && order !== (signature >>> 0).toString(36))) root.__marklessShifted = 1;
643
- return live;
644
- };
645
- const idle = (root, run) => {
646
- const clock = clockOf(root);
647
- const next = () => clock.idle(() => root.__marklessArmRegistering?.size ? next() : run());
648
- const loaded = () => clock.frame(() => scope.__mArm?.idle ? scope.__mArm.idle(next) : next());
649
- if (document.readyState === "complete") loaded();
650
- else addEventListener("load", loaded, { once: true });
651
- };
652
- const trigger = (target, lane, ownsRoot, eventName) => {
653
- const root = target;
654
- const url = document.currentScript?.getAttribute("data-markless-resume-module");
655
- if (!root || !url) return;
656
- const fired = root.__mFired ||= /* @__PURE__ */ new WeakSet();
657
- const claimed = /* @__PURE__ */ new WeakSet();
658
- let pending = 0;
659
- const claim = (host) => {
660
- if (fired.has(host) || claimed.has(host)) return;
661
- const input = {
662
- root,
663
- event: {
664
- type: eventName,
665
- target: host,
666
- bubbles: false
667
- },
668
- element: host
669
- };
670
- const queue = root.__marklessDispatch;
671
- if (!queue && root.__marklessDelegatedDispatch === true) return idle(root, () => claim(host));
672
- claimed.add(host);
673
- if (lane !== "visible") fired.add(host);
674
- root.__marklessCensus ||= census(root);
675
- root.__marklessDelegatedDispatch ||= eventName;
676
- pending++;
677
- (queue ? Promise.resolve(queue(input)) : (root.__mResume ||= loadModule(url)).then((module) => module.resumeContainerEvent(input))).then(() => {
678
- if (root.__asyncResumeRuntimeStarted) return;
679
- fired.add(host);
680
- if (!--pending && root.__marklessDelegatedDispatch === eventName) root.__marklessDelegatedDispatch = void 0;
681
- });
682
- };
683
- const hosts = ownsRoot ? [root] : [];
684
- hosts.push(...root.querySelectorAll(`[${hostSelector}^="${eventName}:"],[${hostSelector}*=";${eventName}:"]`));
685
- if (lane === "idle") return idle(root, () => hosts.forEach(claim));
686
- const observer = new IntersectionObserver((entries) => {
687
- for (const entry of entries) if (entry.isIntersecting) {
688
- observer.unobserve(entry.target);
689
- claim(entry.target);
690
- }
691
- });
692
- for (const host of hosts) observer.observe(host);
693
- };
694
- return Object.assign(trigger, { idle });
695
- }
696
- const INLINE_DEFER_LOADER_SOURCE = "(url) => import(/* @vite-ignore */ url)";
697
- /** An expression that installs the helper once per document and evaluates to it; a build passes the factory minified. */
698
- function inlineDeferSource(factory = createMarklessDefer.toString()) {
699
- return `(globalThis.__mDefer||=(${factory})(${INLINE_DEFER_LOADER_SOURCE},${JSON.stringify(PROTOCOL_CONTAINER_START_COMMENT)},${JSON.stringify(PROTOCOL_CONTAINER_END_COMMENT)},${JSON.stringify(PROTOCOL_LOCATOR_PATHS_ATTRIBUTE)},${JSON.stringify(PROTOCOL_EVENT_HOST_SELECTOR)}))`;
700
- }
701
- /** One lane's registration, appended only to a served page whose records name that lane's event. */
702
- function createInlineDeferTriggerSource(lane, ownsRoot) {
703
- const eventName = lane === "idle" ? PROTOCOL_IDLE_EVENT_NAME$1 : PROTOCOL_VISIBLE_EVENT_NAME;
704
- return `;${inlineDeferSource()}(document.currentScript?.closest('[data-async-container]'),${JSON.stringify(lane)},${ownsRoot ? 1 : 0},${JSON.stringify(eventName)});`;
705
- }
706
- //#endregion
707
- //#region src/inline-resumer.ts
708
- let oxcToolsPromise;
709
- const compiledSources = /* @__PURE__ */ new Map();
710
- function loadOxcTools() {
711
- oxcToolsPromise ??= import("rolldown/experimental").then(({ minifySync, transformSync }) => ({
712
- minifySync,
713
- transformSync
714
- }));
715
- return oxcToolsPromise;
716
- }
717
- function compileInlineResumerSources(options) {
718
- const cacheKey = `${options.debug ? "debug" : "production"}:${options.executionLog}`;
719
- let compiled = compiledSources.get(cacheKey);
720
- if (!compiled) {
721
- compiled = compileInlineResumerSourceVariants(options);
722
- compiledSources.set(cacheKey, compiled);
723
- }
724
- return compiled;
725
- }
726
- async function compileInlineResumerSourceVariants(options) {
727
- const shared = {
728
- debug: options.debug,
729
- executionLog: options.executionLog
730
- };
731
- const [event, syncPolicy, graphSyncPolicyOwner, graphSyncPolicyConsumer] = await Promise.all([
732
- compileInlineResumerSource({
733
- ...shared,
734
- graphSyncPolicy: false,
735
- sharedGraphPolicy: false,
736
- syncPolicy: false
737
- }),
738
- compileInlineResumerSource({
739
- ...shared,
740
- graphSyncPolicy: false,
741
- sharedGraphPolicy: false,
742
- syncPolicy: true
743
- }),
744
- compileInlineResumerSource({
745
- ...shared,
746
- graphSyncPolicy: true,
747
- sharedGraphPolicy: true,
748
- syncPolicy: true
749
- }),
750
- compileInlineResumerSource({
751
- ...shared,
752
- graphSyncPolicy: true,
753
- sharedGraphPolicy: false,
754
- syncPolicy: true
755
- })
756
- ]);
757
- const defer = await compileDeferFactorySource();
758
- return {
759
- ...shared,
760
- event,
761
- syncPolicy,
762
- graphSyncPolicyOwner,
763
- graphSyncPolicyConsumer,
764
- defer
765
- };
766
- }
767
- async function compileDeferFactorySource() {
768
- const binding = "var __marklessDeferFactory=";
769
- const { minifySync, transformSync } = await loadOxcTools();
770
- const transformed = transformSync("markless-defer.js", `${binding}${createMarklessDefer.toString()};`, {
771
- lang: "js",
772
- sourceType: "script",
773
- target: "es2020"
774
- });
775
- assertOxcResult("transform", transformed.errors);
776
- const minified = minifySync("markless-defer.js", transformed.code, {
777
- compress: true,
778
- mangle: { toplevel: false },
779
- module: false
780
- });
781
- assertOxcResult("minify", minified.errors);
782
- const code = minified.code.trim().replace(/;$/, "");
783
- if (!code.startsWith(binding)) throw new Error("MARKLESS_INLINE_DEFER_FACTORY_UNWRAPPABLE");
784
- return code.slice(27);
785
- }
786
- async function compileInlineResumerSource(options) {
787
- const source = createInlineResumerSource({
788
- ...options,
789
- ...options.debug ? {
790
- debugBootstrapSource: __marklessDebugBootstrapSource(),
791
- debugRegistrationSource: createInlineResumerDebugRegistrationSource()
792
- } : {}
793
- });
794
- const { minifySync, transformSync } = await loadOxcTools();
795
- const transformed = transformSync("markless-inline-resumer.js", source, {
796
- lang: "js",
797
- sourceType: "script",
798
- target: "es2020"
799
- });
800
- assertOxcResult("transform", transformed.errors);
801
- const minified = minifySync("markless-inline-resumer.js", transformed.code, {
802
- compress: true,
803
- mangle: { toplevel: true },
804
- module: false
805
- });
806
- assertOxcResult("minify", minified.errors);
807
- const code = minified.code.trim();
808
- if (!code.includes(INLINE_RESUMER_PAGE_TOKEN)) throw new Error("MARKLESS_INLINE_RESUMER_PAGE_TOKEN_FOLDED");
809
- return code;
810
- }
811
- function assertOxcResult(phase, errors) {
812
- if (errors.length === 0) return;
813
- throw new Error(`MARKLESS_INLINE_RESUMER_${phase.toUpperCase()}_FAILED:\n${errors.map((error) => error.message).join("\n")}`);
814
- }
815
- const compiledPrerenderSources = /* @__PURE__ */ new Map();
816
- function compilePrerenderInlineResumerSources() {
817
- let compiled = compiledPrerenderSources.get("production");
818
- if (!compiled) {
819
- compiled = compilePrerenderVariants();
820
- compiledPrerenderSources.set("production", compiled);
821
- }
822
- return compiled;
823
- }
824
- async function compilePrerenderVariants() {
825
- const [prerender, prerenderSelfWake, prerenderSettle] = await Promise.all([
826
- compilePrerenderInlineResumerSource(false),
827
- compilePrerenderInlineResumerSource(true),
828
- compilePrerenderInlineResumerSource("settle")
829
- ]);
830
- return {
831
- prerender,
832
- prerenderSelfWake,
833
- prerenderSettle
834
- };
835
- }
836
- async function compilePrerenderInlineResumerSource(selfWake) {
837
- const source = parameterizedPrerenderInlineResumerSource(selfWake);
838
- const { minifySync, transformSync } = await loadOxcTools();
839
- const transformed = transformSync("markless-prerender-inline-resumer.js", source, {
840
- lang: "js",
841
- sourceType: "script",
842
- target: "es2020"
843
- });
844
- assertOxcResult("transform", transformed.errors);
845
- const minified = minifySync("markless-prerender-inline-resumer.js", transformed.code, {
846
- compress: true,
847
- mangle: { toplevel: true },
848
- module: false
849
- });
850
- assertOxcResult("minify", minified.errors);
851
- const code = minified.code.trim();
852
- if (code.split(PRERENDER_INLINE_EVENT_NAMES_TOKEN).length !== 2) throw new Error("MARKLESS_PRERENDER_INLINE_RESUMER_EVENT_NAMES_TOKEN_LOST");
853
- return code;
854
- }
855
- function parameterizedPrerenderInlineResumerSource(selfWake) {
856
- const placeholder = [PRERENDER_INLINE_EVENT_NAMES_TOKEN];
857
- const literal = JSON.stringify(placeholder);
858
- const plain = selfWake === "settle" ? createPrerenderSettleInlineResumerSource(placeholder, void 0) : createPrerenderInlineResumerSource(placeholder, void 0);
859
- if (plain.split(literal).length !== 2) throw new Error("MARKLESS_PRERENDER_INLINE_RESUMER_EVENT_NAMES_UNPLACEABLE");
860
- return `${plain.replace(literal, PRERENDER_INLINE_EVENT_NAMES_TOKEN)}${selfWake === true ? createInlineResumerSelfWakeSource(void 0) : ""}`;
861
- }
862
- //#endregion
863
371
  //#region src/build/symbol-bundles.ts
864
372
  const SYMBOL_BUNDLE_VIRTUAL_PREFIX = `${MARKLESS_VIRTUAL_PREFIX}symbol-bundle:`;
865
373
  function symbolBundleVirtualModuleId(filename, index) {
@@ -1292,6 +800,10 @@ async function transformTsrxModuleWithPrerenderWakeClosure(input, linkedChildHas
1292
800
  storageSeeds: storageSeeds.length > 0 ? storageSeeds : void 0,
1293
801
  inlineResumerSources,
1294
802
  prerenderBoot,
803
+ ...input.environment === "server" ? { sharedInlineSourcesModuleId: sharedInlineSourcesModuleId({
804
+ debug: input.inlineResumerDebug === true,
805
+ executionLog: input.executionLog ?? "never"
806
+ }) } : {},
1295
807
  devResumeReexport: input.devResumeReexport === true,
1296
808
  needsFullResume: prerenderClosureNeedsWake,
1297
809
  prerenderRecords: input.prerenderRecords,
@@ -1666,32 +1178,62 @@ function authorsPendingArm(markup) {
1666
1178
  }
1667
1179
  //#endregion
1668
1180
  //#region src/build/chunk-ast.ts
1181
+ const UNNAMED_CHUNK = "chunk.js";
1669
1182
  const parsedByExtension = /* @__PURE__ */ new Map();
1183
+ const PARSED_CHUNK_CACHE_MAX_CODE_LENGTH = 16777216;
1184
+ let cachedCodeLength = 0;
1185
+ const codeByFile = /* @__PURE__ */ new Map();
1670
1186
  function parsedFor(fileName) {
1671
1187
  const extension = fileName.slice(fileName.lastIndexOf("."));
1672
1188
  let parsed = parsedByExtension.get(extension);
1673
1189
  if (!parsed) parsedByExtension.set(extension, parsed = /* @__PURE__ */ new Map());
1674
1190
  return parsed;
1675
1191
  }
1676
- function parseChunkCode(fileName, code) {
1192
+ const renderedChunkCounts = /* @__PURE__ */ new WeakMap();
1193
+ function renderedChunkCount(chunks) {
1194
+ let count = renderedChunkCounts.get(chunks);
1195
+ if (count === void 0) renderedChunkCounts.set(chunks, count = Object.keys(chunks).length);
1196
+ return count;
1197
+ }
1198
+ function forgetSuperseded(fileName, code) {
1199
+ const previous = codeByFile.get(fileName);
1200
+ if (previous === void 0 || previous === code) return;
1201
+ if (parsedFor(fileName).delete(previous)) cachedCodeLength -= previous.length;
1202
+ codeByFile.delete(fileName);
1203
+ }
1204
+ function admits(fileName, code) {
1205
+ if (fileName !== UNNAMED_CHUNK) forgetSuperseded(fileName, code);
1206
+ return cachedCodeLength + code.length <= PARSED_CHUNK_CACHE_MAX_CODE_LENGTH;
1207
+ }
1208
+ function remember(fileName, code, result) {
1677
1209
  const parsed = parsedFor(fileName);
1678
- let result = parsed.get(code);
1679
- if (!result) parsed.set(code, result = parseSync(fileName, code));
1210
+ if (parsed.has(code)) return;
1211
+ if (fileName !== UNNAMED_CHUNK) codeByFile.set(fileName, code);
1212
+ parsed.set(code, result);
1213
+ cachedCodeLength += code.length;
1214
+ }
1215
+ function parseChunkCode(fileName, code) {
1216
+ const cached = parsedFor(fileName).get(code);
1217
+ if (cached) return cached;
1218
+ const result = parseSync(fileName, code);
1219
+ if (admits(fileName, code)) remember(fileName, code, result);
1680
1220
  return result;
1681
1221
  }
1682
1222
  async function prefetchChunkParses(chunks) {
1683
1223
  const pending = [];
1224
+ let reserved = 0;
1684
1225
  for (const { fileName, code } of chunks) {
1685
- const parsed = parsedFor(fileName);
1686
- if (parsed.has(code)) continue;
1687
- pending.push(parse(fileName, code).then((result) => {
1688
- if (!parsed.has(code)) parsed.set(code, result);
1689
- }, () => {}));
1226
+ if (parsedFor(fileName).has(code)) continue;
1227
+ if (!admits(fileName, code) || cachedCodeLength + reserved + code.length > 16777216) continue;
1228
+ reserved += code.length;
1229
+ pending.push(parse(fileName, code).then((result) => remember(fileName, code, result), () => {}));
1690
1230
  }
1691
1231
  await Promise.all(pending);
1692
1232
  }
1693
1233
  function clearParsedChunkCode() {
1694
1234
  parsedByExtension.clear();
1235
+ codeByFile.clear();
1236
+ cachedCodeLength = 0;
1695
1237
  }
1696
1238
  function mayContainDynamicImport(code) {
1697
1239
  for (let index = code.indexOf("import"); index >= 0; index = code.indexOf("import", index + 1)) {
@@ -2055,8 +1597,9 @@ const MARKLESS_CHUNK_SPECIFIER_PREFIX = "@markless/c/";
2055
1597
  const SPECIFIER_KEY_LENGTH = 8;
2056
1598
  const PATH_CHARACTER = /[\w\-./~%@+]/;
2057
1599
  /**
2058
- * Rewrites every quoted reference to another hashed chunk (`./chunk-x.js`, `/base/build/chunk-x.js`)
2059
- * into a stable bare specifier, so a chunk's bytes stop depending on the names of the chunks it loads.
1600
+ * Rewrites every quoted reference to a hashed chunk several pages load (`./chunk-x.js`, `/base/build/chunk-x.js`)
1601
+ * into a stable bare specifier, so a shared chunk's new bytes rename only itself. A chunk one page loads keeps
1602
+ * its path and renames that page's chunks, which keeps the document's import map to the shared chunks.
2060
1603
  * References in any other shape keep the file name and stay covered by the content-hash rename.
2061
1604
  */
2062
1605
  async function specifyChunkReferences(bundle, options) {
@@ -2071,19 +1614,42 @@ async function specifyChunkReferences(bundle, options) {
2071
1614
  const matcher = basenameMatcher(hashed.values());
2072
1615
  const keys = await specifierKeys([...hashed.keys()], options.root);
2073
1616
  const specified = /* @__PURE__ */ new Set();
2074
- if (matcher) for (const chunk of chunks) {
2075
- let code = "";
2076
- let cursor = 0;
2077
- for (const match of chunk.code.matchAll(matcher)) {
2078
- const target = byBasename.get(match[0]);
2079
- if (!target) continue;
2080
- const span = quotedReference(chunk, target, match.index, match[0].length, options);
2081
- if (!span || span.start < cursor) continue;
2082
- code += chunk.code.slice(cursor, span.start) + keys.get(target);
2083
- cursor = span.end;
2084
- specified.add(target);
1617
+ if (matcher) {
1618
+ const references = /* @__PURE__ */ new Map();
1619
+ const importers = /* @__PURE__ */ new Map();
1620
+ for (const chunk of chunks) {
1621
+ const found = [];
1622
+ let cursor = 0;
1623
+ for (const match of chunk.code.matchAll(matcher)) {
1624
+ const target = byBasename.get(match[0]);
1625
+ if (!target) continue;
1626
+ const span = quotedReference(chunk, target, match.index, match[0].length, options);
1627
+ if (!span || span.start < cursor) continue;
1628
+ found.push({
1629
+ target,
1630
+ ...span
1631
+ });
1632
+ cursor = span.end;
1633
+ if (target !== chunk) {
1634
+ const set = importers.get(target) ?? /* @__PURE__ */ new Set();
1635
+ set.add(chunk);
1636
+ importers.set(target, set);
1637
+ }
1638
+ }
1639
+ references.set(chunk, found);
1640
+ }
1641
+ const named = namedBySpecifier(chunks, references, importers, options);
1642
+ for (const chunk of chunks) {
1643
+ let code = "";
1644
+ let cursor = 0;
1645
+ for (const { target, start, end } of references.get(chunk)) {
1646
+ if (!named(target)) continue;
1647
+ code += chunk.code.slice(cursor, start) + keys.get(target);
1648
+ cursor = end;
1649
+ specified.add(target);
1650
+ }
1651
+ if (cursor > 0) chunk.code = code + chunk.code.slice(cursor);
2085
1652
  }
2086
- if (cursor > 0) chunk.code = code + chunk.code.slice(cursor);
2087
1653
  }
2088
1654
  return { importMap() {
2089
1655
  const imports = {};
@@ -2091,6 +1657,76 @@ async function specifyChunkReferences(bundle, options) {
2091
1657
  return { imports };
2092
1658
  } };
2093
1659
  }
1660
+ const SHARED = "\0shared";
1661
+ function moduleSourceFile(id, root) {
1662
+ let bare = id.startsWith("\0") ? id.slice(1) : id;
1663
+ const virtual = /^virtual:markless:[\w-]+:(.*)$/.exec(bare);
1664
+ if (virtual) {
1665
+ bare = virtual[1].replace(/:\d+$/, "");
1666
+ try {
1667
+ bare = decodeURIComponent(bare);
1668
+ } catch {}
1669
+ }
1670
+ return withoutMachinePaths(bare.replace(/[?#].*$/, ""), root);
1671
+ }
1672
+ function chunkModuleIds(chunk) {
1673
+ return chunk.moduleIds?.length ? chunk.moduleIds : chunk.facadeModuleId ? [chunk.facadeModuleId] : [];
1674
+ }
1675
+ function chunkPage(chunk, options) {
1676
+ const ids = chunkModuleIds(chunk);
1677
+ const { packs, isRoute, root } = options;
1678
+ if (packs) {
1679
+ const names = new Set(ids.map((id) => startupPackOfLazy(packs.packOf(id) ?? "").replace(/~\d+$/, "")));
1680
+ const [pack] = names;
1681
+ if (names.size === 1 && pack) {
1682
+ const page = /^(?:route|navigation):(?!shared(?::|$))(.+)$/.exec(pack)?.[1];
1683
+ if (page) return page;
1684
+ const routes = pack.startsWith("shared:") ? packs.packRoutes(pack) : void 0;
1685
+ return routes?.length === 1 ? routes[0] : SHARED;
1686
+ }
1687
+ }
1688
+ const sources = new Set(ids.map((id) => moduleSourceFile(id, root)));
1689
+ const [only] = sources;
1690
+ return sources.size === 1 && isRoute?.(only) ? only : void 0;
1691
+ }
1692
+ function namedBySpecifier(chunks, references, importers, options) {
1693
+ if (!options.isRoute && !options.packs) return () => true;
1694
+ const page = /* @__PURE__ */ new Map();
1695
+ for (const chunk of chunks) {
1696
+ const owner = chunkPage(chunk, options);
1697
+ if (owner) page.set(chunk, owner);
1698
+ }
1699
+ const hubs = /* @__PURE__ */ new Set();
1700
+ for (const chunk of chunks) {
1701
+ const pages = /* @__PURE__ */ new Set();
1702
+ for (const { target } of references.get(chunk) ?? []) {
1703
+ const owner = page.get(target);
1704
+ if (owner && owner !== SHARED) pages.add(owner);
1705
+ }
1706
+ if (pages.size > 1) hubs.add(chunk);
1707
+ }
1708
+ const loadedBy = (chunk) => [...importers.get(chunk) ?? []].filter((importer) => !hubs.has(importer));
1709
+ const owners = /* @__PURE__ */ new Map();
1710
+ for (const chunk of chunks) {
1711
+ const own = page.get(chunk);
1712
+ owners.set(chunk, new Set(own ? [own] : loadedBy(chunk).length === 0 ? [SHARED] : []));
1713
+ }
1714
+ for (let changed = true; changed;) {
1715
+ changed = false;
1716
+ for (const chunk of chunks) {
1717
+ const set = owners.get(chunk);
1718
+ if (set.has(SHARED)) continue;
1719
+ const before = set.size;
1720
+ for (const importer of loadedBy(chunk)) for (const owner of owners.get(importer)) set.add(owner);
1721
+ if (set.size > 1) {
1722
+ set.clear();
1723
+ set.add(SHARED);
1724
+ }
1725
+ if (set.size !== before) changed = true;
1726
+ }
1727
+ }
1728
+ return (target) => owners.get(target).size !== 1 || owners.get(target).has(SHARED);
1729
+ }
2094
1730
  function quotedReference(importer, target, index, length, options) {
2095
1731
  const code = importer.code;
2096
1732
  let start = index;
@@ -2544,7 +2180,7 @@ function lazyModuleFacadesPlugin(root = () => "", packOf, packRoutes, eagerLazyR
2544
2180
  resolve,
2545
2181
  reject
2546
2182
  });
2547
- if (pending.size !== Object.keys(meta.chunks).length) return;
2183
+ if (pending.size !== renderedChunkCount(meta.chunks)) return;
2548
2184
  const collapse = () => {
2549
2185
  try {
2550
2186
  const results = /* @__PURE__ */ new Map();
@@ -3267,17 +2903,37 @@ function planShortExportNames(chunks) {
3267
2903
  };
3268
2904
  }
3269
2905
  function namedInStrings(strings, fileNames) {
3270
- const texts = /* @__PURE__ */ new Map();
3271
- return fileNames.filter((fileName) => {
3272
- const base = fileName.slice(fileName.lastIndexOf("/") + 1);
3273
- const extension = base.includes(".") ? base.slice(base.lastIndexOf(".")) : "";
3274
- let text = texts.get(extension);
3275
- if (text === void 0) {
3276
- text = strings.filter((value) => value.includes(extension)).join("\n");
3277
- texts.set(extension, text);
3278
- }
3279
- return text.includes(base);
3280
- });
2906
+ const baseOf = (fileName) => fileName.slice(fileName.lastIndexOf("/") + 1);
2907
+ const byExtension = /* @__PURE__ */ new Map();
2908
+ const bare = [];
2909
+ for (const fileName of fileNames) {
2910
+ const base = baseOf(fileName);
2911
+ if (!base.includes(".")) {
2912
+ bare.push(base);
2913
+ continue;
2914
+ }
2915
+ const extension = base.slice(base.lastIndexOf("."));
2916
+ const bases = byExtension.get(extension) ?? /* @__PURE__ */ new Set();
2917
+ bases.add(base);
2918
+ byExtension.set(extension, bases);
2919
+ }
2920
+ const found = /* @__PURE__ */ new Set();
2921
+ for (const [extension, bases] of byExtension) {
2922
+ const lengths = [...new Set([...bases].map((base) => base.length))];
2923
+ for (const value of strings) for (let at = value.indexOf(extension); at !== -1; at = value.indexOf(extension, at + 1)) {
2924
+ const end = at + extension.length;
2925
+ for (const length of lengths) {
2926
+ if (length > end) continue;
2927
+ const candidate = value.slice(end - length, end);
2928
+ if (bases.has(candidate)) found.add(candidate);
2929
+ }
2930
+ }
2931
+ }
2932
+ if (bare.length) {
2933
+ const text = strings.join("\n");
2934
+ for (const base of bare) if (text.includes(base)) found.add(base);
2935
+ }
2936
+ return fileNames.filter((fileName) => found.has(baseOf(fileName)));
3281
2937
  }
3282
2938
  /** Deterministic: each name is the shortest prefix of its own hash that no other name in the set shares. */
3283
2939
  function shortNames(names, taken = /* @__PURE__ */ new Set()) {
@@ -3320,7 +2976,7 @@ function shortExportNamesPlugin(removedChunks = () => /* @__PURE__ */ new Set())
3320
2976
  resolve,
3321
2977
  reject
3322
2978
  });
3323
- if (pending.size !== Object.keys(meta.chunks).length) return;
2979
+ if (pending.size !== renderedChunkCount(meta.chunks)) return;
3324
2980
  try {
3325
2981
  const plan = planShortExportNames([...pending.values()].map((item) => item.chunk));
3326
2982
  exports = new Map(plan.exports);
@@ -3749,6 +3405,11 @@ function withUndemandedReExportDoors(modules, undemanded) {
3749
3405
  }
3750
3406
  return result;
3751
3407
  }
3408
+ //#endregion
3409
+ //#region src/build/interaction-closures.ts
3410
+ function isAuthoredLazyImport(id) {
3411
+ return !isCompilerStatefulModuleId(id) && !isMarklessRuntimeModule(id) && !/^\0|^virtual:|\.mdx(?:$|\?)|[\\/]@markless[\\/]/.test(id) && runtimeModuleIdFromOrigin(id.split("?")[0]) === void 0;
3412
+ }
3752
3413
  const RUNS_WITHOUT_INPUT = {
3753
3414
  "async-boundary": true,
3754
3415
  behavior: true,
@@ -3785,6 +3446,7 @@ function computeInteractionClosures(input) {
3785
3446
  for (const [route, ids] of input.routes) for (const id of ids) routeOf.set(id, route);
3786
3447
  const knownRuntimeIds = /* @__PURE__ */ new Set();
3787
3448
  for (const merged of demand.values()) for (const id of merged.unknownRecordModuleIds) knownRuntimeIds.add(id);
3449
+ const sharedClosures = /* @__PURE__ */ new Map();
3788
3450
  const useClosure = (route, reach, seeds, bound, named) => {
3789
3451
  const seen = /* @__PURE__ */ new Set();
3790
3452
  const pending = [...seeds].map((id) => [id, void 0]);
@@ -3803,6 +3465,7 @@ function computeInteractionClosures(input) {
3803
3465
  for (const dependency of module.dependencies) pending.push([dependency, inside]);
3804
3466
  for (const target of module.dynamicDependencies ?? []) {
3805
3467
  if (routeOf.has(target) && routeOf.get(target) !== (inside ?? route)) continue;
3468
+ if (!routeOf.has(target) && isAuthoredLazyImport(target)) continue;
3806
3469
  if (!bound) {
3807
3470
  pending.push([target, inside]);
3808
3471
  continue;
@@ -3814,7 +3477,12 @@ function computeInteractionClosures(input) {
3814
3477
  pending.push([target, inside]);
3815
3478
  }
3816
3479
  }
3817
- return [...seen].sort();
3480
+ const ids = [...seen].sort();
3481
+ const key = ids.join("\0");
3482
+ const shared = sharedClosures.get(key);
3483
+ if (shared) return shared;
3484
+ sharedClosures.set(key, ids);
3485
+ return ids;
3818
3486
  };
3819
3487
  const result = [];
3820
3488
  for (const route of [...input.routes.keys()].sort()) {
@@ -3868,6 +3536,13 @@ function computeInteractionClosures(input) {
3868
3536
  const bootRoots = roots.filter((id) => !isSymbolModule(id) && !renderRoots.includes(id));
3869
3537
  const landingReach = useClosure(route, reach, roots.filter((id) => !renderRoots.includes(id)));
3870
3538
  const page = pageIndex(files, demand);
3539
+ const actionClosures = /* @__PURE__ */ new Map();
3540
+ const actionClosure = (seeds, runtimeIds) => {
3541
+ const key = `${[...seeds].join("\0")}\u0001${[...runtimeIds].sort().join("\0")}`;
3542
+ let ids = actionClosures.get(key);
3543
+ if (!ids) actionClosures.set(key, ids = useClosure(route, reach, seeds, { runtimeIds }, seeds));
3544
+ return ids;
3545
+ };
3871
3546
  const resume = joinPage(page.resume, page);
3872
3547
  const bootSeeds = new Set(bootRoots);
3873
3548
  let bootBounded = resume !== "unknown" && [...files].every((file) => !demand.get(file).replaced);
@@ -3949,7 +3624,7 @@ function computeInteractionClosures(input) {
3949
3624
  kind: "action",
3950
3625
  ...conservative ? { conservative } : {},
3951
3626
  ...lean ? { lean: true } : {},
3952
- modules: useClosure(route, reach, seeds, { runtimeIds }, seeds)
3627
+ modules: actionClosure(seeds, runtimeIds)
3953
3628
  });
3954
3629
  }
3955
3630
  }
@@ -3968,9 +3643,32 @@ function interactionClosuresAsset(input) {
3968
3643
  };
3969
3644
  const packs = /* @__PURE__ */ new Map();
3970
3645
  for (const [id, name] of input.packs) push(packs, name, display(id, input.root));
3646
+ const displayed = /* @__PURE__ */ new Map();
3647
+ for (const route of input.closures) for (const consumer of route.consumers) for (const id of consumer.modules) if (!displayed.has(id)) displayed.set(id, display(id, input.root));
3648
+ const modules = [...new Set(displayed.values())].sort();
3649
+ const moduleIndex = new Map(modules.map((id, index) => [id, index]));
3650
+ const closureSets = [];
3651
+ const closureIndex = /* @__PURE__ */ new Map();
3652
+ const closureByKey = /* @__PURE__ */ new Map();
3653
+ const closureOf = (ids) => {
3654
+ const known = closureIndex.get(ids);
3655
+ if (known !== void 0) return known;
3656
+ const indexes = [...new Set(ids.map((id) => moduleIndex.get(displayed.get(id))))].sort((a, b) => a - b);
3657
+ const key = indexes.join(",");
3658
+ let index = closureByKey.get(key);
3659
+ if (index === void 0) {
3660
+ index = closureSets.length;
3661
+ closureSets.push(indexes);
3662
+ closureByKey.set(key, index);
3663
+ }
3664
+ closureIndex.set(ids, index);
3665
+ return index;
3666
+ };
3971
3667
  return JSON.stringify({
3972
- version: 1,
3668
+ version: 2,
3973
3669
  partition: input.partition,
3670
+ modules,
3671
+ closures: closureSets,
3974
3672
  routes: input.closures.map((route) => ({
3975
3673
  route: route.route,
3976
3674
  ...route.fallback ? { fallback: route.fallback } : {},
@@ -3983,7 +3681,7 @@ function interactionClosuresAsset(input) {
3983
3681
  kind: consumer.kind,
3984
3682
  ...consumer.conservative ? { conservative: consumer.conservative } : {},
3985
3683
  ...consumer.lean ? { lean: true } : {},
3986
- modules: consumer.modules.map((id) => display(id, input.root)).sort()
3684
+ closure: closureOf(consumer.modules)
3987
3685
  }))
3988
3686
  })),
3989
3687
  packs: Object.fromEntries([...packs].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, ids]) => [name, ids.sort()])),
@@ -4219,6 +3917,10 @@ function nativePackingPlugins(root, demandMaps = () => [], demandSources = () =>
4219
3917
  return [
4220
3918
  {
4221
3919
  name: "markless:route-packs",
3920
+ api: {
3921
+ packOf: (id) => groups.get(id),
3922
+ packRoutes: (pack) => routeSets.get(pack)
3923
+ },
4222
3924
  options(input) {
4223
3925
  return {
4224
3926
  ...input,
@@ -4429,12 +4131,13 @@ function resolverVirtualModuleId(source) {
4429
4131
  }
4430
4132
  function linkedClaims(metadata, sources, environment, unawaited = /* @__PURE__ */ new Set()) {
4431
4133
  for (const source of sources) if (!unawaited.has(source)) metadata.assertSourceClaimsSealed(environment, source);
4134
+ const requests = sources.map((source) => ({
4135
+ source,
4136
+ resolverId: resolverVirtualModuleId(source)
4137
+ }));
4432
4138
  return linkClaimManifests({
4433
- byEmittedModule: metadata.symbolClaimMap(),
4434
- sources: sources.map((source) => ({
4435
- source,
4436
- resolverId: resolverVirtualModuleId(source)
4437
- }))
4139
+ byEmittedModule: metadata.symbolClaimMapForResolvers(requests.map((request) => request.resolverId)),
4140
+ sources: requests
4438
4141
  });
4439
4142
  }
4440
4143
  function sourceSymbolManifest(metadata, source, environment, unawaited) {
@@ -4877,6 +4580,8 @@ function createBuildDelegateLoader() {
4877
4580
  async function moduleCode(id, resolve, root) {
4878
4581
  const virtual = virtualSources.get(normalizeVirtualId$2(id));
4879
4582
  if (virtual !== void 0) return virtual;
4583
+ const sharedInlineSources = await sharedInlineSourcesModuleSource(normalizeVirtualId$2(id));
4584
+ if (sharedInlineSources !== null) return sharedInlineSources;
4880
4585
  const file = pathname$1(id);
4881
4586
  const source = await readFile(file, "utf8");
4882
4587
  if (!isTsrxModule(file)) return await stripEmittedTypes(source, file);
@@ -4893,6 +4598,7 @@ function createBuildDelegateLoader() {
4893
4598
  }
4894
4599
  async function importSpecifier(specifier, importer, resolve, root) {
4895
4600
  const virtualId = normalizeVirtualId$2(specifier);
4601
+ if (isSharedInlineSourcesModuleId(virtualId)) return await load(virtualId, resolve, root);
4896
4602
  const virtualOwner = marklessVirtualModuleSourceFile(virtualId, root);
4897
4603
  if (virtualOwner) {
4898
4604
  if (!virtualSources.has(virtualId)) await load(virtualOwner, resolve, root);
@@ -4968,6 +4674,9 @@ function publicationKey(environment, source) {
4968
4674
  var ModuleMetadataRegistry = class ModuleMetadataRegistry {
4969
4675
  #captureManifestsBySource = /* @__PURE__ */ new Map();
4970
4676
  #symbolClaimsByEmittedModule = /* @__PURE__ */ new Map();
4677
+ #claimOwnersByResolver = /* @__PURE__ */ new Map();
4678
+ #claimOrder = /* @__PURE__ */ new Map();
4679
+ #nextClaimOrder = 0;
4971
4680
  #sourceClaimPublications = /* @__PURE__ */ new Map();
4972
4681
  #waits = /* @__PURE__ */ new Map();
4973
4682
  #publication(environment, source) {
@@ -5008,6 +4717,8 @@ var ModuleMetadataRegistry = class ModuleMetadataRegistry {
5008
4717
  clear() {
5009
4718
  this.#captureManifestsBySource.clear();
5010
4719
  this.#symbolClaimsByEmittedModule.clear();
4720
+ this.#claimOwnersByResolver.clear();
4721
+ this.#claimOrder.clear();
5011
4722
  this.#sourceClaimPublications.clear();
5012
4723
  this.#waits.clear();
5013
4724
  }
@@ -5022,11 +4733,28 @@ var ModuleMetadataRegistry = class ModuleMetadataRegistry {
5022
4733
  this.#captureManifestsBySource.delete(source);
5023
4734
  }
5024
4735
  recordSymbolClaims(emittedModule, manifest) {
4736
+ const previous = this.#symbolClaimsByEmittedModule.get(emittedModule);
4737
+ if (previous) this.#unindexClaimOwner(emittedModule, previous);
4738
+ else this.#claimOrder.set(emittedModule, this.#nextClaimOrder++);
5025
4739
  this.#symbolClaimsByEmittedModule.set(emittedModule, manifest);
4740
+ const resolverId = manifest.resolver.virtualModuleId;
4741
+ const owners = this.#claimOwnersByResolver.get(resolverId);
4742
+ if (owners) owners.add(emittedModule);
4743
+ else this.#claimOwnersByResolver.set(resolverId, /* @__PURE__ */ new Set([emittedModule]));
5026
4744
  }
5027
4745
  deleteSymbolClaims(emittedModule) {
4746
+ const previous = this.#symbolClaimsByEmittedModule.get(emittedModule);
4747
+ if (!previous) return;
4748
+ this.#unindexClaimOwner(emittedModule, previous);
4749
+ this.#claimOrder.delete(emittedModule);
5028
4750
  this.#symbolClaimsByEmittedModule.delete(emittedModule);
5029
4751
  }
4752
+ #unindexClaimOwner(emittedModule, manifest) {
4753
+ const resolverId = manifest.resolver.virtualModuleId;
4754
+ const owners = this.#claimOwnersByResolver.get(resolverId);
4755
+ owners?.delete(emittedModule);
4756
+ if (owners?.size === 0) this.#claimOwnersByResolver.delete(resolverId);
4757
+ }
5030
4758
  hasSymbolClaims(emittedModule) {
5031
4759
  return this.#symbolClaimsByEmittedModule.has(emittedModule);
5032
4760
  }
@@ -5162,6 +4890,13 @@ var ModuleMetadataRegistry = class ModuleMetadataRegistry {
5162
4890
  symbolClaimMap() {
5163
4891
  return this.#symbolClaimsByEmittedModule;
5164
4892
  }
4893
+ /** The claims routed through these resolvers, in the order `symbolClaimMap` lists them. */
4894
+ symbolClaimMapForResolvers(resolverIds) {
4895
+ const owners = /* @__PURE__ */ new Set();
4896
+ for (const resolverId of resolverIds) for (const owner of this.#claimOwnersByResolver.get(resolverId) ?? []) owners.add(owner);
4897
+ const order = this.#claimOrder;
4898
+ return new Map([...owners].sort((left, right) => order.get(left) - order.get(right)).map((owner) => [owner, this.#symbolClaimsByEmittedModule.get(owner)]));
4899
+ }
5165
4900
  /**
5166
4901
  * The publication barrier every reader shares: an emitted sibling that has
5167
4902
  * begun publishing must have finished a publication before its source's claims
@@ -7672,9 +7407,10 @@ function rewriteGeneratedSymbolInitExports(bundle) {
7672
7407
  if (rewrite.collapsed) rewrite.chunk.code = rewrite.collapsed.code;
7673
7408
  for (const [from, to] of rewrite.names) replacements.set(from, to);
7674
7409
  }
7410
+ const rename = identifierRenamer(replacements);
7675
7411
  for (const chunk of chunks.values()) {
7676
7412
  if (!isGeneratedAsyncChunk(chunk)) continue;
7677
- chunk.code = replaceIdentifierNames(chunk.code, replacements);
7413
+ chunk.code = rename(chunk.code);
7678
7414
  }
7679
7415
  return { renamed: replacements.size };
7680
7416
  }
@@ -8000,30 +7736,32 @@ function isGeneratedChunk(value) {
8000
7736
  function unique(values) {
8001
7737
  return [...new Set(values)];
8002
7738
  }
8003
- function replaceIdentifierNames(code, replacements) {
7739
+ function identifierRenamer(replacements) {
8004
7740
  const names = [...replacements.keys()].sort((a, b) => b.length - a.length);
8005
7741
  const resolved = /* @__PURE__ */ new Map();
8006
7742
  for (const name of names.reverse()) {
8007
7743
  const replacement = replacements.get(name);
8008
7744
  resolved.set(name, resolved.get(replacement) ?? replacement);
8009
7745
  }
8010
- if (names.some((name) => !name.includes(SYMBOL_INIT_EXPORT_PREFIX) && !/\$\d/.test(name))) return code.replace(/(?<![$\w])[$A-Z_a-z][$\w]*/g, (name) => resolved.get(name) ?? name);
8011
- const anchors = new RegExp(`${escapeRegExp(SYMBOL_INIT_EXPORT_PREFIX)}|\\$\\d`, "g");
8012
- let next = "";
8013
- let cursor = 0;
8014
- for (let match = anchors.exec(code); match; match = anchors.exec(code)) {
8015
- let start = match.index;
8016
- while (start > 0 && isIdentifierPart(code.charCodeAt(start - 1))) start--;
8017
- let end = match.index + match[0].length;
8018
- while (end < code.length && isIdentifierPart(code.charCodeAt(end))) end++;
8019
- anchors.lastIndex = end;
8020
- if (start < cursor || isDigit(code.charCodeAt(start))) continue;
8021
- const replacement = resolved.get(code.slice(start, end));
8022
- if (replacement === void 0) continue;
8023
- next += code.slice(cursor, start) + replacement;
8024
- cursor = end;
8025
- }
8026
- return cursor === 0 ? code : next + code.slice(cursor);
7746
+ if (names.some((name) => !name.includes(SYMBOL_INIT_EXPORT_PREFIX) && !/\$\d/.test(name))) return (code) => code.replace(/(?<![$\w])[$A-Z_a-z][$\w]*/g, (name) => resolved.get(name) ?? name);
7747
+ return (code) => {
7748
+ const anchors = new RegExp(`${escapeRegExp(SYMBOL_INIT_EXPORT_PREFIX)}|\\$\\d`, "g");
7749
+ let next = "";
7750
+ let cursor = 0;
7751
+ for (let match = anchors.exec(code); match; match = anchors.exec(code)) {
7752
+ let start = match.index;
7753
+ while (start > 0 && isIdentifierPart(code.charCodeAt(start - 1))) start--;
7754
+ let end = match.index + match[0].length;
7755
+ while (end < code.length && isIdentifierPart(code.charCodeAt(end))) end++;
7756
+ anchors.lastIndex = end;
7757
+ if (start < cursor || isDigit(code.charCodeAt(start))) continue;
7758
+ const replacement = resolved.get(code.slice(start, end));
7759
+ if (replacement === void 0) continue;
7760
+ next += code.slice(cursor, start) + replacement;
7761
+ cursor = end;
7762
+ }
7763
+ return cursor === 0 ? code : next + code.slice(cursor);
7764
+ };
8027
7765
  }
8028
7766
  function isIdentifierPart(char) {
8029
7767
  return char >= 48 && char <= 57 || char >= 65 && char <= 90 || char >= 97 && char <= 122 || char === 36 || char === 95;
@@ -8134,7 +7872,9 @@ async function finalizeBundle(context, bundle, input) {
8134
7872
  if (tableIntegrity.errors.length > 0) context.error(`Markless symbol resolver table integrity check failed:\n${tableIntegrity.errors.map((error) => `- ${error.symbolId} -> ${error.claimedChunk}: ${error.reason}`).join("\n")}`);
8135
7873
  const specifiers = chunkImportMapEnabled(options) ? await specifyChunkReferences(manifestBundle, {
8136
7874
  publicPath: options.publicPath ?? ((fileName) => `/${fileName}`),
8137
- root: input.root
7875
+ root: input.root,
7876
+ isRoute: options.routeModules,
7877
+ packs: input.packs
8138
7878
  }) : void 0;
8139
7879
  await renameChunksToContentHashes(manifestBundle, { hashCharacters: input.hashCharacters });
8140
7880
  resortInteractionClosuresFiles(bundle);
@@ -8270,7 +8010,7 @@ function injectImportMap(bundle, script) {
8270
8010
  }
8271
8011
  //#endregion
8272
8012
  //#region src/hooks/generate-bundle.ts
8273
- async function generateBundleHook(ctx, pluginContext, bundle, hashCharacters) {
8013
+ async function generateBundleHook(ctx, pluginContext, bundle, hashCharacters, packs) {
8274
8014
  const { internalOptions, linkedChildren } = ctx;
8275
8015
  const { moduleMetadata, executionLogEmittedIds } = ctx.state;
8276
8016
  throwLinkedModuleChildDiagnostics(moduleMetadata, [...linkedChildren.values()]);
@@ -8281,7 +8021,8 @@ async function generateBundleHook(ctx, pluginContext, bundle, hashCharacters) {
8281
8021
  root: ctx.getRoot(),
8282
8022
  executionLogEmittedIds,
8283
8023
  executionAttributionTables: ctx.attributionTables,
8284
- hashCharacters
8024
+ hashCharacters,
8025
+ packs
8285
8026
  });
8286
8027
  }
8287
8028
  //#endregion
@@ -8291,6 +8032,7 @@ async function resolveIdHook(ctx, pluginContext, source, importer) {
8291
8032
  const runtimeCatalogId = marklessRuntimeSpecifierId(source);
8292
8033
  if (runtimeCatalogId) return { id: runtimeCatalogId };
8293
8034
  const normalized = normalizeVirtualId$2(source);
8035
+ if (isSharedInlineSourcesModuleId(normalized)) return { id: resolveVirtualId(normalized) };
8294
8036
  if (normalized === "virtual:markless:dev-log") return {
8295
8037
  id: resolveVirtualId(MARKLESS_EXECUTION_LOG_MODULE_ID),
8296
8038
  moduleSideEffects: true
@@ -8327,6 +8069,8 @@ async function loadHook(ctx, pluginContext, id) {
8327
8069
  });
8328
8070
  }
8329
8071
  const normalizedId = normalizeVirtualId$2(id);
8072
+ const sharedInlineSources = await sharedInlineSourcesModuleSource(normalizedId);
8073
+ if (sharedInlineSources !== null) return sharedInlineSources;
8330
8074
  const resolverSource = resolverVirtualModuleSourceFile(normalizedId);
8331
8075
  const symbolSource = symbolVirtualModuleSourceFile(normalizedId);
8332
8076
  const renderDataSource = normalizedId.startsWith(`virtual:markless:render-data:`) ? marklessVirtualModuleSourceFile(normalizedId, ctx.getRoot()) : null;
@@ -9209,6 +8953,7 @@ function createMarklessRolldownPlugin(input) {
9209
8953
  function getRoot() {
9210
8954
  return root ?? internalOptions.rootDir;
9211
8955
  }
8956
+ let declaredPacks;
9212
8957
  const [packing, facades] = environment === "client" && nativePackingEnabled(internalOptions) && !internalOptions.dev ? nativePackingPlugins(() => getRoot() ?? "", runtimeDemandMaps, runtimeDemandSources) : [];
9213
8958
  function* runtimeDemandMaps() {
9214
8959
  for (const manifest of state.moduleMetadata.symbolClaimManifests()) yield manifest.runtimeDemandMap;
@@ -9256,6 +9001,9 @@ function createMarklessRolldownPlugin(input) {
9256
9001
  },
9257
9002
  declareRouteModules: (isRoute) => {
9258
9003
  internalOptions.routeModules = isRoute;
9004
+ },
9005
+ declarePackOwnership: (packs) => {
9006
+ declaredPacks = packs;
9259
9007
  }
9260
9008
  },
9261
9009
  name,
@@ -9308,7 +9056,8 @@ function createMarklessRolldownPlugin(input) {
9308
9056
  async handler(output, bundle, isWrite) {
9309
9057
  const hook = facades?.generateBundle;
9310
9058
  await (typeof hook === "function" ? hook : hook?.handler)?.call(this, output, bundle, isWrite);
9311
- await generateBundleHook(context, this, bundle, output.hashCharacters);
9059
+ await generateBundleHook(context, this, bundle, output.hashCharacters, packing?.api ?? declaredPacks);
9060
+ clearParsedChunkCode();
9312
9061
  }
9313
9062
  },
9314
9063
  async writeBundle(output, bundle) {
@@ -9332,4 +9081,4 @@ function pluginName(environment) {
9332
9081
  return `markless:rolldown:${environment}`;
9333
9082
  }
9334
9083
  //#endregion
9335
- export { INLINE_DEFER_LOADER_SOURCE as A, MARKLESS_CHUNK_SPECIFIER_PREFIX as C, prefetchChunkParses as D, insertImportMapScript as E, inlineDeferSource as M, moduleIdFor as N, preflightTsrxModuleDiagnostics as O, marklessImportMapPath as S, importMapScript as T, createPreloadGraphAdder as _, collapseInitFacadeImports as a, marklessBuildManifestDir as b, collectHeadLinkInjections as c, nativePackingEnabled as d, nativePackingPlugins as f, convertManifestToBundleGraph as g, withUndemandedReExportDoors as h, marklessServer as i, createInlineDeferTriggerSource as j, transformTsrxModule as k, marklessRuntimeSpecifierId as l, undemandedRuntimeModules as m, marklessClient as n, unwrapAsyncImportWrappers as o, isReExportDoor as p, marklessLib as r, createBuildMetadata as s, createMarklessRolldownPlugin as t, DEPRECATED_NATIVE_PACKING_WARNING as u, entryReachableModuleIds as v, MARKLESS_IMPORT_MAP_ASSET as w, marklessBuildManifestPath as x, runtimeModuleIdFromOrigin as y };
9084
+ export { moduleIdFor as A, MARKLESS_CHUNK_SPECIFIER_PREFIX as C, prefetchChunkParses as D, insertImportMapScript as E, preflightTsrxModuleDiagnostics as O, marklessImportMapPath as S, importMapScript as T, createPreloadGraphAdder as _, collapseInitFacadeImports as a, marklessBuildManifestDir as b, collectHeadLinkInjections as c, nativePackingEnabled as d, nativePackingPlugins as f, convertManifestToBundleGraph as g, withUndemandedReExportDoors as h, marklessServer as i, transformTsrxModule as k, marklessRuntimeSpecifierId as l, undemandedRuntimeModules as m, marklessClient as n, unwrapAsyncImportWrappers as o, isReExportDoor as p, marklessLib as r, createBuildMetadata as s, createMarklessRolldownPlugin as t, DEPRECATED_NATIVE_PACKING_WARNING as u, entryReachableModuleIds as v, MARKLESS_IMPORT_MAP_ASSET as w, marklessBuildManifestPath as x, runtimeModuleIdFromOrigin as y };