@purestack/ts-common 1.1.15 → 1.1.16
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/ts-common.d.mts +66 -22
- package/dist/ts-common.d.mts.map +1 -1
- package/dist/ts-common.mjs +1 -1
- package/package.json +4 -4
package/dist/ts-common.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @purestack/ts-common v1.1.
|
|
1
|
+
/*! @purestack/ts-common v1.1.16 | (c) 2026 Ahmed Yasin Koculu | MIT License */
|
|
2
2
|
|
|
3
3
|
import { SemanticTone, ThemeOptions, ThemeOptionsInput, ThemeStylesheetLink } from "@purestack/ts-style";
|
|
4
4
|
import { DeepPartial } from "@purestack/ts-util";
|
|
@@ -7,6 +7,8 @@ import { BasicHeadConfig, TSNode } from "@purestack/ts-html";
|
|
|
7
7
|
/** Converts source code to highlighted pre/code HTML. */
|
|
8
8
|
interface MdxCodeHighlighter {
|
|
9
9
|
codeToHtml: (code: string, lang?: string) => string | Promise<string>;
|
|
10
|
+
/** Persist buffered computation results after a render batch. Await producers before calling. */
|
|
11
|
+
flush?: () => void | Promise<void>;
|
|
10
12
|
}
|
|
11
13
|
//#endregion
|
|
12
14
|
//#region packages/ts-common/src/codeLanguages.d.ts
|
|
@@ -175,31 +177,39 @@ interface PageNavigation {
|
|
|
175
177
|
}
|
|
176
178
|
//#endregion
|
|
177
179
|
//#region packages/ts-common/src/site-config-types.d.ts
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
extensions: SiteExtensions;
|
|
180
|
+
/** Settings normalized by the builder before plugin configuration runs. */
|
|
181
|
+
interface CoreSiteConfig {
|
|
181
182
|
rootDir: string;
|
|
182
183
|
contentDir: string;
|
|
183
184
|
outDir: string;
|
|
184
185
|
publishDir: string;
|
|
185
186
|
basePath: string;
|
|
186
187
|
siteTitle: string;
|
|
187
|
-
favicon?: string;
|
|
188
|
-
logo: SiteLogoConfig;
|
|
189
|
-
docLayout: DocLayoutConfig;
|
|
190
|
-
style: SiteStyleConfig;
|
|
191
188
|
html: SiteHtmlConfig;
|
|
192
189
|
navigation: NavigationConfig;
|
|
193
|
-
pageToc: PageTocConfig;
|
|
194
|
-
auth: AuthConfig;
|
|
195
190
|
scripts: SiteScriptsConfig;
|
|
196
191
|
sitemap: SitemapConfig;
|
|
197
|
-
consent: ConsentConfig;
|
|
198
|
-
analytics: AnalyticsConfig;
|
|
199
|
-
pagefind: PagefindConfig;
|
|
200
|
-
preview: PreviewConfig;
|
|
201
192
|
i18n: I18nConfig;
|
|
202
193
|
mdx: SiteMdxConfig;
|
|
194
|
+
/**
|
|
195
|
+
* Whether plugins may read and write persistent caches outside the output
|
|
196
|
+
* directory. Set per run (`--no-cache`, `options.cache`), never by site settings.
|
|
197
|
+
*/
|
|
198
|
+
cache: boolean;
|
|
199
|
+
}
|
|
200
|
+
interface SiteConfig extends CoreSiteConfig {
|
|
201
|
+
/** Plugin-owned settings, normalized by the installed owners. */
|
|
202
|
+
extensions: SiteExtensions;
|
|
203
|
+
favicon?: string;
|
|
204
|
+
logo?: SiteLogoConfig;
|
|
205
|
+
docLayout?: DocLayoutConfig;
|
|
206
|
+
style?: SiteStyleConfig;
|
|
207
|
+
pageToc?: PageTocConfig;
|
|
208
|
+
auth?: AuthConfig;
|
|
209
|
+
consent?: ConsentConfig;
|
|
210
|
+
analytics?: AnalyticsConfig;
|
|
211
|
+
pagefind?: PagefindConfig;
|
|
212
|
+
preview?: PreviewConfig;
|
|
203
213
|
}
|
|
204
214
|
/** Plugins may augment this interface with optional, typed namespaces. */
|
|
205
215
|
interface SiteExtensions {
|
|
@@ -291,27 +301,35 @@ interface I18nConfig {
|
|
|
291
301
|
cookieName: string;
|
|
292
302
|
}
|
|
293
303
|
interface SiteMdxConfig {
|
|
294
|
-
|
|
304
|
+
/** An optional provider-owned backend identifier. Core does not select an engine. */
|
|
305
|
+
highlighter?: string;
|
|
295
306
|
disableHighlighter: boolean;
|
|
296
307
|
compileMdAsMdx: boolean;
|
|
297
308
|
}
|
|
298
309
|
type SiteStyleConfigInput = DeepPartial<Omit<SiteStyleConfig, 'theme'>> & {
|
|
299
310
|
theme?: ThemeOptionsInput;
|
|
300
311
|
};
|
|
301
|
-
type SiteConfigInput = DeepPartial<Omit<SiteConfig, 'style'>> & {
|
|
312
|
+
type SiteConfigInput = DeepPartial<Omit<SiteConfig, 'style' | 'cache'>> & {
|
|
302
313
|
style?: SiteStyleConfigInput;
|
|
303
314
|
};
|
|
315
|
+
/** Core fields are ready; plugin sections may still contain partial input. */
|
|
316
|
+
type SiteConfigDraft = CoreSiteConfig & Omit<SiteConfigInput, keyof CoreSiteConfig | 'extensions'> & {
|
|
317
|
+
extensions: DeepPartial<SiteExtensions>;
|
|
318
|
+
};
|
|
304
319
|
/** Inputs for a pure configuration contribution, before build factories run. */
|
|
305
|
-
interface SiteConfigResolution {
|
|
306
|
-
config:
|
|
320
|
+
interface SiteConfigResolution<TConfig = SiteConfigDraft> {
|
|
321
|
+
config: TConfig;
|
|
307
322
|
input: SiteConfigInput;
|
|
308
323
|
file: SiteConfigInput;
|
|
309
324
|
}
|
|
310
325
|
type SiteConfigResolver = (source: SiteConfigResolution) => DeepPartial<SiteConfig>;
|
|
311
|
-
/**
|
|
326
|
+
/** Runs after every installed owner's normalizer has completed. */
|
|
327
|
+
type SiteConfigFinalizer = (source: SiteConfigResolution<SiteConfig>) => DeepPartial<SiteConfig>;
|
|
328
|
+
/** Overrides, normalization, then dependent settings; all run before factories. */
|
|
312
329
|
interface SiteConfigContributions {
|
|
313
330
|
resolve?: SiteConfigResolver;
|
|
314
|
-
|
|
331
|
+
normalize?: SiteConfigResolver;
|
|
332
|
+
finalize?: SiteConfigFinalizer;
|
|
315
333
|
}
|
|
316
334
|
//#endregion
|
|
317
335
|
//#region packages/ts-common/src/frontmatter-types.d.ts
|
|
@@ -579,7 +597,7 @@ interface PageContext {
|
|
|
579
597
|
pageInfo: PageInfo;
|
|
580
598
|
navigation?: TsSsgNavigation;
|
|
581
599
|
outline?: PageOutlineItem[];
|
|
582
|
-
theme
|
|
600
|
+
theme?: ThemeOptions;
|
|
583
601
|
basePath: string;
|
|
584
602
|
locale?: string;
|
|
585
603
|
locales: string[];
|
|
@@ -634,6 +652,32 @@ type PageHeadTemplate = (input: PageTemplateInput) => TSNode<'head'> | Promise<T
|
|
|
634
652
|
export declare function resolvePageContext(head: unknown): PageContext;
|
|
635
653
|
export declare function tryResolvePageContext(head: unknown): PageContext | undefined;
|
|
636
654
|
//#endregion
|
|
655
|
+
//#region packages/ts-common/src/site-assets.d.ts
|
|
656
|
+
/** A local source selected through the site's URL and locale resolution rules. */
|
|
657
|
+
interface AssetSource {
|
|
658
|
+
relPath: string;
|
|
659
|
+
absPath: string;
|
|
660
|
+
/** Root-relative URL, without the site's base path. */
|
|
661
|
+
publicPath: string;
|
|
662
|
+
}
|
|
663
|
+
interface PageAssetInput {
|
|
664
|
+
document: Document;
|
|
665
|
+
sourceRelPath: string;
|
|
666
|
+
/** Resolves original content assets and records dependencies. Generated outputs are not resolver inputs. */
|
|
667
|
+
resolveSource: (element: Element, url: string) => Promise<AssetSource | undefined>;
|
|
668
|
+
/** Records another content-root-relative input, including a file not yet created. */
|
|
669
|
+
dependOn: (relPath: string) => void;
|
|
670
|
+
/** Await writes before returning. Use immutable content-addressed names within this namespace. */
|
|
671
|
+
emit: (fileName: string, data: Uint8Array) => Promise<string>;
|
|
672
|
+
}
|
|
673
|
+
/** Each build/session owns its processors; core handles generated files and invalidation. */
|
|
674
|
+
interface SiteAssets {
|
|
675
|
+
/** A unique path segment under /_assets/. */
|
|
676
|
+
namespace: string;
|
|
677
|
+
/** Ordered within a page; different pages may run concurrently. Input methods expire when this call completes. */
|
|
678
|
+
processPage: (input: PageAssetInput) => void | Promise<void>;
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
637
681
|
//#region packages/ts-common/src/site-search.d.ts
|
|
638
682
|
/** Search output owned by a plugin; the builder manages output invalidation. */
|
|
639
683
|
interface SiteSearch {
|
|
@@ -664,5 +708,5 @@ interface SiteStyles {
|
|
|
664
708
|
}): Promise<WriteStylesResult>;
|
|
665
709
|
}
|
|
666
710
|
//#endregion
|
|
667
|
-
export type { AnalyticsConfig, AuthConfig, ClassicLogoConfig, ConsentCategory, ConsentConfig, ConsentScript, ConsentService, DocLayoutConfig, FrontmatterEmbedOptions, FrontmatterLayoutOptions, FrontmatterNavOptions, Ga4Config, I18nConfig, I18nUrlStrategy, LogoAppearance, LogoConfig, LogoLayout, LogoMarkStyle, LogoShape, LogoSize, LogoWordmarkStyle, MdxCodeHighlighter, NavItem, NavigationConfig, NavigationMode, NavigationSort, PageContext, PageFrontmatter, PageHeadConfigInput, PageHeadConfigTemplate, PageHeadTemplate, PageInfo, PageNavigation, PageNavigationLink, PageNavigationLinks, PageOutlineItem, PageTemplate, PageTemplateInput, PageTemplateMap, PageTocConfig, PageTranslationInfo, PagefindConfig, ParsedFrontmatterSource, PreviewConfig, RobotsConfig, RuntimeEmbedPosition, RuntimeEmbeds, SiteConfig, SiteConfigContributions, SiteConfigInput, SiteConfigResolution, SiteConfigResolver, SiteExtensions, SiteHtmlConfig, SiteLogoConfig, SiteMdxConfig, SiteScriptsConfig, SiteSearch, SiteStyleConfig, SiteStyleConfigInput, SiteStyles, SitemapConfig, TsSsgNavigation, WriteStylesResult };
|
|
711
|
+
export type { AnalyticsConfig, AssetSource, AuthConfig, ClassicLogoConfig, ConsentCategory, ConsentConfig, ConsentScript, ConsentService, CoreSiteConfig, DocLayoutConfig, FrontmatterEmbedOptions, FrontmatterLayoutOptions, FrontmatterNavOptions, Ga4Config, I18nConfig, I18nUrlStrategy, LogoAppearance, LogoConfig, LogoLayout, LogoMarkStyle, LogoShape, LogoSize, LogoWordmarkStyle, MdxCodeHighlighter, NavItem, NavigationConfig, NavigationMode, NavigationSort, PageAssetInput, PageContext, PageFrontmatter, PageHeadConfigInput, PageHeadConfigTemplate, PageHeadTemplate, PageInfo, PageNavigation, PageNavigationLink, PageNavigationLinks, PageOutlineItem, PageTemplate, PageTemplateInput, PageTemplateMap, PageTocConfig, PageTranslationInfo, PagefindConfig, ParsedFrontmatterSource, PreviewConfig, RobotsConfig, RuntimeEmbedPosition, RuntimeEmbeds, SiteAssets, SiteConfig, SiteConfigContributions, SiteConfigDraft, SiteConfigFinalizer, SiteConfigInput, SiteConfigResolution, SiteConfigResolver, SiteExtensions, SiteHtmlConfig, SiteLogoConfig, SiteMdxConfig, SiteScriptsConfig, SiteSearch, SiteStyleConfig, SiteStyleConfigInput, SiteStyles, SitemapConfig, TsSsgNavigation, WriteStylesResult };
|
|
668
712
|
//# sourceMappingURL=ts-common.d.mts.map
|
package/dist/ts-common.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-common.d.mts","names":[],"sources":["../src/code-highlighter.ts","../src/codeLanguages.ts","../src/consent-types.ts","../src/logo-types.ts","../src/navMenu-types.ts","../src/site-config-types.ts","../src/frontmatter-types.ts","../src/ts-ssg-context.ts","../src/isTocEnabled.ts","../src/page-template-types.ts","../src/resolvePageContext.ts","../src/site-search.ts","../src/site-styles.ts"],"mappings":";;;;;UACiB;EACf,aAAa,cAAc,2BAA2B;;;;
|
|
1
|
+
{"version":3,"file":"ts-common.d.mts","names":[],"sources":["../src/code-highlighter.ts","../src/codeLanguages.ts","../src/consent-types.ts","../src/logo-types.ts","../src/navMenu-types.ts","../src/site-config-types.ts","../src/frontmatter-types.ts","../src/ts-ssg-context.ts","../src/isTocEnabled.ts","../src/page-template-types.ts","../src/resolvePageContext.ts","../src/site-assets.ts","../src/site-search.ts","../src/site-styles.ts"],"mappings":";;;;;UACiB;EACf,aAAa,cAAc,2BAA2B;;EAEtD,qBAAqB;;;;qBCiFV;qBAQA,uBAAuB;wBAMpB,sBAAsB;;;UCnGrB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA;EACA;EACA;EACA;EACA,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,UAAU;;;;KCzCA;KACA;KACA;KACA;KACA;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,OAAO;EACP,aAAa;EACb,YAAY;EACZ,gBAAgB;EAChB,QAAQ;EACR,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe,uBAAuB,YAAY;EAClD;;;;KCtEU;KACA;UAEK;EACf,OAAO;EACP;EACA;EACA;EACA,SAAS;EACT;EACA,OAAO;;EAEP;;EAEA;;UAGe;EACf;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA,OAAO;;UAGQ;EACf;EACA;;UAGe;EACf,WAAW;EACX,OAAO;;UAGQ;EACf,MAAM;EACN;EACA;EACA,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;;;;;UCrCG;EACf;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN,YAAY;EACZ,SAAS;EACT,SAAS;EACT,MAAM;EACN,KAAK;;;;;EAKL;;UAGe,mBAAmB;;EAElC,YAAY;EACZ;EACA,OAAO;EACP,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,OAAO;EACP,UAAU;EACV,YAAY;EACZ,WAAW;EACX,UAAU;;;UAIK;GACd;;UAGc;;EAEf;;EAEA;;UAGe;EACf;EACA,MAAM;;EAEN;;EAEA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;;UAGe;EACf;EACA;EACA;EACA;EACA,OAAO;;UAGQ;EACf;;UAGe;EACf;EACA;EACA;EACA,QAAQ;;UAGO;EACf;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a;EACb,UAAU;EACV,QAAQ;EACR;EACA;EACA;EACA;EACA,oBAAoB;EACpB,oBAAoB;EACpB,yBAAyB;EACzB,2BAA2B;EAC3B,qBAAqB,cAAc,UAAU;;;;wBCrC/B,aACd,aAAa,iBACb,SAAS;;;UCEM;EACf;EACA;EACA,aAAa;EACb;EACA;EACA,eAAe;;UAGA;EACf;EACA;EACA;;UAGe;EACf,MAAM;EACN,UAAU;;;KAIA,0BACV,OAAO,wBACJ,kBAAkB,QAAQ;UAEd,0BAA0B;EACzC,MAAM;EACN;EACA,aAAa;EACb,aAAa;EACb;EACA,aAAa;EACb,UAAU;EACV;EACA;;KAGU,gBACV,OAAO,sBACJ,iBAAiB,QAAQ;KAElB,kBAAkB,eAAe;;KAGjC,oBACV,OAAO,sBACJ,iBAAiB,QAAQ;;;wBCnCd,mBAAmB,gBAAgB;wBASnC,sBAAsB,gBAAgB;;;;UC1BrC;EACf;EACA;;EAEA;;UAGe;EACf,UAAU;EACV;;EAEA,gBACE,SAAS,SACT,gBACG,QAAQ;;EAEb,WAAW;;EAEX,OAAO,kBAAkB,MAAM,eAAe;;;UAI/B;;EAEf;;EAEA,cAAc,OAAO,0BAA0B;;;;;UC1BhC;;EAEf,SAAS;EACT,MAAM;IACJ;IACA,cAAc;;IAEd,YAAY;MACV;;;;UCPW;EACf;EACA;EACA;EACA;;;UAIe;WACN;EACT,MAAM,oBAAoB;EAC1B,MAAM;IACJ;IACA;MACE,QAAQ"}
|
package/dist/ts-common.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purestack/ts-common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"packageManager": "yarn@4.9.2",
|
|
5
5
|
"module": "./dist/ts-common.mjs",
|
|
6
6
|
"types": "./dist/ts-common.d.mts",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@purestack/ts-html": "^1.1.
|
|
29
|
-
"@purestack/ts-style": "^1.1.
|
|
30
|
-
"@purestack/ts-util": "^1.1.
|
|
28
|
+
"@purestack/ts-html": "^1.1.16",
|
|
29
|
+
"@purestack/ts-style": "^1.1.16",
|
|
30
|
+
"@purestack/ts-util": "^1.1.16"
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"files": [
|