@apextelemed/partner-core 0.23.0-dev.83 → 0.23.0-dev.85

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.
@@ -0,0 +1,85 @@
1
+ import { headTags, SEO_ATTR, resolvePage } from '../../chunk/AGPFMEFL.js';
2
+ import { createComponent } from 'solid-js/web';
3
+ import { createContext, createSignal, createEffect, useContext, onCleanup } from 'solid-js';
4
+
5
+ var SeoContext = createContext();
6
+ function SeoProvider(props) {
7
+ const [stack, setStack] = createSignal([]);
8
+ const page = () => {
9
+ const layers = stack();
10
+ const overrides = layers.length ? Object.assign({}, ...layers.map((l) => l())) : void 0;
11
+ return resolvePage(props.manifest, props.pathname(), {
12
+ vars: props.vars?.() ?? {},
13
+ overrides
14
+ });
15
+ };
16
+ createEffect(() => applyHead(headTags(props.manifest.site, page())));
17
+ const value = {
18
+ manifest: props.manifest,
19
+ page,
20
+ push: (o) => {
21
+ setStack((s) => [...s, o]);
22
+ return () => setStack((s) => s.filter((x) => x !== o));
23
+ }
24
+ };
25
+ return createComponent(SeoContext.Provider, {
26
+ value,
27
+ get children() {
28
+ return props.children;
29
+ }
30
+ });
31
+ }
32
+ function useSeo(overrides) {
33
+ const ctx = useContext(SeoContext);
34
+ if (!ctx) throw new Error("useSeo/<Seo> must be used inside <SeoProvider>.");
35
+ const read = typeof overrides === "function" ? overrides : () => overrides;
36
+ const defined = () => Object.fromEntries(Object.entries(read()).filter(([, v]) => v !== void 0));
37
+ onCleanup(ctx.push(defined));
38
+ }
39
+ function Seo(props) {
40
+ useSeo(() => ({
41
+ ...props
42
+ }));
43
+ return null;
44
+ }
45
+ function useSeoPage() {
46
+ return useContext(SeoContext)?.page ?? null;
47
+ }
48
+ function selectorFor(t) {
49
+ if (t.tag === "title") return "title";
50
+ if (t.tag === "meta") {
51
+ const [kind, id] = t.attrs.name ? ["name", t.attrs.name] : ["property", t.attrs.property];
52
+ return `meta[${kind}="${cssEscape(id)}"]`;
53
+ }
54
+ if (t.tag === "link" && t.attrs.rel === "canonical") return 'link[rel="canonical"]';
55
+ return null;
56
+ }
57
+ var cssEscape = (s) => s.replace(/["\\]/g, "\\$&");
58
+ function applyHead(tags, doc = document) {
59
+ const head = doc.head;
60
+ const keep = /* @__PURE__ */ new Set();
61
+ for (const t of tags) {
62
+ let el = head.querySelector(`[${SEO_ATTR}="${cssEscape(t.key)}"]`);
63
+ const sel = selectorFor(t);
64
+ if (!el && sel) el = head.querySelector(sel);
65
+ if (!el) {
66
+ el = doc.createElement(t.tag);
67
+ head.appendChild(el);
68
+ }
69
+ for (const a of Array.from(el.attributes)) {
70
+ if (a.name !== SEO_ATTR && !(a.name in t.attrs)) el.removeAttribute(a.name);
71
+ }
72
+ for (const [k, v] of Object.entries(t.attrs)) if (el.getAttribute(k) !== v) el.setAttribute(k, v);
73
+ el.setAttribute(SEO_ATTR, t.key);
74
+ if (t.text !== void 0 && el.textContent !== t.text) el.textContent = t.text;
75
+ keep.add(el);
76
+ if (sel) {
77
+ for (const dup of Array.from(head.querySelectorAll(sel))) if (dup !== el) dup.remove();
78
+ }
79
+ }
80
+ for (const el of Array.from(head.querySelectorAll(`[${SEO_ATTR}]`))) if (!keep.has(el)) el.remove();
81
+ }
82
+
83
+ export { Seo, SeoProvider, applyHead, useSeo, useSeoPage };
84
+ //# sourceMappingURL=index.js.map
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/seo/runtime.tsx"],"names":["SeoContext","createContext","SeoProvider","props","stack","setStack","createSignal","page","layers","overrides","length","Object","assign","map","l","undefined","resolvePage","manifest","pathname","vars","createEffect","applyHead","headTags","site","value","push","o","s","filter","x","_$createComponent","Provider","children","useSeo","ctx","useContext","Error","read","defined","fromEntries","entries","v","onCleanup","Seo","useSeoPage","selectorFor","t","tag","kind","id","attrs","name","property","cssEscape","rel","replace","tags","doc","document","head","keep","Set","el","querySelector","SEO_ATTR","key","sel","createElement","appendChild","a","Array","from","attributes","removeAttribute","k","getAttribute","setAttribute","text","textContent","add","dup","querySelectorAll","remove","has"],"mappings":";;;;AA0CA,IAAMA,aAAaC,aAAAA,EAA+B;AAkB3C,SAASC,YAAYC,KAAAA,EAAsC;AAChE,EAAA,MAAM,CAACC,KAAAA,EAAOC,QAAQ,CAAA,GAAIC,YAAAA,CAAuC,EAAE,CAAA;AAEnE,EAAA,MAAMC,OAAOA,MAAoB;AAC/B,IAAA,MAAMC,SAASJ,KAAAA,EAAM;AACrB,IAAA,MAAMK,SAAAA,GAAYD,MAAAA,CAAOE,MAAAA,GAASC,MAAAA,CAAOC,OAAO,EAAC,EAAG,GAAGJ,MAAAA,CAAOK,GAAAA,CAAKC,CAAAA,CAAAA,KAAMA,CAAAA,EAAG,CAAC,CAAA,GAAIC,MAAAA;AACjF,IAAA,OAAOC,WAAAA,CAAYb,KAAAA,CAAMc,QAAAA,EAAUd,KAAAA,CAAMe,UAAS,EAAG;MAAEC,IAAAA,EAAMhB,KAAAA,CAAMgB,IAAAA,IAAO,IAAK,EAAC;AAAGV,MAAAA;KAAW,CAAA;AAChG,EAAA,CAAA;AAEAW,EAAAA,YAAAA,CAAa,MAAMC,UAAUC,QAAAA,CAASnB,KAAAA,CAAMc,SAASM,IAAAA,EAAMhB,IAAAA,EAAM,CAAC,CAAC,CAAA;AAEnE,EAAA,MAAMiB,KAAAA,GAAyB;AAC7BP,IAAAA,QAAAA,EAAUd,KAAAA,CAAMc,QAAAA;AAChBV,IAAAA,IAAAA;AACAkB,IAAAA,IAAAA,EAAOC,CAAAA,CAAAA,KAAM;AACXrB,MAAAA,QAAAA,CAAUsB,CAAAA,CAAAA,KAAM,CAAC,GAAGA,CAAAA,EAAGD,CAAC,CAAC,CAAA;AACzB,MAAA,OAAO,MAAMrB,SAAUsB,CAAAA,CAAAA,KAAMA,CAAAA,CAAEC,OAAQC,CAAAA,CAAAA,KAAMA,CAAAA,KAAMH,CAAC,CAAC,CAAA;AACvD,IAAA;AACF,GAAA;A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AO;AACpG","file":"index.js","sourcesContent":["/**\n * Browser side of the SEO module: keeps `document.head` equal to what the\n * manifest says for the current route.\n *\n * A site mounts `<SeoProvider>` once, around its router outlet, and from then\n * on every listed route gets its title, description, canonical, robots, social\n * tags and JSON-LD with no code in the page. A page that knows something the\n * manifest cannot (a live price, a fetched article) adds `<Seo ... />` with\n * overrides, or feeds values through the provider's `vars`.\n *\n * The head it writes is the same `headTags()` output the build plugin bakes\n * into each prerendered HTML file, keyed by `data-seo`, so on first load the\n * runtime adopts the static elements in place rather than adding duplicates.\n */\nimport {\n createContext,\n createEffect,\n createSignal,\n onCleanup,\n useContext,\n type Accessor,\n type JSX,\n} from 'solid-js';\nimport {\n SEO_ATTR,\n headTags,\n resolvePage,\n type HeadTag,\n type ResolvedPage,\n type SeoManifest,\n type SeoOverrides,\n type SeoVars,\n} from './core';\n\ninterface SeoContextValue {\n manifest: SeoManifest;\n /** Register page overrides; returns a disposer. Latest registration wins. */\n push: (o: Accessor<SeoOverrides>) => () => void;\n /** The page as currently applied (for analytics or debugging). */\n page: Accessor<ResolvedPage>;\n}\n\nconst SeoContext = createContext<SeoContextValue>();\n\nexport interface SeoProviderProps {\n manifest: SeoManifest;\n /**\n * The current pathname, as a signal. With @solidjs/router:\n * `pathname={() => useLocation().pathname}` — taken as a prop so this\n * package does not depend on a router.\n */\n pathname: Accessor<string>;\n /**\n * Live values for `{tokens}`, e.g. `() => ({ fromPrice: price() })`. Optional\n * clauses (`[[...]]`) fill in as soon as their values arrive.\n */\n vars?: Accessor<SeoVars>;\n children?: JSX.Element;\n}\n\nexport function SeoProvider(props: SeoProviderProps): JSX.Element {\n const [stack, setStack] = createSignal<Accessor<SeoOverrides>[]>([]);\n\n const page = (): ResolvedPage => {\n const layers = stack();\n const overrides = layers.length ? Object.assign({}, ...layers.map((l) => l())) : undefined;\n return resolvePage(props.manifest, props.pathname(), { vars: props.vars?.() ?? {}, overrides });\n };\n\n createEffect(() => applyHead(headTags(props.manifest.site, page())));\n\n const value: SeoContextValue = {\n manifest: props.manifest,\n page,\n push: (o) => {\n setStack((s) => [...s, o]);\n return () => setStack((s) => s.filter((x) => x !== o));\n },\n };\n return <SeoContext.Provider value={value}>{props.children}</SeoContext.Provider>;\n}\n\n/**\n * Override this page's SEO from inside the page, for as long as it is mounted.\n * Pass an accessor for values that change (`useSeo(() => ({ title: post()?.title }))`).\n * Overrides merge over the manifest entry; `undefined` fields are ignored.\n */\nexport function useSeo(overrides: SeoOverrides | Accessor<SeoOverrides>): void {\n const ctx = useContext(SeoContext);\n if (!ctx) throw new Error('useSeo/<Seo> must be used inside <SeoProvider>.');\n const read = typeof overrides === 'function' ? overrides : () => overrides;\n const defined: Accessor<SeoOverrides> = () =>\n Object.fromEntries(Object.entries(read()).filter(([, v]) => v !== undefined)) as SeoOverrides;\n onCleanup(ctx.push(defined));\n}\n\n/** Component form of `useSeo`. Renders nothing. */\nexport function Seo(props: SeoOverrides): JSX.Element {\n useSeo(() => ({ ...props }));\n return null as unknown as JSX.Element;\n}\n\n/** The resolved SEO for the current page, or null outside a provider. */\nexport function useSeoPage(): Accessor<ResolvedPage> | null {\n return useContext(SeoContext)?.page ?? null;\n}\n\n/* ------------------------------------------------------------- DOM */\n\nfunction selectorFor(t: HeadTag): string | null {\n if (t.tag === 'title') return 'title';\n if (t.tag === 'meta') {\n const [kind, id] = t.attrs.name ? ['name', t.attrs.name] : ['property', t.attrs.property];\n return `meta[${kind}=\"${cssEscape(id)}\"]`;\n }\n if (t.tag === 'link' && t.attrs.rel === 'canonical') return 'link[rel=\"canonical\"]';\n return null;\n}\n\nconst cssEscape = (s: string) => s.replace(/[\"\\\\]/g, '\\\\$&');\n\n/**\n * Make `document.head` match `tags`: update an existing element when one\n * matches (whether the build wrote it or the site's index.html did), create it\n * otherwise, remove duplicates of it, and remove every element this module\n * owned that is no longer wanted.\n */\nexport function applyHead(tags: HeadTag[], doc: Document = document): void {\n const head = doc.head;\n const keep = new Set<Element>();\n\n for (const t of tags) {\n let el = head.querySelector(`[${SEO_ATTR}=\"${cssEscape(t.key)}\"]`);\n const sel = selectorFor(t);\n if (!el && sel) el = head.querySelector(sel);\n if (!el) {\n el = doc.createElement(t.tag);\n head.appendChild(el);\n }\n for (const a of Array.from(el.attributes)) {\n if (a.name !== SEO_ATTR && !(a.name in t.attrs)) el.removeAttribute(a.name);\n }\n for (const [k, v] of Object.entries(t.attrs)) if (el.getAttribute(k) !== v) el.setAttribute(k, v);\n el.setAttribute(SEO_ATTR, t.key);\n if (t.text !== undefined && el.textContent !== t.text) el.textContent = t.text;\n keep.add(el);\n\n // One canonical, one description, one title — drop stray copies.\n if (sel) for (const dup of Array.from(head.querySelectorAll(sel))) if (dup !== el) dup.remove();\n }\n\n for (const el of Array.from(head.querySelectorAll(`[${SEO_ATTR}]`))) if (!keep.has(el)) el.remove();\n}\n"]}
@@ -0,0 +1,89 @@
1
+ import {
2
+ SEO_ATTR,
3
+ headTags,
4
+ resolvePage
5
+ } from "../../chunk/RQIWEB6V.jsx";
6
+
7
+ // src/seo/runtime.tsx
8
+ import {
9
+ createContext,
10
+ createEffect,
11
+ createSignal,
12
+ onCleanup,
13
+ useContext
14
+ } from "solid-js";
15
+ var SeoContext = createContext();
16
+ function SeoProvider(props) {
17
+ const [stack, setStack] = createSignal([]);
18
+ const page = () => {
19
+ const layers = stack();
20
+ const overrides = layers.length ? Object.assign({}, ...layers.map((l) => l())) : void 0;
21
+ return resolvePage(props.manifest, props.pathname(), { vars: props.vars?.() ?? {}, overrides });
22
+ };
23
+ createEffect(() => applyHead(headTags(props.manifest.site, page())));
24
+ const value = {
25
+ manifest: props.manifest,
26
+ page,
27
+ push: (o) => {
28
+ setStack((s) => [...s, o]);
29
+ return () => setStack((s) => s.filter((x) => x !== o));
30
+ }
31
+ };
32
+ return <SeoContext.Provider value={value}>{props.children}</SeoContext.Provider>;
33
+ }
34
+ function useSeo(overrides) {
35
+ const ctx = useContext(SeoContext);
36
+ if (!ctx) throw new Error("useSeo/<Seo> must be used inside <SeoProvider>.");
37
+ const read = typeof overrides === "function" ? overrides : () => overrides;
38
+ const defined = () => Object.fromEntries(Object.entries(read()).filter(([, v]) => v !== void 0));
39
+ onCleanup(ctx.push(defined));
40
+ }
41
+ function Seo(props) {
42
+ useSeo(() => ({ ...props }));
43
+ return null;
44
+ }
45
+ function useSeoPage() {
46
+ return useContext(SeoContext)?.page ?? null;
47
+ }
48
+ function selectorFor(t) {
49
+ if (t.tag === "title") return "title";
50
+ if (t.tag === "meta") {
51
+ const [kind, id] = t.attrs.name ? ["name", t.attrs.name] : ["property", t.attrs.property];
52
+ return `meta[${kind}="${cssEscape(id)}"]`;
53
+ }
54
+ if (t.tag === "link" && t.attrs.rel === "canonical") return 'link[rel="canonical"]';
55
+ return null;
56
+ }
57
+ var cssEscape = (s) => s.replace(/["\\]/g, "\\$&");
58
+ function applyHead(tags, doc = document) {
59
+ const head = doc.head;
60
+ const keep = /* @__PURE__ */ new Set();
61
+ for (const t of tags) {
62
+ let el = head.querySelector(`[${SEO_ATTR}="${cssEscape(t.key)}"]`);
63
+ const sel = selectorFor(t);
64
+ if (!el && sel) el = head.querySelector(sel);
65
+ if (!el) {
66
+ el = doc.createElement(t.tag);
67
+ head.appendChild(el);
68
+ }
69
+ for (const a of Array.from(el.attributes)) {
70
+ if (a.name !== SEO_ATTR && !(a.name in t.attrs)) el.removeAttribute(a.name);
71
+ }
72
+ for (const [k, v] of Object.entries(t.attrs)) if (el.getAttribute(k) !== v) el.setAttribute(k, v);
73
+ el.setAttribute(SEO_ATTR, t.key);
74
+ if (t.text !== void 0 && el.textContent !== t.text) el.textContent = t.text;
75
+ keep.add(el);
76
+ if (sel) {
77
+ for (const dup of Array.from(head.querySelectorAll(sel))) if (dup !== el) dup.remove();
78
+ }
79
+ }
80
+ for (const el of Array.from(head.querySelectorAll(`[${SEO_ATTR}]`))) if (!keep.has(el)) el.remove();
81
+ }
82
+ export {
83
+ Seo,
84
+ SeoProvider,
85
+ applyHead,
86
+ useSeo,
87
+ useSeoPage
88
+ };
89
+ //# sourceMappingURL=index.jsx.map
@@ -0,0 +1,63 @@
1
+ import { Plugin } from 'vite';
2
+ import { SeoManifest, SeoVars } from '../index.js';
3
+
4
+ /**
5
+ * `@apextelemed/partner-core/seo/vite` — the build half of the SEO module.
6
+ *
7
+ * A single-page app serves one index.html for every URL, so before any script
8
+ * runs every page has the homepage's title, description and canonical. Google
9
+ * renders the script eventually; link previews (Slack, iMessage, Facebook,
10
+ * LinkedIn) and many other crawlers never do. This plugin closes that gap
11
+ * without server rendering: for every concrete route in the manifest it writes
12
+ * a copy of the built index.html whose <head> is that route's, so each URL is
13
+ * served its own head as static HTML and the app boots exactly as before.
14
+ *
15
+ * It also writes sitemap.xml and robots.txt from the same manifest, and an
16
+ * optional neutral fallback document for URLs the manifest does not list.
17
+ *
18
+ * Node-side only, and deliberately free of solid-js: it imports `./core` and
19
+ * nothing else from the package.
20
+ *
21
+ * Hosting: with the default `layout: 'flat'`, "/pricing" is written to
22
+ * `pricing.html`. On Firebase Hosting set `"cleanUrls": true` and
23
+ * `"trailingSlash": false`, and point the SPA rewrite at the fallback:
24
+ * `{ "source": "**", "destination": "/app.html" }`.
25
+ */
26
+
27
+ type MaybeAsync<T> = T | Promise<T>;
28
+ interface ApexSeoOptions {
29
+ /** The manifest, or a function returning it (async: fetch dynamic routes such as articles). */
30
+ manifest: SeoManifest | (() => MaybeAsync<SeoManifest>);
31
+ /**
32
+ * Values for `{tokens}` at build time. Usually leave unset: optional
33
+ * `[[clauses]]` are then dropped from the static head and filled in by the
34
+ * runtime, so a value that can change without a deploy (a price) is never
35
+ * baked into HTML where it could go stale.
36
+ */
37
+ vars?: SeoVars | (() => MaybeAsync<SeoVars>);
38
+ /**
39
+ * Concrete paths to prerender and list in the sitemap beyond the manifest's
40
+ * own, e.g. one per article for a "/guides/:slug" route.
41
+ */
42
+ paths?: () => MaybeAsync<{
43
+ path: string;
44
+ lastmod?: string;
45
+ }[]>;
46
+ /** `pricing.html` (default) or `pricing/index.html`. */
47
+ layout?: 'flat' | 'directory';
48
+ /**
49
+ * File for URLs the manifest does not list (the SPA rewrite target), with a
50
+ * neutral head: default title and description, no canonical, and `noindex`
51
+ * unless `site.unlisted` is "index". Default "app.html". `false` to skip —
52
+ * every unknown URL then gets the homepage head until the app boots.
53
+ */
54
+ fallback?: string | false;
55
+ /** Write sitemap.xml. Default true. */
56
+ sitemap?: boolean;
57
+ /** Write robots.txt. Default true. */
58
+ robots?: boolean;
59
+ }
60
+ declare function outputFileFor(path: string, layout?: 'flat' | 'directory'): string;
61
+ declare function apexSeo(options: ApexSeoOptions): Plugin;
62
+
63
+ export { type ApexSeoOptions, apexSeo, outputFileFor };
@@ -0,0 +1,104 @@
1
+ import { normalizePath, isConcrete, sitemapXml, robotsTxt, renderDocument } from '../../chunk/AGPFMEFL.js';
2
+
3
+ // src/seo/vite.tsx
4
+ function outputFileFor(path, layout = "flat") {
5
+ const p = normalizePath(path);
6
+ if (p === "/") return "index.html";
7
+ const rel = p.slice(1);
8
+ return layout === "directory" ? `${rel}/index.html` : `${rel}.html`;
9
+ }
10
+ async function value(v) {
11
+ return typeof v === "function" ? await v() : v;
12
+ }
13
+ function apexSeo(options) {
14
+ const fallback = options.fallback === void 0 ? "app.html" : options.fallback;
15
+ const load = async () => ({
16
+ manifest: await value(options.manifest),
17
+ vars: await value(options.vars) ?? {},
18
+ extra: await options.paths?.() ?? []
19
+ });
20
+ return {
21
+ name: "apex-partner-core:seo",
22
+ enforce: "post",
23
+ // Dev server: serve the generated sitemap.xml / robots.txt so they can be
24
+ // checked locally. Page heads come from the runtime in dev.
25
+ configureServer(server) {
26
+ server.middlewares.use(async (req, res, next) => {
27
+ const url = (req.url ?? "").split("?")[0];
28
+ if (url !== "/sitemap.xml" && url !== "/robots.txt") return next();
29
+ try {
30
+ const {
31
+ manifest,
32
+ extra
33
+ } = await load();
34
+ const xml = url === "/sitemap.xml";
35
+ res.setHeader("Content-Type", xml ? "application/xml; charset=utf-8" : "text/plain; charset=utf-8");
36
+ res.end(xml ? sitemapXml(manifest, extra) : robotsTxt(manifest));
37
+ } catch (e) {
38
+ next(e);
39
+ }
40
+ });
41
+ },
42
+ async generateBundle(_out, bundle) {
43
+ const entry = bundle["index.html"];
44
+ if (!entry || entry.type !== "asset") {
45
+ this.warn("no index.html in the bundle; SEO heads not written");
46
+ return;
47
+ }
48
+ const html = String(entry.source);
49
+ const {
50
+ manifest,
51
+ vars,
52
+ extra
53
+ } = await load();
54
+ const render = (path) => renderDocument(html, manifest, path, {
55
+ vars,
56
+ strict: true
57
+ });
58
+ if (fallback) {
59
+ this.emitFile({
60
+ type: "asset",
61
+ fileName: fallback,
62
+ source: render("/__apex_seo_unlisted__")
63
+ });
64
+ }
65
+ const written = /* @__PURE__ */ new Set();
66
+ const paths = [
67
+ // A `crawl: false` page is blocked in robots.txt, so no crawler reads
68
+ // its static head; it is served the fallback like any app route.
69
+ ...manifest.routes.filter((r) => isConcrete(r) && r.crawl !== false).map((r) => r.path),
70
+ ...extra.map((e) => e.path)
71
+ ];
72
+ for (const path of paths) {
73
+ const fileName = outputFileFor(path, options.layout);
74
+ if (written.has(fileName)) continue;
75
+ written.add(fileName);
76
+ if (fileName === "index.html") entry.source = render(path);
77
+ else this.emitFile({
78
+ type: "asset",
79
+ fileName,
80
+ source: render(path)
81
+ });
82
+ }
83
+ if (!written.has("index.html")) entry.source = render("/");
84
+ if (options.sitemap !== false) {
85
+ this.emitFile({
86
+ type: "asset",
87
+ fileName: "sitemap.xml",
88
+ source: sitemapXml(manifest, extra)
89
+ });
90
+ }
91
+ if (options.robots !== false) {
92
+ this.emitFile({
93
+ type: "asset",
94
+ fileName: "robots.txt",
95
+ source: robotsTxt(manifest)
96
+ });
97
+ }
98
+ }
99
+ };
100
+ }
101
+
102
+ export { apexSeo, outputFileFor };
103
+ //# sourceMappingURL=index.js.map
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/seo/vite.tsx"],"names":["outputFileFor","path","layout","p","normalizePath","rel","slice","value","v","apexSeo","options","fallback","undefined","load","manifest","vars","extra","paths","name","enforce","configureServer","server","middlewares","use","req","res","next","url","split","xml","setHeader","end","sitemapXml","robotsTxt","e","generateBundle","_out","bundle","entry","type","warn","html","String","source","render","renderDocument","strict","emitFile","fileName","written","Set","routes","filter","r","isConcrete","crawl","map","has","add","sitemap","robots"],"mappings":";;;AAiEO,SAASA,aAAAA,CAAcC,IAAAA,EAAcC,MAAAA,GAA+B,MAAA,EAAgB;AACzF,EAAA,MAAMC,CAAAA,GAAIC,cAAcH,IAAI,CAAA;AAC5B,EAAA,IAAIE,CAAAA,KAAM,KAAK,OAAO,YAAA;AACtB,EAAA,MAAME,GAAAA,GAAMF,CAAAA,CAAEG,KAAAA,CAAM,CAAC,CAAA;AACrB,EAAA,OAAOJ,WAAW,WAAA,GAAc,CAAA,EAAGG,GAAG,CAAA,WAAA,CAAA,GAAgB,GAAGA,GAAG,CAAA,KAAA,CAAA;AAC9D;AAEA,eAAeE,MAASC,CAAAA,EAAkE;AACxF,EAAA,OAAO,OAAOA,CAAAA,KAAM,UAAA,GAAa,MAAOA,GAA0B,GAAIA,CAAAA;AACxE;AAEO,SAASC,QAAQC,OAAAA,EAAiC;AACvD,EAAA,MAAMC,QAAAA,GAAWD,OAAAA,CAAQC,QAAAA,KAAaC,MAAAA,GAAY,aAAaF,OAAAA,CAAQC,QAAAA;AACvE,EAAA,MAAME,OAAO,aAAa;IACxBC,QAAAA,EAAW,MAAMP,KAAAA,CAAMG,OAAAA,CAAQI,QAAQ,CAAA;AACvCC,IAAAA,IAAAA,EAAO,MAAMR,KAAAA,CAAMG,OAAAA,CAAQK,IAAI,KAAM,EAAC;AACtCC,IAAAA,KAAAA,EAAQ,MAAMN,OAAAA,CAAQO,KAAAA,IAAQ,IAAM;AACtC,GAAA,CAAA;AAEA,EAAA,OAAO;IACLC,IAAAA,EAAM,uBAAA;IACNC,OAAAA,EAAS,MAAA;;;AAITC,I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AAA,EAAM,OAAA;AAASS,UAAAA,QAAAA;AAAUL,UAAAA,MAAAA,EAAQC,OAAO3C,IAAI;SAAG,CAAA;AACtE,MAAA;AACA,MAAA,IAAI,CAACgD,QAAQQ,GAAAA,CAAI,YAAY,GAAGnB,KAAAA,CAAMK,MAAAA,GAASC,OAAO,GAAG,CAAA;AAEzD,MAAA,IAAIlC,OAAAA,CAAQiD,YAAY,KAAA,EAAO;AAC7B,QAAA,IAAA,CAAKZ,QAAAA,CAAS;UAAER,IAAAA,EAAM,OAAA;UAASS,QAAAA,EAAU,aAAA;UAAeL,MAAAA,EAAQX,UAAAA,CAAWlB,UAAUE,KAAK;SAAG,CAAA;AAC/F,MAAA;AACA,MAAA,IAAIN,OAAAA,CAAQkD,WAAW,KAAA,EAAO;AAC5B,QAAA,IAAA,CAAKb,QAAAA,CAAS;UAAER,IAAAA,EAAM,OAAA;UAASS,QAAAA,EAAU,YAAA;AAAcL,UAAAA,MAAAA,EAAQV,UAAUnB,QAAQ;SAAG,CAAA;AACtF,MAAA;AACF,IAAA;AACF,GAAA;AACF","file":"index.js","sourcesContent":["/**\n * `@apextelemed/partner-core/seo/vite` — the build half of the SEO module.\n *\n * A single-page app serves one index.html for every URL, so before any script\n * runs every page has the homepage's title, description and canonical. Google\n * renders the script eventually; link previews (Slack, iMessage, Facebook,\n * LinkedIn) and many other crawlers never do. This plugin closes that gap\n * without server rendering: for every concrete route in the manifest it writes\n * a copy of the built index.html whose <head> is that route's, so each URL is\n * served its own head as static HTML and the app boots exactly as before.\n *\n * It also writes sitemap.xml and robots.txt from the same manifest, and an\n * optional neutral fallback document for URLs the manifest does not list.\n *\n * Node-side only, and deliberately free of solid-js: it imports `./core` and\n * nothing else from the package.\n *\n * Hosting: with the default `layout: 'flat'`, \"/pricing\" is written to\n * `pricing.html`. On Firebase Hosting set `\"cleanUrls\": true` and\n * `\"trailingSlash\": false`, and point the SPA rewrite at the fallback:\n * `{ \"source\": \"**\", \"destination\": \"/app.html\" }`.\n */\nimport type { Plugin } from 'vite';\nimport {\n isConcrete,\n normalizePath,\n renderDocument,\n robotsTxt,\n sitemapXml,\n type SeoManifest,\n type SeoVars,\n} from './core';\n\ntype MaybeAsync<T> = T | Promise<T>;\n\nexport interface ApexSeoOptions {\n /** The manifest, or a function returning it (async: fetch dynamic routes such as articles). */\n manifest: SeoManifest | (() => MaybeAsync<SeoManifest>);\n /**\n * Values for `{tokens}` at build time. Usually leave unset: optional\n * `[[clauses]]` are then dropped from the static head and filled in by the\n * runtime, so a value that can change without a deploy (a price) is never\n * baked into HTML where it could go stale.\n */\n vars?: SeoVars | (() => MaybeAsync<SeoVars>);\n /**\n * Concrete paths to prerender and list in the sitemap beyond the manifest's\n * own, e.g. one per article for a \"/guides/:slug\" route.\n */\n paths?: () => MaybeAsync<{ path: string; lastmod?: string }[]>;\n /** `pricing.html` (default) or `pricing/index.html`. */\n layout?: 'flat' | 'directory';\n /**\n * File for URLs the manifest does not list (the SPA rewrite target), with a\n * neutral head: default title and description, no canonical, and `noindex`\n * unless `site.unlisted` is \"index\". Default \"app.html\". `false` to skip —\n * every unknown URL then gets the homepage head until the app boots.\n */\n fallback?: string | false;\n /** Write sitemap.xml. Default true. */\n sitemap?: boolean;\n /** Write robots.txt. Default true. */\n robots?: boolean;\n}\n\nexport function outputFileFor(path: string, layout: 'flat' | 'directory' = 'flat'): string {\n const p = normalizePath(path);\n if (p === '/') return 'index.html';\n const rel = p.slice(1);\n return layout === 'directory' ? `${rel}/index.html` : `${rel}.html`;\n}\n\nasync function value<T>(v: T | (() => MaybeAsync<T>) | undefined): Promise<T | undefined> {\n return typeof v === 'function' ? await (v as () => MaybeAsync<T>)() : v;\n}\n\nexport function apexSeo(options: ApexSeoOptions): Plugin {\n const fallback = options.fallback === undefined ? 'app.html' : options.fallback;\n const load = async () => ({\n manifest: (await value(options.manifest))!,\n vars: (await value(options.vars)) ?? {},\n extra: (await options.paths?.()) ?? [],\n });\n\n return {\n name: 'apex-partner-core:seo',\n enforce: 'post',\n\n // Dev server: serve the generated sitemap.xml / robots.txt so they can be\n // checked locally. Page heads come from the runtime in dev.\n configureServer(server) {\n server.middlewares.use(async (req, res, next) => {\n const url = ((req as { url?: string }).url ?? '').split('?')[0];\n if (url !== '/sitemap.xml' && url !== '/robots.txt') return next();\n try {\n const { manifest, extra } = await load();\n const xml = url === '/sitemap.xml';\n res.setHeader('Content-Type', xml ? 'application/xml; charset=utf-8' : 'text/plain; charset=utf-8');\n res.end(xml ? sitemapXml(manifest, extra) : robotsTxt(manifest));\n } catch (e) {\n next(e);\n }\n });\n },\n\n async generateBundle(_out, bundle) {\n const entry = bundle['index.html'];\n if (!entry || entry.type !== 'asset') {\n this.warn('no index.html in the bundle; SEO heads not written');\n return;\n }\n const html = String(entry.source);\n const { manifest, vars, extra } = await load();\n const render = (path: string) => renderDocument(html, manifest, path, { vars, strict: true });\n\n // The fallback first, from the untouched template, before index.html is\n // rewritten into the homepage.\n if (fallback) {\n this.emitFile({ type: 'asset', fileName: fallback, source: render('/__apex_seo_unlisted__') });\n }\n\n const written = new Set<string>();\n const paths = [\n // A `crawl: false` page is blocked in robots.txt, so no crawler reads\n // its static head; it is served the fallback like any app route.\n ...manifest.routes.filter((r) => isConcrete(r) && r.crawl !== false).map((r) => r.path),\n ...extra.map((e) => e.path),\n ];\n for (const path of paths) {\n const fileName = outputFileFor(path, options.layout);\n if (written.has(fileName)) continue;\n written.add(fileName);\n if (fileName === 'index.html') entry.source = render(path);\n else this.emitFile({ type: 'asset', fileName, source: render(path) });\n }\n if (!written.has('index.html')) entry.source = render('/');\n\n if (options.sitemap !== false) {\n this.emitFile({ type: 'asset', fileName: 'sitemap.xml', source: sitemapXml(manifest, extra) });\n }\n if (options.robots !== false) {\n this.emitFile({ type: 'asset', fileName: 'robots.txt', source: robotsTxt(manifest) });\n }\n },\n };\n}\n"]}
@@ -0,0 +1,85 @@
1
+ import {
2
+ isConcrete,
3
+ normalizePath,
4
+ renderDocument,
5
+ robotsTxt,
6
+ sitemapXml
7
+ } from "../../chunk/RQIWEB6V.jsx";
8
+
9
+ // src/seo/vite.tsx
10
+ function outputFileFor(path, layout = "flat") {
11
+ const p = normalizePath(path);
12
+ if (p === "/") return "index.html";
13
+ const rel = p.slice(1);
14
+ return layout === "directory" ? `${rel}/index.html` : `${rel}.html`;
15
+ }
16
+ async function value(v) {
17
+ return typeof v === "function" ? await v() : v;
18
+ }
19
+ function apexSeo(options) {
20
+ const fallback = options.fallback === void 0 ? "app.html" : options.fallback;
21
+ const load = async () => ({
22
+ manifest: await value(options.manifest),
23
+ vars: await value(options.vars) ?? {},
24
+ extra: await options.paths?.() ?? []
25
+ });
26
+ return {
27
+ name: "apex-partner-core:seo",
28
+ enforce: "post",
29
+ // Dev server: serve the generated sitemap.xml / robots.txt so they can be
30
+ // checked locally. Page heads come from the runtime in dev.
31
+ configureServer(server) {
32
+ server.middlewares.use(async (req, res, next) => {
33
+ const url = (req.url ?? "").split("?")[0];
34
+ if (url !== "/sitemap.xml" && url !== "/robots.txt") return next();
35
+ try {
36
+ const { manifest, extra } = await load();
37
+ const xml = url === "/sitemap.xml";
38
+ res.setHeader("Content-Type", xml ? "application/xml; charset=utf-8" : "text/plain; charset=utf-8");
39
+ res.end(xml ? sitemapXml(manifest, extra) : robotsTxt(manifest));
40
+ } catch (e) {
41
+ next(e);
42
+ }
43
+ });
44
+ },
45
+ async generateBundle(_out, bundle) {
46
+ const entry = bundle["index.html"];
47
+ if (!entry || entry.type !== "asset") {
48
+ this.warn("no index.html in the bundle; SEO heads not written");
49
+ return;
50
+ }
51
+ const html = String(entry.source);
52
+ const { manifest, vars, extra } = await load();
53
+ const render = (path) => renderDocument(html, manifest, path, { vars, strict: true });
54
+ if (fallback) {
55
+ this.emitFile({ type: "asset", fileName: fallback, source: render("/__apex_seo_unlisted__") });
56
+ }
57
+ const written = /* @__PURE__ */ new Set();
58
+ const paths = [
59
+ // A `crawl: false` page is blocked in robots.txt, so no crawler reads
60
+ // its static head; it is served the fallback like any app route.
61
+ ...manifest.routes.filter((r) => isConcrete(r) && r.crawl !== false).map((r) => r.path),
62
+ ...extra.map((e) => e.path)
63
+ ];
64
+ for (const path of paths) {
65
+ const fileName = outputFileFor(path, options.layout);
66
+ if (written.has(fileName)) continue;
67
+ written.add(fileName);
68
+ if (fileName === "index.html") entry.source = render(path);
69
+ else this.emitFile({ type: "asset", fileName, source: render(path) });
70
+ }
71
+ if (!written.has("index.html")) entry.source = render("/");
72
+ if (options.sitemap !== false) {
73
+ this.emitFile({ type: "asset", fileName: "sitemap.xml", source: sitemapXml(manifest, extra) });
74
+ }
75
+ if (options.robots !== false) {
76
+ this.emitFile({ type: "asset", fileName: "robots.txt", source: robotsTxt(manifest) });
77
+ }
78
+ }
79
+ };
80
+ }
81
+ export {
82
+ apexSeo,
83
+ outputFileFor
84
+ };
85
+ //# sourceMappingURL=index.jsx.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apextelemed/partner-core",
3
- "version": "0.23.0-dev.83",
3
+ "version": "0.23.0-dev.85",
4
4
  "description": "Shared frontend library for telehealth patient portals (api client, stores, headless flows).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -75,6 +75,30 @@
75
75
  "default": "./dist/primitives/default/index.js"
76
76
  }
77
77
  },
78
+ "./seo": {
79
+ "apex-src": "./src/seo/index.tsx",
80
+ "solid": "./dist/seo/index.jsx",
81
+ "import": {
82
+ "types": "./dist/seo/index.d.ts",
83
+ "default": "./dist/seo/index.js"
84
+ }
85
+ },
86
+ "./seo/solid": {
87
+ "apex-src": "./src/seo/solid.tsx",
88
+ "solid": "./dist/seo/solid/index.jsx",
89
+ "import": {
90
+ "types": "./dist/seo/solid/index.d.ts",
91
+ "default": "./dist/seo/solid/index.js"
92
+ }
93
+ },
94
+ "./seo/vite": {
95
+ "apex-src": "./src/seo/vite.tsx",
96
+ "solid": "./dist/seo/vite/index.jsx",
97
+ "import": {
98
+ "types": "./dist/seo/vite/index.d.ts",
99
+ "default": "./dist/seo/vite/index.js"
100
+ }
101
+ },
78
102
  "./stores": {
79
103
  "apex-src": "./src/stores/index.tsx",
80
104
  "solid": "./dist/stores/index.jsx",
@@ -133,6 +157,15 @@
133
157
  "primitives/default": [
134
158
  "./dist/primitives/default/index.d.ts"
135
159
  ],
160
+ "seo": [
161
+ "./dist/seo/index.d.ts"
162
+ ],
163
+ "seo/solid": [
164
+ "./dist/seo/solid/index.d.ts"
165
+ ],
166
+ "seo/vite": [
167
+ "./dist/seo/vite/index.d.ts"
168
+ ],
136
169
  "stores": [
137
170
  "./dist/stores/index.d.ts"
138
171
  ],
@@ -175,7 +208,8 @@
175
208
  "peerDependencies": {
176
209
  "@playwright/test": ">=1.50.0",
177
210
  "@supabase/supabase-js": "^2.0.0",
178
- "solid-js": "^1.9.0"
211
+ "solid-js": "^1.9.0",
212
+ "vite": ">=5.0.0"
179
213
  },
180
214
  "peerDependenciesMeta": {
181
215
  "@supabase/supabase-js": {
@@ -183,6 +217,9 @@
183
217
  },
184
218
  "@playwright/test": {
185
219
  "optional": true
220
+ },
221
+ "vite": {
222
+ "optional": true
186
223
  }
187
224
  },
188
225
  "devDependencies": {