@markless/bundler 0.4.0 → 0.5.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-DRvO28Fd.js +174 -0
- package/dist/dev-error.d.ts +14 -16
- package/dist/dev-error.js +1 -173
- package/dist/execution-log-D9cex1i1.d.ts +17 -0
- package/dist/optimized-deps-BfzxSm6C.js +89 -0
- package/dist/preload.d.ts +39 -7
- package/dist/preload.js +3 -2
- package/dist/repeat-runtime-BDnaUYXM.js +71 -0
- package/dist/rolldown-BciZw5hZ.js +9116 -0
- package/dist/rolldown.d.ts +34 -17
- package/dist/rolldown.js +3 -3
- package/dist/roster-resume-CpphsFl_.js +427 -0
- package/dist/route-pack-groups-BpefyjrE.js +2707 -0
- package/dist/shared-seed-slot-ihIVCD2S.js +113 -0
- package/dist/{types-BuooJg32.d.ts → types-BqSoEVp6.d.ts} +46 -10
- package/dist/vite.d.ts +5 -6
- package/dist/vite.js +599 -158
- package/package.json +7 -7
- package/dist/rolldown-CB2Xpf-E.js +0 -4828
- package/dist/source-module-DI20i0ZG.js +0 -1168
- package/dist/source-module-XFgOFX1c.d.ts +0 -8
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//#region ../web/src/prerender/shared-seed-slot.ts
|
|
2
|
+
/**
|
|
3
|
+
* The seed-map key a widget root's instance token travels under, restating
|
|
4
|
+
* MARKLESS_WIDGET_INSTANCE_KEY in @markless/compiler (public-render's
|
|
5
|
+
* residue-reader) so the browser never imports the compiler. It is not a graph
|
|
6
|
+
* node id: it names WHICH rendered widget the parts seeded from this map belong
|
|
7
|
+
* to, which is what a shared() element() handle's minted id has to carry.
|
|
8
|
+
* shared-seed-widget.test.ts pins this spelling; element-handle-idref.test.ts
|
|
9
|
+
* proves the two sides agree end to end.
|
|
10
|
+
*/
|
|
11
|
+
const MARKLESS_WIDGET_INSTANCE_KEY = "markless:widget-instance";
|
|
12
|
+
/**
|
|
13
|
+
* The same token, filed PER shared definition.
|
|
14
|
+
*
|
|
15
|
+
* One element can carry handles declared by two different widget families - a
|
|
16
|
+
* radio item's own field handle and the group's set, a tree label's item handle
|
|
17
|
+
* and the root's - so "which rendered widget am I inside" has no single answer
|
|
18
|
+
* on that element. It has one answer per DEFINITION, which is what the reading
|
|
19
|
+
* handle names: a handle's graph node id is `<definitionId>/element:<name>`, so
|
|
20
|
+
* the mint asks for its own family's token and gets the instance the handle was
|
|
21
|
+
* DECLARED in, never whichever family last seeded this scope.
|
|
22
|
+
*
|
|
23
|
+
* The plain key above stays filed too: a page with one widget family reads it
|
|
24
|
+
* exactly as before, and it is the fallback when no per-definition token exists.
|
|
25
|
+
*/
|
|
26
|
+
function marklessWidgetInstanceKey(definitionId) {
|
|
27
|
+
return `${MARKLESS_WIDGET_INSTANCE_KEY}|${definitionId}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Where a part stands in its family's roster, answered for the two regimes that
|
|
31
|
+
* ask it: at render there is no DOM, so the answer is the order this widget
|
|
32
|
+
* instance EMITS its members; after resume the roster is live, so the answer is
|
|
33
|
+
* its document order. The compiler lowers `roster.indexOf(mine)` to one call in
|
|
34
|
+
* each regime with the same two node ids, so the two cannot disagree.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The seed-map key this render's position counter travels under. The seed map
|
|
38
|
+
* is the one channel that reaches both the compiled SSR child render and the
|
|
39
|
+
* CSR component evaluation, and it already carries the widget-instance token a
|
|
40
|
+
* position counts within.
|
|
41
|
+
*/
|
|
42
|
+
const MARKLESS_ROSTER_POSITIONS_KEY = "markless:roster-positions";
|
|
43
|
+
function marklessRosterPositions(seeds) {
|
|
44
|
+
const held = seeds?.get(MARKLESS_ROSTER_POSITIONS_KEY);
|
|
45
|
+
return held && typeof held === "object" ? held : void 0;
|
|
46
|
+
}
|
|
47
|
+
/** The render's seed map with a counter filed on it, minted once per render. */
|
|
48
|
+
function marklessRosterPositionSeeds(seeds) {
|
|
49
|
+
if (marklessRosterPositions(seeds)) return seeds;
|
|
50
|
+
const filed = new Map(seeds ?? []);
|
|
51
|
+
filed.set(MARKLESS_ROSTER_POSITIONS_KEY, { taken: /* @__PURE__ */ new Map() });
|
|
52
|
+
return filed;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Which rendered widget a roster belongs to, asked of its own family exactly as
|
|
56
|
+
* a minted handle id asks it: a handle's graph node id carries a module path, so
|
|
57
|
+
* the family is everything up to the LAST slash.
|
|
58
|
+
*/
|
|
59
|
+
function rosterInstance(scope, rosterGraphNodeId) {
|
|
60
|
+
const family = rosterGraphNodeId.slice(0, rosterGraphNodeId.lastIndexOf("/"));
|
|
61
|
+
return scope?.get(marklessWidgetInstanceKey(family)) ?? scope?.get("markless:widget-instance");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The nth member of this instance's roster to ask is the nth in it.
|
|
65
|
+
*
|
|
66
|
+
* Render walks a widget instance in document order, so counting the asks IS
|
|
67
|
+
* that order — there is no DOM yet to compare against. The count is per widget
|
|
68
|
+
* instance, which is what keeps a second collection on the page starting at
|
|
69
|
+
* zero.
|
|
70
|
+
*/
|
|
71
|
+
function renderRosterPosition(positions, seeds, rosterGraphNodeId, handleGraphNodeId) {
|
|
72
|
+
const instance = rosterInstance(seeds ?? positions.seeds, rosterGraphNodeId);
|
|
73
|
+
const key = `${String(instance)}|${rosterGraphNodeId}|${handleGraphNodeId}`;
|
|
74
|
+
const ledger = positions.seeding ?? positions.taken;
|
|
75
|
+
const taken = ledger.get(key) ?? 0;
|
|
76
|
+
ledger.set(key, taken + 1);
|
|
77
|
+
return taken;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* How many parts this instance puts in the roster - asked, unlike a position,
|
|
81
|
+
* by a part that may render BEFORE the members it is counting. The root asking
|
|
82
|
+
* `ui-max` is exactly that: server render is one forward pass.
|
|
83
|
+
*
|
|
84
|
+
* So the ask does not answer. It writes a placeholder naming the roster's own
|
|
85
|
+
* registration key — the widget instance's path then the module-level handle id,
|
|
86
|
+
* which is how marklessWidgetHandleId qualifies it at composition — and the
|
|
87
|
+
* surface resolves it once composition has made the count a fact.
|
|
88
|
+
*/
|
|
89
|
+
function renderRosterCount(positions, seeds, rosterGraphNodeId) {
|
|
90
|
+
const instance = rosterInstance(seeds ?? positions.seeds, rosterGraphNodeId);
|
|
91
|
+
const key = (typeof instance === "string" ? instance : "") + rosterGraphNodeId;
|
|
92
|
+
positions.counted = true;
|
|
93
|
+
return "" + key + "";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The two roster questions a derive may ask at render time, on one context.
|
|
97
|
+
* Every render-side evaluation site hands the symbol this same object, so a
|
|
98
|
+
* compiled call cannot reach a regime that answers only one of them.
|
|
99
|
+
*/
|
|
100
|
+
function marklessRosterRenderContext(positions, seeds) {
|
|
101
|
+
if (!positions) return {};
|
|
102
|
+
return {
|
|
103
|
+
rosterPosition: (roster, handle) => renderRosterPosition(positions, seeds, roster, handle),
|
|
104
|
+
rosterCount: (roster) => renderRosterCount(positions, seeds, roster),
|
|
105
|
+
deferCount: (thunk) => positions.counted ? "" + String((positions.deferred ??= []).push(thunk) - 1) + "" : thunk(resolvedCount)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function resolvedCount(value) {
|
|
109
|
+
if (typeof value !== "number") throw new Error("MARKLESS_ROSTER_COUNT_UNRESOLVED");
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { marklessRosterPositions as n, marklessRosterRenderContext as r, marklessRosterPositionSeeds as t };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import * as _$_markless_serializer0 from "@markless/serializer";
|
|
2
|
-
import * as _$_markless_compiler0 from "@markless/compiler";
|
|
3
1
|
import { ArtifactChildMaterialization, ModuleGraphInterfaceArtifact, SemanticGraphArtifact, SemanticGraphInput } from "@markless/compiler";
|
|
4
|
-
|
|
5
2
|
//#region src/types.d.ts
|
|
6
3
|
type MarklessEnvironment = 'client' | 'server' | 'lib';
|
|
7
4
|
type MarklessClientOutput = 'full' | 'symbols-only';
|
|
@@ -9,8 +6,18 @@ type MarklessExecutionLogMode = 'auto' | 'never' | 'always';
|
|
|
9
6
|
interface MarklessDevServer {
|
|
10
7
|
transformRequest: (url: string, environment: MarklessEnvironment) => Promise<unknown> | unknown;
|
|
11
8
|
invalidateModule?: (id: string, environment: MarklessEnvironment) => boolean;
|
|
9
|
+
importModule?: (source: string) => Promise<unknown>;
|
|
12
10
|
}
|
|
13
11
|
interface MarklessRolldownOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Packs a client production build's lazily loaded modules into a few chunks instead of one
|
|
14
|
+
* chunk per module, cut by what each route's page load, first interactions and navigation
|
|
15
|
+
* need, so a page preloads what its first interactions run in one round and nothing waits on a
|
|
16
|
+
* waterfall. On by default; `false` ships one chunk per module. Dev builds are never packed.
|
|
17
|
+
*/
|
|
18
|
+
packing?: boolean;
|
|
19
|
+
/** @deprecated Packing is on by default. Remove the option, or use `packing: false` to opt out. */
|
|
20
|
+
experimentalNativePacking?: boolean;
|
|
14
21
|
dev?: boolean;
|
|
15
22
|
devInjections?: GlobalInjections[];
|
|
16
23
|
devServer?: MarklessDevServer;
|
|
@@ -20,10 +27,10 @@ interface MarklessRolldownOptions {
|
|
|
20
27
|
rootDir?: string;
|
|
21
28
|
buildId?: string;
|
|
22
29
|
}
|
|
23
|
-
type MarklessVirtualModuleType = 'payload' | 'prerender-wake' | 'render-data' | 'resolver' | 'resume' | 'settle' | 'symbol' | 'trigger-group' | 'style';
|
|
30
|
+
type MarklessVirtualModuleType = 'payload' | 'prerender-wake' | 'render-data' | 'render-data-entry' | 'resolver' | 'resume' | 'settle' | 'symbol' | 'symbol-entry' | 'symbol-bundle' | 'trigger-group' | 'style';
|
|
24
31
|
type BuiltPrerenderRecords = {
|
|
25
|
-
readonly state:
|
|
26
|
-
readonly view:
|
|
32
|
+
readonly state: import('@markless/serializer').ProtocolStatePayload;
|
|
33
|
+
readonly view: import('@markless/serializer').ProtocolViewPayload;
|
|
27
34
|
};
|
|
28
35
|
interface MarklessVirtualModule {
|
|
29
36
|
id: string;
|
|
@@ -33,24 +40,36 @@ interface MarklessVirtualModule {
|
|
|
33
40
|
exportName?: string;
|
|
34
41
|
canonicalRenderData?: boolean;
|
|
35
42
|
symbolClaims?: ReadonlyArray<string>;
|
|
43
|
+
/** `symbol-bundle` only: the symbol module ids this bundle ships as one chunk. */
|
|
44
|
+
bundledSymbolModuleIds?: ReadonlyArray<string>;
|
|
45
|
+
/** Symbols and resolvers may resolve during linking, but never serve first-pass code. */
|
|
46
|
+
provisional?: boolean;
|
|
36
47
|
}
|
|
37
48
|
interface TransformTsrxModuleInput {
|
|
49
|
+
experimentalNativePacking?: boolean;
|
|
38
50
|
filename: string;
|
|
51
|
+
/** Root-relative id the compiler spells every minted id from; defaults to `filename`. */
|
|
52
|
+
moduleId?: string;
|
|
39
53
|
source: string;
|
|
40
54
|
dev?: boolean;
|
|
41
55
|
importedModuleInterfaces?: SemanticGraphInput['importedModuleInterfaces'];
|
|
56
|
+
importedModuleConstants?: SemanticGraphInput['importedModuleConstants'];
|
|
57
|
+
serverOnlyProps?: SemanticGraphInput['serverOnlyProps'];
|
|
42
58
|
renderDataImportSources?: Readonly<Record<string, string>>;
|
|
43
59
|
artifactChildMaterializations?: Readonly<Record<string, ArtifactChildMaterialization>>;
|
|
44
|
-
symbols?:
|
|
60
|
+
symbols?: import('@markless/compiler').SymbolResolverModuleInput['symbols'];
|
|
45
61
|
devResumeReexport?: boolean;
|
|
46
62
|
buildId?: string;
|
|
47
63
|
environment?: MarklessEnvironment;
|
|
48
64
|
clientOutput?: MarklessClientOutput;
|
|
65
|
+
includeScalarActionPlans?: boolean;
|
|
49
66
|
resumeModuleUrl?: string;
|
|
50
67
|
prerenderWakeModuleUrl?: string;
|
|
51
68
|
settleModuleUrl?: string;
|
|
52
69
|
headInjections?: GlobalInjections[];
|
|
53
70
|
styleModuleUrl?: (virtualModuleId: string) => string;
|
|
71
|
+
/** Scoped-style modules of the linked children, so a dev page links its whole tree. */
|
|
72
|
+
linkedStyleModuleIds?: readonly string[];
|
|
54
73
|
executionLog?: MarklessExecutionLogMode;
|
|
55
74
|
executionLogModuleHooks?: boolean;
|
|
56
75
|
inlineResumerDebug?: boolean;
|
|
@@ -60,7 +79,8 @@ interface TransformTsrxModuleInput {
|
|
|
60
79
|
prerenderWakeFacade?: boolean;
|
|
61
80
|
preserveWakeSiblingClaims?: boolean;
|
|
62
81
|
prerenderRecordData?: BuiltPrerenderRecords;
|
|
63
|
-
runtimeDemandClass?:
|
|
82
|
+
runtimeDemandClass?: import('@markless/compiler').RuntimeDemandClass;
|
|
83
|
+
servedScalarPlans?: boolean;
|
|
64
84
|
}
|
|
65
85
|
interface TransformTsrxModuleResult {
|
|
66
86
|
code: string;
|
|
@@ -71,6 +91,11 @@ interface TransformTsrxModuleResult {
|
|
|
71
91
|
interfaceHash: string;
|
|
72
92
|
moduleImports: SemanticGraphArtifact['moduleImports'];
|
|
73
93
|
artifactChildren: ReadonlyArray<ArtifactChildCandidate>;
|
|
94
|
+
/** Imported constants a prop reads that this compile was not given. */
|
|
95
|
+
importedConstantRequests?: ReadonlyArray<{
|
|
96
|
+
readonly source: string;
|
|
97
|
+
readonly exportName: string;
|
|
98
|
+
}>;
|
|
74
99
|
}
|
|
75
100
|
type ArtifactChildCandidate = {
|
|
76
101
|
readonly edgeId: string;
|
|
@@ -93,7 +118,7 @@ type ArtifactChildCandidate = {
|
|
|
93
118
|
};
|
|
94
119
|
interface MarklessTransformManifest {
|
|
95
120
|
source: string;
|
|
96
|
-
captureMetadata?:
|
|
121
|
+
captureMetadata?: import('@markless/compiler').CaptureAnalysisArtifact;
|
|
97
122
|
symbolRoutes?: ReadonlyArray<{
|
|
98
123
|
readonly prefix: string;
|
|
99
124
|
readonly importSource: string;
|
|
@@ -113,7 +138,7 @@ interface MarklessSymbolManifestEntry extends MarklessBuildModuleReference {
|
|
|
113
138
|
exportName: string;
|
|
114
139
|
kind: string;
|
|
115
140
|
}
|
|
116
|
-
type RuntimeDemandMapManifest = Omit<
|
|
141
|
+
type RuntimeDemandMapManifest = Omit<import('@markless/compiler').RuntimeDemandMapArtifact, 'passId'>;
|
|
117
142
|
interface MarklessBuildMetadata {
|
|
118
143
|
version: number;
|
|
119
144
|
modules: MarklessTransformManifest[];
|
|
@@ -155,7 +180,18 @@ interface PreloadGraphContext {
|
|
|
155
180
|
type PreloadGraphEntriesAdder = (context: PreloadGraphContext) => PreloadGraphEntries | undefined;
|
|
156
181
|
type BundleGraphAdder = (manifest: MarklessBuildMetadata) => PreloadGraphEntries | undefined;
|
|
157
182
|
type MarklessRolldownPluginApi = {
|
|
183
|
+
/** Whether client chunks import each other through specifiers that the document's import map resolves. */
|
|
184
|
+
chunkImportMap: () => boolean;
|
|
185
|
+
/** A plugin that writes every document the app serves turns chunk import maps on. */
|
|
186
|
+
enableChunkImportMap: () => void;
|
|
187
|
+
/** A host plugin names, per root-relative module id, the props browser code must never read. */
|
|
188
|
+
declareServerOnlyProps: (resolve: (moduleId: string) => SemanticGraphInput['serverOnlyProps']) => void;
|
|
158
189
|
invalidateGeneratedModules: (parent: string, environment?: MarklessEnvironment, nextSource?: string) => string[] | Promise<string[]>;
|
|
190
|
+
runtimeDemandMaps: () => Iterable<RuntimeDemandMapManifest | undefined>;
|
|
191
|
+
runtimeDemandSources: () => Iterable<{
|
|
192
|
+
readonly source: string;
|
|
193
|
+
readonly map: RuntimeDemandMapManifest | undefined;
|
|
194
|
+
}>;
|
|
159
195
|
};
|
|
160
196
|
//#endregion
|
|
161
197
|
export { TransformTsrxModuleInput as _, MarklessBundle as a, MarklessEnvironment as c, MarklessRolldownPluginApi as d, MarklessTransformManifest as f, PreloadGraphEntriesAdder as g, PreloadGraphEntries as h, MarklessBuildMetadata as i, MarklessManifest as l, PreloadGraphContext as m, GlobalInjections as n, MarklessBundleGraph as o, MarklessVirtualModule as p, MarklessAsset as r, MarklessDevServer as s, BundleGraphAdder as t, MarklessRolldownOptions as u, TransformTsrxModuleResult as v };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
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-BqSoEVp6.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/vite/index.d.ts
|
|
5
|
-
interface MarklessViteOptions extends MarklessRolldownOptions {
|
|
4
|
+
export interface MarklessViteOptions extends MarklessRolldownOptions {
|
|
6
5
|
clientEnvironment?: string;
|
|
7
6
|
debug?: boolean;
|
|
8
7
|
serverEnvironment?: string;
|
|
9
8
|
}
|
|
10
|
-
declare function markless(options?: MarklessViteOptions): Plugin[];
|
|
11
|
-
type MarklessVitePlugin = ReturnType<typeof markless>[number];
|
|
9
|
+
export declare function markless(options?: MarklessViteOptions): Plugin[];
|
|
10
|
+
export type MarklessVitePlugin = ReturnType<typeof markless>[number];
|
|
12
11
|
//#endregion
|
|
13
|
-
export {
|
|
12
|
+
export type { BundleGraphAdder, GlobalInjections, MarklessBuildMetadata, MarklessEnvironment, MarklessManifest, MarklessRolldownOptions, PreloadGraphContext, PreloadGraphEntries, PreloadGraphEntriesAdder };
|