riverbankcms 0.7.1 → 0.8.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/acceptance/matrix.mjs +2 -27
- package/dist/cli/index.mjs +49887 -46219
- package/dist/cli/init-docs/content/cli-reference.md +0 -11
- package/dist/cli/init-docs/content/getting-started.md +0 -1
- package/dist/{eventUpsertInputSchema-DP8gbZJ9.mjs → eventUpsertInputSchema-BE3nSNsn.mjs} +1 -1
- package/dist/load-config-Ca13nCpT.mjs +4 -0
- package/dist/{sdk-peer-CADuG9SR.mjs → load-config-De0cFlPg.mjs} +89 -6
- package/dist/{style-BiosmAJm.mjs → local-sync-EcUwLrRx.mjs} +5453 -9856
- package/dist/scaffold/index.mjs +1 -1
- package/dist/{sdk-event-upsert-Cp043nSP.mjs → sdk-event-upsert-Bf6wAl4s.mjs} +136 -25
- package/dist/testing.mjs +3 -4
- package/package.json +1 -1
- package/dist/load-config-CkSoLJFY.mjs +0 -87
- package/dist/load-config-Dgi_eByc.mjs +0 -5
- /package/dist/{plan-BFmMfERc.mjs → plan-DtQEnwCM.mjs} +0 -0
package/dist/scaffold/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "../src-B8fOSKJ6.mjs";
|
|
3
|
-
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-
|
|
3
|
+
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-DtQEnwCM.mjs";
|
|
4
4
|
|
|
5
5
|
export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };
|
|
@@ -869,6 +869,66 @@ const buttonSystemSchema = z.strictObject({
|
|
|
869
869
|
});
|
|
870
870
|
});
|
|
871
871
|
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region ../theme-core/src/footer/mode.ts
|
|
874
|
+
const footerModeSchema = z.enum([
|
|
875
|
+
"default",
|
|
876
|
+
"blocks",
|
|
877
|
+
"default+blocks",
|
|
878
|
+
"none"
|
|
879
|
+
]);
|
|
880
|
+
/** Reads only SDK footer intent; unrelated config and theme fields are not authorities. */
|
|
881
|
+
function resolveSdkFooterMode(config) {
|
|
882
|
+
const parsed = z.object({ layout: z.object({ footerMode: footerModeSchema.optional() }).optional() }).safeParse(config);
|
|
883
|
+
return parsed.success ? parsed.data.layout?.footerMode ?? "default" : "default";
|
|
884
|
+
}
|
|
885
|
+
/** Mirrors the incumbent footer renderer's variant-specific identity rules. */
|
|
886
|
+
function resolveFooterBrandVisibility(footer) {
|
|
887
|
+
return {
|
|
888
|
+
showLogo: footer.variant === "simple" ? footer.logo?.showLogo === true : footer.logo?.showLogo !== false,
|
|
889
|
+
showTitle: footer.logo?.showLogoText ?? footer.showLogoText === true
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Resolve what to render for the footer given the current mode and whether the
|
|
894
|
+
* site is SDK-managed.
|
|
895
|
+
*
|
|
896
|
+
* Backwards compatible: missing/undefined mode is treated as 'default'.
|
|
897
|
+
*/
|
|
898
|
+
function resolveFooterRenderPlan(params) {
|
|
899
|
+
if (!params.isSdkSite) {
|
|
900
|
+
return {
|
|
901
|
+
mode: "default",
|
|
902
|
+
renderDefaultFooter: true,
|
|
903
|
+
renderFooterBlocks: false
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
const mode = params.mode ?? "default";
|
|
907
|
+
switch (mode) {
|
|
908
|
+
case "blocks": return {
|
|
909
|
+
mode: "blocks",
|
|
910
|
+
renderDefaultFooter: false,
|
|
911
|
+
renderFooterBlocks: true
|
|
912
|
+
};
|
|
913
|
+
case "default+blocks": return {
|
|
914
|
+
mode: "default+blocks",
|
|
915
|
+
renderDefaultFooter: true,
|
|
916
|
+
renderFooterBlocks: true
|
|
917
|
+
};
|
|
918
|
+
case "none": return {
|
|
919
|
+
mode: "none",
|
|
920
|
+
renderDefaultFooter: false,
|
|
921
|
+
renderFooterBlocks: false
|
|
922
|
+
};
|
|
923
|
+
case "default":
|
|
924
|
+
default: return {
|
|
925
|
+
mode: "default",
|
|
926
|
+
renderDefaultFooter: true,
|
|
927
|
+
renderFooterBlocks: false
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
872
932
|
//#endregion
|
|
873
933
|
//#region ../theme-core/src/lib/media.ts
|
|
874
934
|
const mediaTypeDiscriminants = [
|
|
@@ -2950,14 +3010,12 @@ function generateVariantCSS(variant, themeId, cardClasses, tokens, theme) {
|
|
|
2950
3010
|
const shadowValue = generateShadowValue$1(shadow$1);
|
|
2951
3011
|
rules.push(`box-shadow: ${shadowValue}`);
|
|
2952
3012
|
}
|
|
2953
|
-
|
|
2954
|
-
rules.push(`flex-direction: column`);
|
|
2955
|
-
rules.push(`position: relative`);
|
|
2956
|
-
rules.push(`overflow: visible`);
|
|
3013
|
+
const structureSelector = cardClasses.map((cardClass) => `:where([data-theme-scope="${themeId}"]) :where(.${cardClass})`).join(",\n");
|
|
2957
3014
|
const mediaRadius = MEDIA_CORNER_MAP[corners$1];
|
|
2958
3015
|
const mediaRules = [`border-top-left-radius: ${mediaRadius}`, `border-top-right-radius: ${mediaRadius}`];
|
|
2959
3016
|
const contentRules = [`padding: ${resolveContentPadding(variant)}`];
|
|
2960
3017
|
return [
|
|
3018
|
+
`${structureSelector} {\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: visible;\n}`,
|
|
2961
3019
|
`${containerSelector} {\n ${rules.join(";\n ")};\n}`,
|
|
2962
3020
|
...cardDecorationPseudoRules(containerSelectors, variant.decorations, resolveColor),
|
|
2963
3021
|
`${fallbackBackgroundSelector} {\n background: transparent;\n}`,
|
|
@@ -5523,12 +5581,6 @@ const footerVariant = z.enum([
|
|
|
5523
5581
|
"split"
|
|
5524
5582
|
]);
|
|
5525
5583
|
const footerMaxWidth = z.enum(["container", "full"]);
|
|
5526
|
-
const footerMode = z.enum([
|
|
5527
|
-
"default",
|
|
5528
|
-
"blocks",
|
|
5529
|
-
"default+blocks",
|
|
5530
|
-
"none"
|
|
5531
|
-
]);
|
|
5532
5584
|
const footerNavLayoutMode = z.enum([
|
|
5533
5585
|
"stack",
|
|
5534
5586
|
"inline",
|
|
@@ -5614,7 +5666,7 @@ const footerLogoSchema = z.object({
|
|
|
5614
5666
|
]).optional()
|
|
5615
5667
|
});
|
|
5616
5668
|
const footerSchema = z.object({
|
|
5617
|
-
mode:
|
|
5669
|
+
mode: footerModeSchema.optional(),
|
|
5618
5670
|
variant: footerVariant,
|
|
5619
5671
|
maxWidth: footerMaxWidth,
|
|
5620
5672
|
showLogoText: z.boolean().optional(),
|
|
@@ -6237,7 +6289,7 @@ const BUTTON_CONTRAST_POLICY = {
|
|
|
6237
6289
|
nonTextMinimumRatio: 3,
|
|
6238
6290
|
gradientSamplesPerSegment: 20,
|
|
6239
6291
|
alphaBackgrounds: "reject-without-known-surface",
|
|
6240
|
-
disabled: "
|
|
6292
|
+
disabled: "validated-colour-pair-with-muted-control-opacity"
|
|
6241
6293
|
};
|
|
6242
6294
|
function formatButtonColourContractError(error) {
|
|
6243
6295
|
switch (error.tag) {
|
|
@@ -6862,6 +6914,26 @@ function parseThemeForPersistence(value) {
|
|
|
6862
6914
|
};
|
|
6863
6915
|
}
|
|
6864
6916
|
|
|
6917
|
+
//#endregion
|
|
6918
|
+
//#region ../theme-core/src/buttons/affordanceSuppression.ts
|
|
6919
|
+
/**
|
|
6920
|
+
* Internal: the opt-out the generated affordance rule is written against.
|
|
6921
|
+
*
|
|
6922
|
+
* A button style may declare a trailing `affordance`, which the theme renders as
|
|
6923
|
+
* a CSS `::after` on every button of that variant. An authored button that
|
|
6924
|
+
* renders its own trailing icon must not also receive the theme's, or it shows
|
|
6925
|
+
* two.
|
|
6926
|
+
*
|
|
6927
|
+
* Deliberately not exported from `./index`. This used to be public, and two
|
|
6928
|
+
* block components reached past the theme to draw arrows of their own — one of
|
|
6929
|
+
* them doubling up on the styles that declare an affordance, both of them
|
|
6930
|
+
* overriding the twelve styles that deliberately declare none. Whether a button
|
|
6931
|
+
* carries a trailing affordance is the style's decision; the only caller that
|
|
6932
|
+
* legitimately opts out is the authored-button renderer, which reaches it
|
|
6933
|
+
* through `themeButtonClassNameWithTrailingIcon`.
|
|
6934
|
+
*/
|
|
6935
|
+
const AFFORDANCE_SUPPRESS_CLASS = "rb-affordance-off";
|
|
6936
|
+
|
|
6865
6937
|
//#endregion
|
|
6866
6938
|
//#region ../theme-core/src/buttons/classNames.ts
|
|
6867
6939
|
/**
|
|
@@ -6906,6 +6978,27 @@ function themeButtonClassName(spec) {
|
|
|
6906
6978
|
];
|
|
6907
6979
|
return classes.filter(Boolean).join(" ");
|
|
6908
6980
|
}
|
|
6981
|
+
/**
|
|
6982
|
+
* Button classes for an authored button that renders its own trailing icon.
|
|
6983
|
+
*
|
|
6984
|
+
* A separate function rather than a flag on `themeButtonClassName`, because
|
|
6985
|
+
* there is exactly one caller and it should stay visible in a diff. The name
|
|
6986
|
+
* states what the caller knows to be true of its own markup — that it renders a
|
|
6987
|
+
* trailing icon — rather than what the theme does about it. The consequence is
|
|
6988
|
+
* the theme's to decide and to change; a caller naming the consequence would be
|
|
6989
|
+
* asserting a policy it does not own, and would quietly become a lie the moment
|
|
6990
|
+
* that policy moved.
|
|
6991
|
+
*
|
|
6992
|
+
* Do not reach for this to remove an arrow you simply do not want. A trailing
|
|
6993
|
+
* affordance is declared by the button style, and a block overriding that is the
|
|
6994
|
+
* defect this replaced.
|
|
6995
|
+
*/
|
|
6996
|
+
function themeButtonClassNameWithTrailingIcon(spec) {
|
|
6997
|
+
return themeButtonClassName({
|
|
6998
|
+
...spec,
|
|
6999
|
+
extraClassName: [spec.extraClassName, AFFORDANCE_SUPPRESS_CLASS].filter(Boolean).join(" ")
|
|
7000
|
+
});
|
|
7001
|
+
}
|
|
6909
7002
|
|
|
6910
7003
|
//#endregion
|
|
6911
7004
|
//#region ../theme-core/src/interactive/generateBaseCSS.ts
|
|
@@ -9158,27 +9251,20 @@ function resolvedButtonFocusDeclarations(indicator, role) {
|
|
|
9158
9251
|
] : [["outline", value("outline", `3px solid ${indicator.colorCss}`)], ["outline-offset", value("outline-offset", "3px")]];
|
|
9159
9252
|
}
|
|
9160
9253
|
/**
|
|
9161
|
-
* Disabled buttons
|
|
9162
|
-
*
|
|
9163
|
-
*
|
|
9164
|
-
* remain observable.
|
|
9254
|
+
* Disabled buttons are deliberately muted as unavailable controls. Native
|
|
9255
|
+
* disabled controls are exempt from active-control contrast requirements;
|
|
9256
|
+
* opacity distinguishes the state without introducing a focus-like outline.
|
|
9257
|
+
* Retaining pointer events lets the not-allowed cursor remain observable.
|
|
9165
9258
|
*/
|
|
9166
9259
|
const RESOLVED_BUTTON_DISABLED_DECLARATIONS = [
|
|
9167
9260
|
["cursor", "not-allowed"],
|
|
9168
9261
|
["transform", "none"],
|
|
9169
9262
|
["box-shadow", "none"],
|
|
9170
|
-
["
|
|
9171
|
-
["outline-offset", "-4px"]
|
|
9263
|
+
["opacity", "0.55"]
|
|
9172
9264
|
];
|
|
9173
9265
|
|
|
9174
9266
|
//#endregion
|
|
9175
9267
|
//#region ../theme-core/src/buttons/generateButtonCss.ts
|
|
9176
|
-
/**
|
|
9177
|
-
* Class the `button` runtime node adds when it renders its own trailing icon,
|
|
9178
|
-
* so a node-level icon suppresses the theme's CSS `::after` affordance.
|
|
9179
|
-
* Shared so generator and renderer can't drift.
|
|
9180
|
-
*/
|
|
9181
|
-
const AFFORDANCE_SUPPRESS_CLASS = "rb-affordance-off";
|
|
9182
9268
|
const BUTTON_SIZE_NAMES = buttonSizeNameSchema.options;
|
|
9183
9269
|
/**
|
|
9184
9270
|
* Letter spacing token → CSS value.
|
|
@@ -28642,6 +28728,31 @@ function applyPageOpeningForegroundToTheme(theme, recipe, context) {
|
|
|
28642
28728
|
};
|
|
28643
28729
|
}
|
|
28644
28730
|
|
|
28731
|
+
//#endregion
|
|
28732
|
+
//#region ../theme-core/src/site-styles/effectivePageDesign.ts
|
|
28733
|
+
/**
|
|
28734
|
+
* Every page with an applicable site style has an effective design, whether or
|
|
28735
|
+
* not a design version was ever persisted. Missing persistence is ordinary
|
|
28736
|
+
* default resolution, not a failure.
|
|
28737
|
+
*
|
|
28738
|
+
* Corrupt persisted state never reaches this function: callers keep their own
|
|
28739
|
+
* invalid state untouched and only resolve `stored` values they could parse.
|
|
28740
|
+
*/
|
|
28741
|
+
function resolveEffectivePageDesignIntent(stored, currentSiteStyleId) {
|
|
28742
|
+
if (stored) {
|
|
28743
|
+
return {
|
|
28744
|
+
kind: "resolved",
|
|
28745
|
+
intent: currentSiteStyleId ? rebasePageDesignIntentToSiteStyle(stored, currentSiteStyleId) : stored,
|
|
28746
|
+
source: "stored"
|
|
28747
|
+
};
|
|
28748
|
+
}
|
|
28749
|
+
return currentSiteStyleId ? {
|
|
28750
|
+
kind: "resolved",
|
|
28751
|
+
intent: buildInitialPolicyPageDesignIntent(currentSiteStyleId),
|
|
28752
|
+
source: "default"
|
|
28753
|
+
} : { kind: "no-site-style" };
|
|
28754
|
+
}
|
|
28755
|
+
|
|
28645
28756
|
//#endregion
|
|
28646
28757
|
//#region ../theme-core/src/site-styles/pageDesignAuthority.ts
|
|
28647
28758
|
const nonEmptyStringSchema = z.string().min(1);
|
|
@@ -32737,4 +32848,4 @@ function parseSdkEventRunUpsertInput(input, runIndex, options) {
|
|
|
32737
32848
|
}
|
|
32738
32849
|
|
|
32739
32850
|
//#endregion
|
|
32740
|
-
export {
|
|
32851
|
+
export { generateBaseInteractiveCSS as $, createContentEntryRef as $n, NAV_LINK_LETTER_SPACING_MAP as $t, getGradientPreset as A, featuresFromHex as An, resolveTokenOrCssColorValue as At, generateCssVars as B, normalizeCardRole as Bn, featureCardCompositionTreatmentValues as Bt, retargetCompiledBoundaryRuntimeForContentAdjacency as C, resolveSurfaceForeground as Cn, MQ_SM_DOWN as Ct, compileTransitionRuntime as D, defaultThemeTokens as Dn, isCssColorLiteral as Dt, getCuratedSiteStyle as E, buildThemeTokens as En, headerVariantValues as Et, parseBackgroundAppearanceColorToken as F, surfaceForegroundStyle as Fn, defineBlockDesignCapability as Ft, resolvedButtonColourDeclarations as G, footerModeSchema as Gn, testimonialsCompositionTreatmentValues as Gt, PUBLIC_BUTTON_ROLES as H, mediaSchema as Hn, introCompositionTreatmentValues as Ht, defineBlockDesignMetadata as I, surfaceForegroundValue as In, defineFrameCapability as It, contextualButtonSurfaceStyles as J, unsafeAsOpaqueButtonColourToken as Jn, getComponentBorderWidthPx as Jt, resolvedButtonFocusDeclarations as K, VARIANT_ROLES as Kn, tileTreatmentValues as Kt, require_jsx_runtime as L, generateShadowValue$1 as Ln, defineNoBlockDesignCapability as Lt, boundaryRuntimeMetricsForTransition as M, oklchToHexGamut as Mn, asAppearancePresetId as Mt, backgroundAppearanceColorTokenNames as N, DEFAULT_SURFACE_TEXT_COLOR as Nn, asDesignBlockId as Nt, gradientToCss as O, ORDINARY_TEXT_MIN_CONTRAST_RATIO as On, resolveOnColorForThemeToken as Ot, backgroundAppearanceQuickColorTokenNames as P, surfaceForegroundDeclarations as Pn, assertNever$1 as Pt, generateEffectsCSS as Q, createCommandRef as Qn, NAV_LINK_BORDER_RADIUS_MAP as Qt, require_react as R, cardRoleSchema as Rn, eventListTreatmentValues as Rt, eventBookingOfferIntentSchema as S, textColorStyle as Sn, MQ_MD_DOWN as St, readHeaderNavFontSizePreference as T, onColorTokenName as Tn, MQ_TABLET_ONLY as Tt, generateButtonCss as U, mediaTypeDiscriminants as Un, makeBoundaryId as Ut, buttonStyleSelectionSchema as V, mediaIdentifierSchema as Vn, headingDecorationColorTokenValues as Vt, RESOLVED_BUTTON_DISABLED_DECLARATIONS as W, persistableMediaSchema as Wn, offeringsPreviewCompositionTreatmentValues as Wt, resolveContextualButtonRole as X, createBlockRef as Xn, parseBlockCustomCssRules as Xt, deriveButtonSurfaceContext as Y, parseBlockColorToken as Yn, getComponentShadowVar as Yt, generateDefaultButtonSystem as Z, createBlocksRef as Zn, parseCustomCssRules as Zt, entryIdentifierForCommand as _, backgroundColorStyle as _n, BREAKPOINT_LG as _t, classifySdkEventBookingOffer as a, INPUT_SPACING_MAP as an, createPageRef as ar, compileButtonColourStates as at, pagePathForCommand as b, mergeStyles as bn, BREAKPOINT_XL as bt, stableStringify as c, ACCORDION_SPACING_MAP as cn, refSlug as cr, expandPalette as ct, mapEventCommandContent as d, ICON_CONFIG as dn, boxBackgroundOverlaySchema as dt, NAV_LINK_PADDING_MAP as en, createEventCategoryRef as er, generateInteractiveChildInheritanceCSS as et, evaluateSiteCommandBatchExposure as f, ICON_SIZE_PX as fn, boxBackgroundSchema as ft, blockOrderIdentifiersForCommand as g, TokenResolver as gn, renderHeaderPaintTargetRules as gt, blockIdentifierForCommand as h, generateCardCss as hn, getHeaderPaintTargets as ht, classifySdkEventSchedule as i, INPUT_FONT_SIZE_MAP as in, createNavigationRef as ir, parseThemeForPersistence as it, parseGradientPresetId as j, hexToRgb as jn, pageDesignEditorBackgroundOverrideOwner as jt, GRADIENT_PRESET_IDS as k, contrastRatio as kn, resolveThemeColorReferenceValue as kt, createDryRunReport as l, ACCORDION_TRIGGER_FONT_SCALE as ln, slugPart as lr, getTextColorForBackground as lt, getSiteCommandMetadata as m, getDefaultCardVariants as mn, generateMobileOverlayBackdropFilterFix as mt, sdkEventOccurrenceInputSchema as n, NAV_LINK_TEXT_SIZE_MAP as nn, createFooterRef as nr, themeButtonClassName as nt, venueManagementFields as o, LABEL_FONT_SIZE_MAP as on, createSiteCommandSiteRef as or, formatButtonColourContractError as ot, evaluateSiteCommandExposure as p, generateCardCoreCss as pn, generateHeaderScrollTreatmentStyles as pt, contextualButtonSurfaceResetStyles as q, buttonVariantIdSchema as qn, visibleHeadingDecorationFamilyValues as qt, sdkEventUpsertOptionalFieldSchemas as r, FONT_WEIGHT_MAP$1 as rn, createFormRef as rr, themeButtonClassNameWithTrailingIcon as rt, sortRecord as s, ACCORDION_OPEN_ACCENT_THICKNESS as sn, createVenueRef as sr, generateShadowValue as st, classifySdkEventTiming as t, NAV_LINK_PADDING_X_MAP as tn, createEventSeriesRef as tr, parseThemeButtonVariantId as tt, parseAndPlanCommandBatchForTypes as u, ACCORDION_TRIGGER_LETTER_SPACING as un, __toESM as ur, themeSchema as ut, pageIdentifierForBlockCommand as v, borderColorStyle as vn, BREAKPOINT_MD as vt, mergeHeaderNavTypographyPreference as w, isOnColorBackgroundCandidateToken as wn, MQ_SM_UP as wt, hasConfiguredBookingVertical as x, rgbColorValue as xn, MQ_LG_UP as xt, pageIdentifierForCommand as y, cssVarValue as yn, BREAKPOINT_SM as yt, pickShadeTowardBackground as z, cardVariantRoleValues as zn, eyebrowTreatmentValues as zt };
|
package/dist/testing.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./sdk-event-upsert-
|
|
2
|
+
import "./sdk-event-upsert-Bf6wAl4s.mjs";
|
|
3
3
|
import "./src-B8fOSKJ6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import "./sdk-peer-CADuG9SR.mjs";
|
|
4
|
+
import { n as syncLocalMediaForPush, r as syncLocalMediaForPull, y as writeMediaManifest } from "./local-sync-EcUwLrRx.mjs";
|
|
6
5
|
|
|
7
|
-
export {
|
|
6
|
+
export { syncLocalMediaForPull, syncLocalMediaForPush, writeMediaManifest };
|
package/package.json
CHANGED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { n as assertCompatibleSdkPeer } from "./sdk-peer-CADuG9SR.mjs";
|
|
3
|
-
import { dirname, resolve } from "path";
|
|
4
|
-
import { createJiti } from "jiti";
|
|
5
|
-
import { existsSync } from "fs";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
|
|
8
|
-
//#region src/load-config.ts
|
|
9
|
-
/**
|
|
10
|
-
* Config file loader for riverbank.config.ts
|
|
11
|
-
*
|
|
12
|
-
* Uses jiti to load TypeScript config files at runtime without
|
|
13
|
-
* requiring a build step.
|
|
14
|
-
*/
|
|
15
|
-
const DEFAULT_CONFIG_FILENAME = "riverbank.config.ts";
|
|
16
|
-
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
/**
|
|
18
|
-
* Load builder config from a TypeScript file.
|
|
19
|
-
*
|
|
20
|
-
* @param configPath - Path to config file, or directory containing riverbank.config.ts
|
|
21
|
-
* @returns The loaded config object
|
|
22
|
-
* @throws Error if config file not found or invalid
|
|
23
|
-
*/
|
|
24
|
-
async function loadConfigFile(configPath) {
|
|
25
|
-
const resolvedPath = resolveConfigPath(configPath);
|
|
26
|
-
if (!existsSync(resolvedPath)) {
|
|
27
|
-
throw new Error(`Config file not found: ${resolvedPath}\n` + `Create a riverbank.config.ts file or specify a path with --config`);
|
|
28
|
-
}
|
|
29
|
-
assertCompatibleSdkPeer(resolvedPath);
|
|
30
|
-
process.stderr.write(`Loading config from ${resolvedPath}...\n`);
|
|
31
|
-
const alias = {};
|
|
32
|
-
const sourceConfigPath = resolve(currentDir, "..", "config", "index.ts");
|
|
33
|
-
const sourceIndexPath = resolve(currentDir, "..", "index.ts");
|
|
34
|
-
if (existsSync(sourceConfigPath)) {
|
|
35
|
-
alias["@riverbankcms/sdk/config"] = sourceConfigPath;
|
|
36
|
-
}
|
|
37
|
-
if (existsSync(sourceIndexPath)) {
|
|
38
|
-
alias["@riverbankcms/sdk"] = sourceIndexPath;
|
|
39
|
-
}
|
|
40
|
-
const blocksDir = resolve(currentDir, "../../../blocks/src");
|
|
41
|
-
if (existsSync(blocksDir)) {
|
|
42
|
-
alias["@riverbankcms/blocks"] = blocksDir;
|
|
43
|
-
}
|
|
44
|
-
const mediaCorePath = resolve(currentDir, "../../../media-core/src/index.ts");
|
|
45
|
-
if (existsSync(mediaCorePath)) {
|
|
46
|
-
alias["@riverbankcms/media-core"] = mediaCorePath;
|
|
47
|
-
}
|
|
48
|
-
const jiti = createJiti(import.meta.url, {
|
|
49
|
-
fsCache: false,
|
|
50
|
-
moduleCache: false,
|
|
51
|
-
alias: Object.keys(alias).length > 0 ? alias : undefined,
|
|
52
|
-
jsx: Object.keys(alias).length > 0
|
|
53
|
-
});
|
|
54
|
-
try {
|
|
55
|
-
const configModule = await jiti.import(resolvedPath);
|
|
56
|
-
const config = configModule.default ?? configModule.config ?? configModule;
|
|
57
|
-
if (!config || typeof config !== "object") {
|
|
58
|
-
throw new Error("Config file must export a configuration object");
|
|
59
|
-
}
|
|
60
|
-
return config;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
if (error instanceof Error) {
|
|
63
|
-
throw new Error(`Failed to load config: ${error.message}`);
|
|
64
|
-
}
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Resolve config path from user input.
|
|
70
|
-
*
|
|
71
|
-
* If no path provided, looks for riverbank.config.ts in cwd.
|
|
72
|
-
* If path is a directory, looks for riverbank.config.ts in that directory.
|
|
73
|
-
* If path is a file, uses it directly.
|
|
74
|
-
*/
|
|
75
|
-
function resolveConfigPath(configPath) {
|
|
76
|
-
if (!configPath) {
|
|
77
|
-
return resolve(process.cwd(), DEFAULT_CONFIG_FILENAME);
|
|
78
|
-
}
|
|
79
|
-
const resolved = resolve(configPath);
|
|
80
|
-
if (existsSync(resolved) && !resolved.endsWith(".ts") && !resolved.endsWith(".js")) {
|
|
81
|
-
return resolve(resolved, DEFAULT_CONFIG_FILENAME);
|
|
82
|
-
}
|
|
83
|
-
return resolved;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
//#endregion
|
|
87
|
-
export { loadConfigFile as t };
|
|
File without changes
|