@peripheries/renderer 0.30.0 → 0.31.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.
|
@@ -137,25 +137,19 @@ function loadChunked(row, files, plan, wanted) {
|
|
|
137
137
|
const doImport = files.import ?? browserImport;
|
|
138
138
|
const asked = row.components.filter((c) => c.component_name && (wanted === "all" || wanted.has(c.component_name)));
|
|
139
139
|
const inPlan = asked.every((c) => Object.hasOwn(plan.entries, exportOf(c)));
|
|
140
|
-
const manifestUrl = `${plan.base}manifest.json`;
|
|
141
140
|
let manifest = null;
|
|
142
|
-
if (wanted === "all" || !inPlan)
|
|
143
|
-
let m = manifests.get(manifestUrl);
|
|
144
|
-
if (!m) {
|
|
145
|
-
m = get(manifestUrl).then(async (r) => {
|
|
146
|
-
const parsed = r.ok ? parseComponentManifest(await r.json().catch(() => null)) : null;
|
|
147
|
-
if (!parsed) throw new Error(`[bundles] ${row.org_slug}/${row.bundle_name}: manifest.json is not readable`);
|
|
148
|
-
return parsed;
|
|
149
|
-
});
|
|
150
|
-
m.catch(() => manifests.delete(manifestUrl));
|
|
151
|
-
manifests.set(manifestUrl, m);
|
|
152
|
-
}
|
|
153
|
-
manifest = await m;
|
|
154
|
-
}
|
|
141
|
+
if (wanted === "all" || !inPlan) manifest = await manifestOf(row, plan, get);
|
|
155
142
|
const fileOf = (name) => plan.entries[name] ?? manifest?.components[name]?.js;
|
|
156
143
|
const exportsWanted = [...new Set([...asked.map(exportOf), ...wanted === "all" && manifest ? BUNDLE_LEVEL_EXPORTS.filter((n) => manifest.components[n]) : []])].filter((n) => fileOf(n));
|
|
157
144
|
const css = new Set();
|
|
158
145
|
for (const n of exportsWanted) for (const f of manifest?.components[n]?.css ?? (plan.entries[n] ? plan.css : [])) css.add(f);
|
|
146
|
+
const closure = new Set();
|
|
147
|
+
for (const n of exportsWanted) {
|
|
148
|
+
const m = manifest?.components[n];
|
|
149
|
+
if (m) for (const f of [m.js, ...m.imports ?? []]) closure.add(f);
|
|
150
|
+
}
|
|
151
|
+
if (closure.size) files.preload?.([...closure].map((f) => `${plan.base}${f}`));
|
|
152
|
+
if (css.size) files.linkStyles?.([...css].map((f) => `${plan.base}${f}`));
|
|
159
153
|
const contractsUrl = `${plan.base}contracts.json`;
|
|
160
154
|
let contractsP = contractsOf.get(contractsUrl);
|
|
161
155
|
if (!contractsP) {
|
|
@@ -173,7 +167,6 @@ function loadChunked(row, files, plan, wanted) {
|
|
|
173
167
|
return [n, (await m)[n]];
|
|
174
168
|
});
|
|
175
169
|
const [loaded, contracts] = await Promise.all([Promise.all(imports), contractsP]);
|
|
176
|
-
if (css.size) files.linkStyles?.([...css].map((f) => `${plan.base}${f}`));
|
|
177
170
|
return projectModule(row, Object.fromEntries(loaded), contracts);
|
|
178
171
|
})();
|
|
179
172
|
pending.catch(() => chunkedBundles.delete(key));
|
|
@@ -181,6 +174,25 @@ function loadChunked(row, files, plan, wanted) {
|
|
|
181
174
|
}
|
|
182
175
|
return pending;
|
|
183
176
|
}
|
|
177
|
+
function manifestOf(row, plan, get) {
|
|
178
|
+
const manifestUrl = `${plan.base}manifest.json`;
|
|
179
|
+
let m = manifests.get(manifestUrl);
|
|
180
|
+
if (!m) {
|
|
181
|
+
m = get(manifestUrl).then(async (r) => {
|
|
182
|
+
const parsed = r.ok ? parseComponentManifest(await r.json().catch(() => null)) : null;
|
|
183
|
+
if (!parsed) throw new Error(`[bundles] ${row.org_slug}/${row.bundle_name}: manifest.json is not readable`);
|
|
184
|
+
return parsed;
|
|
185
|
+
});
|
|
186
|
+
m.catch(() => manifests.delete(manifestUrl));
|
|
187
|
+
manifests.set(manifestUrl, m);
|
|
188
|
+
}
|
|
189
|
+
return m;
|
|
190
|
+
}
|
|
191
|
+
function warmChunkManifest(row, files) {
|
|
192
|
+
const plan = row.specifier ? files.chunkPlan?.(row.specifier) : null;
|
|
193
|
+
if (!plan) return;
|
|
194
|
+
manifestOf(row, plan, files.fetch ?? ((u) => fetch(u))).catch(() => void 0);
|
|
195
|
+
}
|
|
184
196
|
var requiresOf = (row, files) => row.requires ?? (row.specifier && files.chunkPlan?.(row.specifier) ? row.specifier === "@stack/core" ? [] : ["@stack/core"] : void 0);
|
|
185
197
|
var escapeRe = (v) => v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
186
198
|
async function sharedDependencies(rows, files) {
|
|
@@ -274,4 +286,4 @@ function _clearBundleCache() {
|
|
|
274
286
|
manifests.clear();
|
|
275
287
|
contractsOf.clear();
|
|
276
288
|
}
|
|
277
|
-
export { loadBundlesSettled as a,
|
|
289
|
+
export { loadBundlesSettled as a, warmChunkManifest as c, parseComponentManifest as d, loadBundles as i, chunkPlan as l, isComponentExport as n, projectModule as o, loadBundle as r, runtimeReady as s, _clearBundleCache as t, parseChunkPlans as u };
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@ import { A as rootCells, C as CONTENT_FIELDS, D as hasRef, E as STORE_FIELDS, O
|
|
|
2
2
|
import { C as passesConditions, S as pageContext, T as settled, _ as EACH, a as VARIABLE_NAMESPACES, b as cellResolutionContext, c as pageVariables, d as resolveDescriptorVariables, f as selectionShape, g as variableReferences, h as variableLabels, i as UnsafeDocumentError, l as prepareDocument, m as validateDescriptor, n as RENDER_FUNCTIONS, o as descriptorShape, p as shapeAt, r as RENDER_FUNCTIONS_AHEAD, s as orderByVariable, t as PAGING_VARIABLES, u as queryKey, v as EACH_DEFAULT_AS, w as resolveReferences, x as isEach, y as cellContext } from "./chunks/query-D_f73wsU.js";
|
|
3
3
|
import { S as walkRequest, _ as stateNames, a as eachFormProblems, b as systemsFromProcess, c as validatePage, d as mergeStates, f as needsWalk, g as resolveWalkStart, h as referencedLabels, i as componentsFor, l as selectionIssues, m as readWalk, n as STORE_SCOPES, o as nearestNames, p as readField, r as WALK_DIRECTIONS, s as validateCell, t as RESPONSIVE_BUCKETS, u as RESERVED_LABELS, v as stateValue, x as walkKey, y as systemsFromGraphs } from "./chunks/validate-BfXuQLmV.js";
|
|
4
4
|
import { C as actionReferences, D as resolveAction, E as projectCellActions, S as actionProblems, T as normalizeActionDeclaration, _ as HOST_READ_KEY, a as deriveSectionReferences, b as isHostRead, c as nodePrintStyle, d as referencesFor, f as sectionAnchor, g as usesStructureLayout, h as tableOfContents, i as deriveSectionNumbering, l as normalizeStructure, m as structureIssues, n as SECTION_KINDS, r as deriveElementReferences, s as mergeSectionReferences, t as PAGE_DOCUMENT, u as numberingFor, v as bindHostReads, w as declaredActions, x as actionBindingKey, y as hostReadProblem } from "./chunks/structure-Ds2wfhkH.js";
|
|
5
|
-
import { a as loadBundlesSettled, c as
|
|
5
|
+
import { a as loadBundlesSettled, c as warmChunkManifest, d as parseComponentManifest, i as loadBundles, l as chunkPlan, n as isComponentExport, o as projectModule, r as loadBundle, s as runtimeReady, t as _clearBundleCache, u as parseChunkPlans } from "./chunks/load-BU9C8x6-.js";
|
|
6
6
|
import { a as normalizeRef, i as bundleScope, n as MAIN, o as refKey, r as PUBLIC, t as CORE_SPECIFIER } from "./chunks/refs-Csgh6rXq.js";
|
|
7
7
|
import { a as rowsInScope, i as rowForCell, n as pageBundleRefs, o as rowsNeededBy, r as pageBundles, t as componentNames } from "./chunks/page-bundles-dUYH4D73.js";
|
|
8
8
|
import { a as createStackStore, i as saveScope, n as clearScope, r as loadScope } from "./chunks/persistence-hurkUUQ0.js";
|
|
@@ -1184,4 +1184,4 @@ function manifestPageFrom(graphNodeId, data) {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
};
|
|
1186
1186
|
}
|
|
1187
|
-
export { CONTENT_FIELDS, CORE_SPECIFIER, DIAGNOSTICS, EACH, EACH_DEFAULT_AS, HOST_READ_KEY, HYDRATED_CELL_FIELDS, LAYER_ROLES, LAYOUT_TYPES, MAIN, PAGE_DOCUMENT, PAGE_RULES, PAGING_VARIABLES, PUBLIC, RENDER_FIELDS, RENDER_FUNCTIONS, RENDER_FUNCTIONS_AHEAD, RESERVED_LABELS, RESPONSIVE_BUCKETS, SECTION_KINDS, STORE_FIELDS, STORE_SCOPES, STRUCTURE_FIELDS, TOOL_OWNED_KEYS, UnsafeDocumentError, VARIABLE_NAMESPACES, WALK_DIRECTIONS, _clearBundleCache, actionBindingKey, actionProblems, actionReferences, assembleCellProps, attachSelectionSetters, attachViewStateSetters, bindHostReads, buildDataContext, bundleScope, cellAttributes, cellContext, cellPlacementStyle, cellPropSources, cellResolutionContext, chunkPlan, clearScope, collectDeclarations, collectDescriptors, collectScopeIds, collectStatic, componentNames, componentsFor, createStackStore, declaredActions, deriveElementReferences, deriveSectionNumbering, deriveSectionReferences, descriptorShape, eachFormProblems, editTarget, hasRef, hiddenWhenEmpty, hideWhenEmptyProblem, hostReadProblem, isComponentExport, isEach, isEmptyPropValue, isHostRead, layerName, loadBundle, loadBundles, loadBundlesSettled, loadPageData, loadScope, manifestPageFrom, mergeSectionReferences, mergeStates, nearestNames, needsWalk, nodePrintStyle, normalizeActionDeclaration, normalizeCell, normalizeRef, normalizeStructure, numberingFor, orderByVariable, pageBundleRefs, pageBundles, pageContainerStyle, pageContext, pageForCell, pageRuntimeFromValues, pageScopeKey, pageVariables, parseChunkPlans, parseComponentManifest, passesConditions, patchAt, prepareDocument, projectCellActions, projectCellData, projectLive, projectModule, projectScopeKey, projectSelections, projectViewState, queryKey, readField, readWalk, refKey, referencedLabels, referencesFor, resolveAction, resolveCell, resolveComponent, resolveDataSystem, resolveDeclarations, resolveDescriptorVariables, resolveReferences, resolveScopeId, resolveSystems, resolveWalkStart, rootCells, rowForCell, rowsInScope, rowsNeededBy, runtimeReady, saveScope, sectionAnchor, selectionIssues, selectionShape, settled, shallowEqualBundle, shapeAt, stateNames, stateValue, structureIssues, systemsFromGraphs, systemsFromProcess, tableOfContents, usesStructureLayout, validateCell, validateDescriptor, validateManifest, validatePage, variableLabels, variableReferences, walkKey, walkRequest };
|
|
1187
|
+
export { CONTENT_FIELDS, CORE_SPECIFIER, DIAGNOSTICS, EACH, EACH_DEFAULT_AS, HOST_READ_KEY, HYDRATED_CELL_FIELDS, LAYER_ROLES, LAYOUT_TYPES, MAIN, PAGE_DOCUMENT, PAGE_RULES, PAGING_VARIABLES, PUBLIC, RENDER_FIELDS, RENDER_FUNCTIONS, RENDER_FUNCTIONS_AHEAD, RESERVED_LABELS, RESPONSIVE_BUCKETS, SECTION_KINDS, STORE_FIELDS, STORE_SCOPES, STRUCTURE_FIELDS, TOOL_OWNED_KEYS, UnsafeDocumentError, VARIABLE_NAMESPACES, WALK_DIRECTIONS, _clearBundleCache, actionBindingKey, actionProblems, actionReferences, assembleCellProps, attachSelectionSetters, attachViewStateSetters, bindHostReads, buildDataContext, bundleScope, cellAttributes, cellContext, cellPlacementStyle, cellPropSources, cellResolutionContext, chunkPlan, clearScope, collectDeclarations, collectDescriptors, collectScopeIds, collectStatic, componentNames, componentsFor, createStackStore, declaredActions, deriveElementReferences, deriveSectionNumbering, deriveSectionReferences, descriptorShape, eachFormProblems, editTarget, hasRef, hiddenWhenEmpty, hideWhenEmptyProblem, hostReadProblem, isComponentExport, isEach, isEmptyPropValue, isHostRead, layerName, loadBundle, loadBundles, loadBundlesSettled, loadPageData, loadScope, manifestPageFrom, mergeSectionReferences, mergeStates, nearestNames, needsWalk, nodePrintStyle, normalizeActionDeclaration, normalizeCell, normalizeRef, normalizeStructure, numberingFor, orderByVariable, pageBundleRefs, pageBundles, pageContainerStyle, pageContext, pageForCell, pageRuntimeFromValues, pageScopeKey, pageVariables, parseChunkPlans, parseComponentManifest, passesConditions, patchAt, prepareDocument, projectCellActions, projectCellData, projectLive, projectModule, projectScopeKey, projectSelections, projectViewState, queryKey, readField, readWalk, refKey, referencedLabels, referencesFor, resolveAction, resolveCell, resolveComponent, resolveDataSystem, resolveDeclarations, resolveDescriptorVariables, resolveReferences, resolveScopeId, resolveSystems, resolveWalkStart, rootCells, rowForCell, rowsInScope, rowsNeededBy, runtimeReady, saveScope, sectionAnchor, selectionIssues, selectionShape, settled, shallowEqualBundle, shapeAt, stateNames, stateValue, structureIssues, systemsFromGraphs, systemsFromProcess, tableOfContents, usesStructureLayout, validateCell, validateDescriptor, validateManifest, validatePage, variableLabels, variableReferences, walkKey, walkRequest, warmChunkManifest };
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as runtimeReady } from "./chunks/load-
|
|
1
|
+
import { s as runtimeReady } from "./chunks/load-BU9C8x6-.js";
|
|
2
2
|
import { a as createStackStore, t as clearAllScopes } from "./chunks/persistence-hurkUUQ0.js";
|
|
3
3
|
import { PINNED_RUNTIMES, READY_GLOBAL, RESOLVE_GLOBAL, RUNTIME_GLOBAL, buildImportMap } from "@peripheries/runtime";
|
|
4
4
|
import * as React from "react";
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as prepareDocument } from "./chunks/query-D_f73wsU.js";
|
|
2
|
-
import { o as projectModule } from "./chunks/load-
|
|
2
|
+
import { o as projectModule } from "./chunks/load-BU9C8x6-.js";
|
|
3
3
|
import { i as bundleScope } from "./chunks/refs-Csgh6rXq.js";
|
|
4
4
|
import { n as pageBundleRefs, r as pageBundles } from "./chunks/page-bundles-dUYH4D73.js";
|
|
5
5
|
import { r as fromPageSteps } from "./chunks/forms-DxA9WzCt.js";
|
|
@@ -33,9 +33,11 @@ export type BundleFiles = {
|
|
|
33
33
|
fetch?: (url: string) => Promise<Response>;
|
|
34
34
|
chunkPlan?: (specifier: string) => ChunkPlan | null;
|
|
35
35
|
linkStyles?: (urls: string[]) => void;
|
|
36
|
+
preload?: (urls: string[]) => void;
|
|
36
37
|
};
|
|
37
38
|
export declare function runtimeReady(g?: Record<string, unknown>): Promise<void>;
|
|
38
39
|
export declare function loadBundle(row: BundleRow, files: BundleFiles, wanted?: ReadonlySet<string> | 'all'): Promise<LoadedBundle>;
|
|
40
|
+
export declare function warmChunkManifest(row: BundleRow, files: Pick<BundleFiles, 'chunkPlan' | 'fetch'>): void;
|
|
39
41
|
export type LoadedBundles = {
|
|
40
42
|
loaded: LoadedBundle[];
|
|
41
43
|
failed: string[];
|
|
@@ -19,7 +19,7 @@ export type * from './types.js';
|
|
|
19
19
|
export { assembleCellProps, hiddenWhenEmpty, hideWhenEmptyProblem, isEmptyPropValue, projectCellData, type CellMock, type CellStatus } from './cell-props.js';
|
|
20
20
|
export { cellAttributes, cellPlacementStyle, pageContainerStyle } from './layout.js';
|
|
21
21
|
export { deriveElementReferences, deriveSectionNumbering, deriveSectionReferences, mergeSectionReferences, nodePrintStyle, normalizeStructure, numberingFor, PAGE_DOCUMENT, referencesFor, SECTION_KINDS, sectionAnchor, structureIssues, tableOfContents, usesStructureLayout, type ContentsEntry, type LayoutNode, type SectionNumbering, type SectionReference, type SectionReferences, } from './structure.js';
|
|
22
|
-
export { _clearBundleCache, isComponentExport, loadBundle, loadBundles, loadBundlesSettled, projectModule, runtimeReady, type BundleFiles, type BundleRow, type LoadedBundle, type LoadedBundles, } from './bundles/load.js';
|
|
22
|
+
export { _clearBundleCache, isComponentExport, loadBundle, loadBundles, loadBundlesSettled, projectModule, runtimeReady, warmChunkManifest, type BundleFiles, type BundleRow, type LoadedBundle, type LoadedBundles, } from './bundles/load.js';
|
|
23
23
|
export { chunkPlan, parseChunkPlans, parseComponentManifest, type ChunkPlan, type ComponentManifest, type ManifestComponent } from './bundles/component-manifest.js';
|
|
24
24
|
export { componentNames, pageBundleRefs, pageBundles, rowForCell, rowsInScope, rowsNeededBy, type PageBundles } from './bundles/page-bundles.js';
|
|
25
25
|
export { bundleScope, CORE_SPECIFIER, MAIN, normalizeRef, PUBLIC, refKey, type BundleRef, type BundleScopeInput, type LineageRef, type SharedLineage } from './bundles/refs.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peripheries/renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "The one renderer for pages of federated component bundles: a framework-free core, a React renderer, the runtime a page boots with, and golden pages for testing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|