@markless/bundler 0.7.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.
- package/dist/dev-error.js +1 -2
- package/dist/{execution-log-BL-7a77M.d.ts → execution-log-6xkAwVG_.d.ts} +2 -2
- package/dist/preload.d.ts +2 -2
- package/dist/preload.js +1 -1
- package/dist/{rolldown-DpkfQO1h.js → rolldown-Bh_TCkt_.js} +367 -550
- package/dist/rolldown.d.ts +3 -3
- package/dist/rolldown.js +2 -2
- package/dist/{roster-resume-CpphsFl_.js → roster-resume-DXptD6DG.js} +2 -1
- package/dist/{route-pack-groups-BXc755qH.js → route-pack-groups-0vHmSVdv.js} +583 -18
- package/dist/{types-iOUoceJ-.d.ts → types-5srcMsXU.d.ts} +10 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +149 -37
- package/package.json +8 -8
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { ArtifactChildMaterialization, ModuleGraphInterfaceArtifact, SemanticGraphArtifact, SemanticGraphInput } from "@markless/compiler";
|
|
2
|
+
import { Plugin } from "rolldown";
|
|
3
|
+
//#region src/build/native-packing.d.ts
|
|
4
|
+
/** The pack each module was planned into, and the routes a shared pack serves. */
|
|
5
|
+
type PackOwnership = {
|
|
6
|
+
readonly packOf: (moduleId: string) => string | undefined;
|
|
7
|
+
readonly packRoutes: (pack: string) => ReadonlyArray<string> | undefined;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
2
10
|
//#region src/types.d.ts
|
|
3
11
|
type MarklessEnvironment = 'client' | 'server' | 'lib';
|
|
4
12
|
type MarklessClientOutput = 'full' | 'symbols-only';
|
|
@@ -189,6 +197,8 @@ type MarklessRolldownPluginApi = {
|
|
|
189
197
|
declareServerOnlyProps: (resolve: (moduleId: string) => SemanticGraphInput['serverOnlyProps']) => void;
|
|
190
198
|
/** A host plugin names, per root-relative module id, the modules it renders as pages. */
|
|
191
199
|
declareRouteModules: (isRoute: (moduleId: string) => boolean) => void;
|
|
200
|
+
/** The packing pass names the pack each module went into, so the import map can list only chunks several pages load. */
|
|
201
|
+
declarePackOwnership: (packs: PackOwnership) => void;
|
|
192
202
|
invalidateGeneratedModules: (parent: string, environment?: MarklessEnvironment, nextSource?: string) => string[] | Promise<string[]>;
|
|
193
203
|
runtimeDemandMaps: () => Iterable<RuntimeDemandMapManifest | undefined>;
|
|
194
204
|
runtimeDemandSources: () => Iterable<{
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as MarklessEnvironment, g as PreloadGraphEntriesAdder, h as PreloadGraphEntries, i as MarklessBuildMetadata, l as MarklessManifest, m as PreloadGraphContext, n as GlobalInjections, t as BundleGraphAdder, u as MarklessRolldownOptions } from "./types-
|
|
1
|
+
import { c as MarklessEnvironment, g as PreloadGraphEntriesAdder, h as PreloadGraphEntries, i as MarklessBuildMetadata, l as MarklessManifest, m as PreloadGraphContext, n as GlobalInjections, t as BundleGraphAdder, u as MarklessRolldownOptions } from "./types-5srcMsXU.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/vite/index.d.ts
|
|
4
4
|
export interface MarklessViteOptions extends MarklessRolldownOptions {
|
package/dist/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as MARKLESS_DEV_RELOADS_ATTRIBUTE, d as renderMarklessDevErrorDocument, i as MARKLESS_DEV_PAGE_EDIT_EVENT, n as MARKLESS_DEV_ERROR_CLIENT_ID, o as MARKLESS_DEV_RELOADS_EVENT, r as MARKLESS_DEV_ERROR_EVENT, t as MARKLESS_DEV_ERROR_CLEAR_EVENT, u as normalizeMarklessDevError } from "./dev-error-BEduK_R3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as isCompilerStatefulModuleId, Mt as INLINE_DEFER_LOADER_SOURCE, Nt as createInlineDeferTriggerSource, P as pathname, Pt as inlineDeferSource, Rt as executionLogActivationInjection, ct as RESUME_ENTRY_SPECIFIER, lt as STORAGE_FREE_RESUME_ENTRY_SPECIFIER, ot as outputDefaults, t as MARKLESS_DEFERRED_PACK, z as sharedReachedRenderDataRequest } from "./route-pack-groups-0vHmSVdv.js";
|
|
3
3
|
import { n as includeOptimizedDeps, t as excludeSourceShippedDeps } from "./optimized-deps-BfzxSm6C.js";
|
|
4
|
-
import { A as
|
|
4
|
+
import { A as moduleIdFor, D as prefetchChunkParses, O as preflightTsrxModuleDiagnostics, _ as createPreloadGraphAdder, a as collapseInitFacadeImports, d as nativePackingEnabled, f as nativePackingPlugins, h as withUndemandedReExportDoors, l as marklessRuntimeSpecifierId, m as undemandedRuntimeModules, o as unwrapAsyncImportWrappers, p as isReExportDoor, t as createMarklessRolldownPlugin, u as DEPRECATED_NATIVE_PACKING_WARNING, v as entryReachableModuleIds, y as runtimeModuleIdFromOrigin } from "./rolldown-Bh_TCkt_.js";
|
|
5
5
|
import { n as marklessRosterPositions, r as marklessRosterRenderContext, t as marklessRosterPositionSeeds } from "./shared-seed-slot-ihIVCD2S.js";
|
|
6
6
|
import { joinURL, parsePath, withQuery } from "ufo";
|
|
7
7
|
import { ASYNC_PROTOCOL_VERSION, PROTOCOL_CONTAINER_HOST_NODE_ID, STORAGE_SLOT_SYMBOL_KEY, escapeScriptJson, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageCookieName, storageSlotEntryKeyFromGraphNodeId } from "@markless/serializer";
|
|
@@ -12,14 +12,14 @@ import { isAbsolute as isAbsolute$1 } from "node:path";
|
|
|
12
12
|
import { pathToFileURL } from "node:url";
|
|
13
13
|
import { createServerModuleRunner, isRunnableDevEnvironment } from "vite";
|
|
14
14
|
import { tmpdir } from "node:os";
|
|
15
|
-
import { PROTOCOL_CONTAINER_END_COMMENT, PROTOCOL_CONTAINER_START_COMMENT, PROTOCOL_EVENT_ACTION_KIND as PROTOCOL_EVENT_ACTION_KIND$1, PROTOCOL_IDLE_EVENT_NAME as PROTOCOL_IDLE_EVENT_NAME$1, PROTOCOL_LOCATOR_PATHS_ATTRIBUTE, PROTOCOL_VISIBLE_EVENT_NAME, protocolEventDispatchesMarkless } from "@markless/serializer/protocol";
|
|
15
|
+
import { PROTOCOL_CONTAINER_END_COMMENT, PROTOCOL_CONTAINER_START_COMMENT, PROTOCOL_EVENT_ACTION_KIND as PROTOCOL_EVENT_ACTION_KIND$1, PROTOCOL_EVENT_HOST_ATTRIBUTE, PROTOCOL_EVENT_HOST_DELEGATED_REF, PROTOCOL_IDLE_EVENT_NAME as PROTOCOL_IDLE_EVENT_NAME$1, PROTOCOL_LOCATOR_PATHS_ATTRIBUTE, PROTOCOL_SYNC_POLICY_TABLE_TYPE, PROTOCOL_VISIBLE_EVENT_NAME, constantSyncPolicyCode, formatEventHostEntries, protocolEventDispatchesMarkless, syncPolicyNeverActs } from "@markless/serializer/protocol";
|
|
16
16
|
import "@markless/serializer/resume-record-delta";
|
|
17
17
|
//#region ../web/src/inline/served-census.ts
|
|
18
18
|
/**
|
|
19
19
|
* Pins the container's elements in DOM order as its census and returns them,
|
|
20
20
|
* between the page start and end markers an author's element carries. When the
|
|
21
|
-
* count differs from
|
|
22
|
-
* changed the page first: the root is flagged for the resume module to renumber
|
|
21
|
+
* count or the order of their tags differs from what the server measured, a
|
|
22
|
+
* script outside Markless changed the page first: the root is flagged for the resume module to renumber
|
|
23
23
|
* the census, and no elements are returned, so nothing is matched by a shifted index.
|
|
24
24
|
*/
|
|
25
25
|
function marklessServedCensus(root, attribute) {
|
|
@@ -30,7 +30,13 @@ function marklessServedCensus(root, attribute) {
|
|
|
30
30
|
else if (next.data === __MARKLESS_PAGE_END__) break;
|
|
31
31
|
root.__marklessCensus ||= live;
|
|
32
32
|
const value = root.getAttribute?.(attribute);
|
|
33
|
-
|
|
33
|
+
const order = value?.split("|")[3];
|
|
34
|
+
let signature = 0;
|
|
35
|
+
if (order) for (const element of live.slice(1)) {
|
|
36
|
+
const name = element.localName ?? element.tagName ?? "";
|
|
37
|
+
signature = signature * 31 + name.length * 32 + (name.charCodeAt(0) | 32) | 0;
|
|
38
|
+
}
|
|
39
|
+
return value && (parseInt(value) !== live.length || order && order !== (signature >>> 0).toString(36)) ? (root.__marklessShifted = 1, []) : live;
|
|
34
40
|
}
|
|
35
41
|
//#endregion
|
|
36
42
|
//#region ../web/src/inline/resumer.ts
|
|
@@ -328,6 +334,19 @@ function isArmBranchAnchorComment(comment) {
|
|
|
328
334
|
* bits first: a digit from the first 32 here ends a number, one from the last 32 carries.
|
|
329
335
|
*/
|
|
330
336
|
const PROTOCOL_LOCATOR_PATHS_DIGITS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
337
|
+
/** A `<template>` carrying this attribute is consumed by the parser into a shadow root: the element itself is gone too. */
|
|
338
|
+
const PROTOCOL_DECLARATIVE_SHADOW_ROOT_ATTRIBUTE = "shadowrootmode";
|
|
339
|
+
const PROTOCOL_RAW_TEXT_TAGS = /* @__PURE__ */ new Set([
|
|
340
|
+
"script",
|
|
341
|
+
"style",
|
|
342
|
+
"textarea",
|
|
343
|
+
"title",
|
|
344
|
+
"xmp",
|
|
345
|
+
"iframe",
|
|
346
|
+
"noembed",
|
|
347
|
+
"noframes",
|
|
348
|
+
"noscript"
|
|
349
|
+
]);
|
|
331
350
|
//#endregion
|
|
332
351
|
//#region ../web/src/locator-paths.ts
|
|
333
352
|
const VOID_TAGS = /* @__PURE__ */ new Set([
|
|
@@ -345,18 +364,8 @@ const VOID_TAGS = /* @__PURE__ */ new Set([
|
|
|
345
364
|
"track",
|
|
346
365
|
"wbr"
|
|
347
366
|
]);
|
|
348
|
-
const RAW_TEXT_TAGS = /* @__PURE__ */ new Set([
|
|
349
|
-
"script",
|
|
350
|
-
"style",
|
|
351
|
-
"textarea",
|
|
352
|
-
"title",
|
|
353
|
-
"xmp",
|
|
354
|
-
"iframe",
|
|
355
|
-
"noembed",
|
|
356
|
-
"noframes",
|
|
357
|
-
"noscript"
|
|
358
|
-
]);
|
|
359
367
|
const FOREIGN_ROOTS = /* @__PURE__ */ new Set(["svg", "math"]);
|
|
368
|
+
const DECLARATIVE_SHADOW_ROOT = new RegExp(`\\s${PROTOCOL_DECLARATIVE_SHADOW_ROOT_ATTRIBUTE}(?:[\\s=/>]|$)`, "i");
|
|
360
369
|
function servedElementTree(html) {
|
|
361
370
|
const elements = [{
|
|
362
371
|
tag: "",
|
|
@@ -414,7 +423,8 @@ function servedElementTree(html) {
|
|
|
414
423
|
const selfClosing = foreignDepth > 0 && html[tagEnd - 1] === "/";
|
|
415
424
|
const parent = stack.length ? stack[stack.length - 1].index : 0;
|
|
416
425
|
let index = parent;
|
|
417
|
-
|
|
426
|
+
const shadowRoot = lower === "template" && DECLARATIVE_SHADOW_ROOT.test(html.slice(nameStart + name.length, tagEnd));
|
|
427
|
+
if (templateDepth === 0 && !shadowRoot) {
|
|
418
428
|
index = elements.push({
|
|
419
429
|
tag,
|
|
420
430
|
parent,
|
|
@@ -424,7 +434,7 @@ function servedElementTree(html) {
|
|
|
424
434
|
nameEnds.push(nameStart + name.length);
|
|
425
435
|
}
|
|
426
436
|
if (VOID_TAGS.has(lower) || selfClosing) continue;
|
|
427
|
-
if (
|
|
437
|
+
if (PROTOCOL_RAW_TEXT_TAGS.has(lower)) {
|
|
428
438
|
const close = (lowerHtml ??= html.toLowerCase()).indexOf(`</${lower}`, at);
|
|
429
439
|
at = close < 0 ? html.length : endOfTag(html, close + 2 + lower.length) + 1;
|
|
430
440
|
continue;
|
|
@@ -443,6 +453,18 @@ function servedElementTree(html) {
|
|
|
443
453
|
nameEnds
|
|
444
454
|
};
|
|
445
455
|
}
|
|
456
|
+
/** Writes `attribute="value"` on each element the map names by its index in servedElementTree(html). */
|
|
457
|
+
function withElementAttributes(html, nameEnds, attribute, values) {
|
|
458
|
+
let out = "";
|
|
459
|
+
let cursor = 0;
|
|
460
|
+
for (const index of [...values.keys()].sort((left, right) => left - right)) {
|
|
461
|
+
const at = nameEnds[index];
|
|
462
|
+
if (!index || at === void 0) continue;
|
|
463
|
+
out += `${html.slice(cursor, at)} ${attribute}="${values.get(index).replace(/&/g, "&").replace(/"/g, """)}"`;
|
|
464
|
+
cursor = at;
|
|
465
|
+
}
|
|
466
|
+
return out + html.slice(cursor);
|
|
467
|
+
}
|
|
446
468
|
function endOfTag(html, from) {
|
|
447
469
|
let quote = "";
|
|
448
470
|
for (let at = from; at < html.length; at++) {
|
|
@@ -487,7 +509,13 @@ function servedLocatorPaths(containerHtml, locators) {
|
|
|
487
509
|
stack.push(index);
|
|
488
510
|
previous = index;
|
|
489
511
|
}
|
|
490
|
-
return `${elements.length}${tags.join(",")}|${entries}|${parents.map((parent) => pathNumber(childCounts[parent])).join("")}`;
|
|
512
|
+
return `${elements.length}${tags.join(",")}|${entries}|${parents.map((parent) => pathNumber(childCounts[parent])).join("")}|${tagOrderSignature(elements.slice(1).map((element) => element.tag))}`;
|
|
513
|
+
}
|
|
514
|
+
/** The order the served elements' tags came in, which a script moving one changes without changing the count. */
|
|
515
|
+
function tagOrderSignature(tags) {
|
|
516
|
+
let signature = 0;
|
|
517
|
+
for (const tag of tags) signature = signature * 31 + tag.length * 32 + (tag.charCodeAt(0) | 32) | 0;
|
|
518
|
+
return (signature >>> 0).toString(36);
|
|
491
519
|
}
|
|
492
520
|
function pathNumber(value) {
|
|
493
521
|
let digits = "";
|
|
@@ -507,22 +535,25 @@ async function assemblePrerenderPageParts(component, output, options) {
|
|
|
507
535
|
const boot = artifactPrerenderBoot(component);
|
|
508
536
|
const settle = options.armEmission && selfWake ? boot?.settle : void 0;
|
|
509
537
|
const resumerScript = browserTriggers && resumeModuleUrl ? renderInlineResumerScript(settle ? renderPrerenderInlineResumerSource(settle.boot, eventNames) : boot ? renderPrerenderInlineResumerSource(selfWake ? boot.prerenderSelfWake : boot.prerender, eventNames) : createPrerenderInlineResumerSource(eventNames, resumeModuleUrl), options.nonce, resumeModuleUrl, selfWake && !settle, settle?.moduleUrl, !boot, false, deferredTriggerSource(view) + (selfWake ? "" : storageWakeSource(state, resumeModuleUrl)), artifactInlineResumerSources(component)?.defer) : "";
|
|
538
|
+
const head = [
|
|
539
|
+
renderStorageSeedScript(artifactStorageSeeds(component), options.nonce),
|
|
540
|
+
renderHeadInjections(artifactHeadInjections(component), options.nonce),
|
|
541
|
+
renderModulePreloadLinks(modulePreloads, options.nonce)
|
|
542
|
+
].filter(Boolean).join("");
|
|
543
|
+
const policyTable = createSyncPolicyTable();
|
|
510
544
|
return {
|
|
511
|
-
head
|
|
512
|
-
renderStorageSeedScript(artifactStorageSeeds(component), options.nonce),
|
|
513
|
-
renderHeadInjections(artifactHeadInjections(component), options.nonce),
|
|
514
|
-
renderModulePreloadLinks(modulePreloads, options.nonce)
|
|
515
|
-
].filter(Boolean).join(""),
|
|
545
|
+
head,
|
|
516
546
|
container: renderContainer(options.containerId, [
|
|
517
|
-
output.html,
|
|
547
|
+
resumerScript ? withEventHostMarks(view, output.html, policyTable) : output.html,
|
|
518
548
|
options.armEmission,
|
|
549
|
+
renderSyncPolicyTableScript(policyTable.policies),
|
|
519
550
|
resumerScript
|
|
520
551
|
], resumerScript ? view.locators : [])
|
|
521
552
|
};
|
|
522
553
|
}
|
|
523
554
|
async function renderSsrOutput(component, props, renderContext) {
|
|
524
555
|
assertPageRenderable(component);
|
|
525
|
-
globalThis.__marklessRosterResume ??= () => import("./roster-resume-
|
|
556
|
+
globalThis.__marklessRosterResume ??= () => import("./roster-resume-DXptD6DG.js");
|
|
526
557
|
const context = marklessSsrRosterPositionContext(renderContext);
|
|
527
558
|
if (typeof component === "function") return marklessSsrRosterCounted(context, await marklessSsrDeferredCounted(context, await component(props, context)));
|
|
528
559
|
if (component && typeof component.renderSsr === "function") return marklessSsrRosterCounted(context, await marklessSsrDeferredCounted(context, await component.renderSsr(props, context)));
|
|
@@ -665,20 +696,95 @@ function branchServedArmEventNames(branch) {
|
|
|
665
696
|
if (!armRecords) return [];
|
|
666
697
|
return [...armRecords.events.filter(protocolEventDispatchesMarkless).map((event) => event.eventName), ...(armRecords.keyedRepeats ?? []).flatMap((repeat) => repeat.rowEvents.map((event) => event.eventName))];
|
|
667
698
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
699
|
+
const DEFERRED_EVENT_NAMES = [PROTOCOL_VISIBLE_EVENT_NAME, PROTOCOL_IDLE_EVENT_NAME$1];
|
|
700
|
+
/** Collects a container's conditional sync policies into its table, one row per distinct policy. */
|
|
701
|
+
function createSyncPolicyTable() {
|
|
702
|
+
const policies = [];
|
|
703
|
+
const rows = /* @__PURE__ */ new Map();
|
|
704
|
+
return {
|
|
705
|
+
policies,
|
|
706
|
+
entry(policy) {
|
|
707
|
+
if (!policy || syncPolicyNeverActs(policy)) return void 0;
|
|
708
|
+
const constant = constantSyncPolicyCode(policy);
|
|
709
|
+
if (constant) return constant;
|
|
710
|
+
const key = JSON.stringify(policy);
|
|
711
|
+
let row = rows.get(key);
|
|
712
|
+
if (row === void 0) rows.set(key, row = policies.push(policy) - 1);
|
|
713
|
+
return row;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
function addEventHostEntry(marks, index, entry) {
|
|
718
|
+
const entries = marks.get(index);
|
|
719
|
+
if (!entries) return void marks.set(index, [entry]);
|
|
720
|
+
const same = entries.findIndex((candidate) => candidate.name === entry.name);
|
|
721
|
+
if (same < 0) entries.push(entry);
|
|
722
|
+
else if (entries[same].ref === void 0 && entry.ref !== void 0) entries[same] = entry;
|
|
723
|
+
}
|
|
724
|
+
function writeEventHostMarks(html, nameEnds, marks) {
|
|
725
|
+
return marks.size ? withElementAttributes(html, nameEnds, PROTOCOL_EVENT_HOST_ATTRIBUTE, new Map([...marks].map(([index, entries]) => [index, formatEventHostEntries(entries)]))) : html;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Writes the `m:on` attribute on every served event host: a top-level record by
|
|
729
|
+
* its index in `events`, a keyed repeat parent as the scope of its rows' events,
|
|
730
|
+
* and a host in a served arm by the policy its record carries.
|
|
731
|
+
*/
|
|
732
|
+
function withEventHostMarks(view, html, policyTable) {
|
|
733
|
+
const tree = servedElementTree(html);
|
|
734
|
+
const marks = /* @__PURE__ */ new Map();
|
|
735
|
+
const indexes = (locators) => new Map(locators.map((locator) => [locator.hostNodeId, locator.index]));
|
|
736
|
+
const shell = indexes(view.locators);
|
|
737
|
+
view.events.forEach((event, ref) => {
|
|
738
|
+
const index = shell.get(event.hostNodeId);
|
|
739
|
+
if (index === void 0) return;
|
|
740
|
+
const dispatches = protocolEventDispatchesMarkless(event);
|
|
741
|
+
if (!dispatches && DEFERRED_EVENT_NAMES.includes(event.eventName)) return;
|
|
742
|
+
const policy = policyTable.entry(event.syncPolicy);
|
|
743
|
+
addEventHostEntry(marks, index, {
|
|
744
|
+
name: event.eventName,
|
|
745
|
+
ref: dispatches ? ref : PROTOCOL_EVENT_HOST_DELEGATED_REF,
|
|
746
|
+
...policy === void 0 ? {} : { policy }
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
for (const repeat of view.keyedRepeats ?? []) {
|
|
750
|
+
const index = shell.get(repeat.parentHostNodeId);
|
|
751
|
+
if (index === void 0) continue;
|
|
752
|
+
for (const event of repeat.rowEvents) addEventHostEntry(marks, index, { name: event.eventName });
|
|
753
|
+
}
|
|
754
|
+
for (const [anchor, records] of [...view.asyncBoundaries.map((boundary) => [boundary.startAnchor, boundary.armRecords]), ...(view.branches ?? []).map((branch) => [branch.startAnchor, branch.servedArmRecords])]) {
|
|
755
|
+
if (!records || Array.isArray(records)) continue;
|
|
756
|
+
const set = records;
|
|
757
|
+
const offset = tree.commentElementIndexes[anchor.index];
|
|
758
|
+
if (offset === void 0) continue;
|
|
759
|
+
const arm = indexes(set.locators);
|
|
760
|
+
for (const event of set.events ?? []) {
|
|
761
|
+
const policy = policyTable.entry(event.syncPolicy);
|
|
762
|
+
const index = arm.get(event.hostNodeId);
|
|
763
|
+
if (policy === void 0 || index === void 0) continue;
|
|
764
|
+
addEventHostEntry(marks, offset + index, {
|
|
765
|
+
name: event.eventName,
|
|
766
|
+
policy
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return writeEventHostMarks(html, tree.nameEnds, marks);
|
|
771
|
+
}
|
|
772
|
+
function renderSyncPolicyTableScript(policies) {
|
|
773
|
+
return policies.length ? `<script type="${PROTOCOL_SYNC_POLICY_TABLE_TYPE}">${escapeScriptJson(JSON.stringify(policies))}<\/script>` : "";
|
|
774
|
+
}
|
|
775
|
+
function hasEvent(view, eventName) {
|
|
776
|
+
return view.events.some((event) => event.eventName === eventName);
|
|
671
777
|
}
|
|
672
778
|
function deferredTriggerSource(view) {
|
|
673
|
-
const visible = eventHostIndexes(view, PROTOCOL_VISIBLE_EVENT_NAME);
|
|
674
|
-
const idle = eventHostIndexes(view, PROTOCOL_IDLE_EVENT_NAME$1);
|
|
675
779
|
const nested = deferredEventNames({
|
|
676
780
|
...view,
|
|
677
781
|
events: []
|
|
678
782
|
});
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
783
|
+
const lane = (name, eventName) => {
|
|
784
|
+
const ownsRoot = nested.includes(eventName);
|
|
785
|
+
return hasEvent(view, eventName) || ownsRoot ? createInlineDeferTriggerSource(name, ownsRoot) : "";
|
|
786
|
+
};
|
|
787
|
+
return lane("visible", PROTOCOL_VISIBLE_EVENT_NAME) + lane("idle", PROTOCOL_IDLE_EVENT_NAME$1);
|
|
682
788
|
}
|
|
683
789
|
function browserEventNames(view) {
|
|
684
790
|
return deferredEventNames(view).filter((eventName) => eventName !== PROTOCOL_VISIBLE_EVENT_NAME);
|
|
@@ -1284,7 +1390,7 @@ function deferredRuntimePlugin(demandMaps) {
|
|
|
1284
1390
|
packs = /* @__PURE__ */ new Map();
|
|
1285
1391
|
if (error) return;
|
|
1286
1392
|
const modules = /* @__PURE__ */ new Map();
|
|
1287
|
-
for (const id of this
|
|
1393
|
+
for (const id of entryReachableModuleIds(this)) {
|
|
1288
1394
|
const info = this.getModuleInfo(id);
|
|
1289
1395
|
if (!info || "isExternal" in info && info.isExternal) continue;
|
|
1290
1396
|
modules.set(id, {
|
|
@@ -2103,6 +2209,9 @@ function markless(options = {}) {
|
|
|
2103
2209
|
options: rolldownOptions,
|
|
2104
2210
|
prerenderRecordsBySource
|
|
2105
2211
|
});
|
|
2212
|
+
const packingPlugins = nativePackingEnabled(options) ? nativePackingPlugins(() => resolvedRoot, () => basePlugin.api.runtimeDemandMaps(), () => basePlugin.api.runtimeDemandSources()) : void 0;
|
|
2213
|
+
const packOwnership = packingPlugins?.[0]?.api;
|
|
2214
|
+
if (packOwnership) basePlugin.api.declarePackOwnership(packOwnership);
|
|
2106
2215
|
const hmr = createViteHmr(hmrOptions);
|
|
2107
2216
|
const marklessPlugin = {
|
|
2108
2217
|
...basePlugin,
|
|
@@ -2229,6 +2338,9 @@ function markless(options = {}) {
|
|
|
2229
2338
|
}
|
|
2230
2339
|
}
|
|
2231
2340
|
},
|
|
2341
|
+
configureVitest({ defineCacheKeyGenerator }) {
|
|
2342
|
+
defineCacheKeyGenerator(({ id }) => isCompilerStatefulModuleId(id) ? false : void 0);
|
|
2343
|
+
},
|
|
2232
2344
|
configureServer(server) {
|
|
2233
2345
|
server.config.logger?.info(`markless diagnostics available - window.__MARKLESS_DEBUG__ records containers, lifecycles, and event routing; ${DEBUGGING_PLAYBOOK_HINT}.`);
|
|
2234
2346
|
rolldownOptions.devServer = {
|
|
@@ -2319,7 +2431,7 @@ function markless(options = {}) {
|
|
|
2319
2431
|
}
|
|
2320
2432
|
}
|
|
2321
2433
|
},
|
|
2322
|
-
...
|
|
2434
|
+
...packingPlugins ? packingPlugins.map((plugin) => ({
|
|
2323
2435
|
...plugin,
|
|
2324
2436
|
apply: "build",
|
|
2325
2437
|
enforce: "post",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markless/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Markless build plugins for Rolldown and Vite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"provenance": true
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/dgraph": "^2.1.
|
|
39
|
+
"@thi.ng/dgraph": "^2.1.213",
|
|
40
40
|
"pathe": "^2.0.3",
|
|
41
41
|
"ufo": "^1.6.4",
|
|
42
|
-
"@markless/compiler": "0.
|
|
43
|
-
"@markless/
|
|
44
|
-
"@markless/
|
|
42
|
+
"@markless/compiler": "0.9.0",
|
|
43
|
+
"@markless/serializer": "0.9.0",
|
|
44
|
+
"@markless/web": "0.9.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@markless/analyzer": "0.
|
|
47
|
+
"@markless/analyzer": "0.9.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"rolldown": "1.2.
|
|
51
|
-
"vite": "8.
|
|
50
|
+
"rolldown": "1.2.14",
|
|
51
|
+
"vite": "8.3.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"rolldown": {
|