@opinly/nuxt 1.0.0-alpha.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/index.cjs ADDED
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ buildBlogPostingJsonLd: () => import_shared2.buildBlogPostingJsonLd,
24
+ buildBreadcrumbJsonLd: () => import_shared2.buildBreadcrumbJsonLd,
25
+ buildCollectionJsonLd: () => import_shared2.buildCollectionJsonLd,
26
+ buildFaqJsonLd: () => import_shared2.buildFaqJsonLd,
27
+ buildMetadata: () => import_shared2.buildMetadata,
28
+ buildPersonJsonLd: () => import_shared2.buildPersonJsonLd,
29
+ opinlyHead: () => opinlyHead
30
+ });
31
+ module.exports = __toCommonJS(index_exports);
32
+ var import_shared = require("@opinly/shared");
33
+ var import_shared2 = require("@opinly/shared");
34
+ var metaTags = (m) => {
35
+ const tags = [];
36
+ if (m.description) tags.push({ name: "description", content: m.description });
37
+ tags.push({ property: "og:title", content: m.title });
38
+ if (m.description) tags.push({ property: "og:description", content: m.description });
39
+ if (m.ogType) tags.push({ property: "og:type", content: m.ogType });
40
+ if (m.ogImage) tags.push({ property: "og:image", content: m.ogImage });
41
+ if (m.canonicalUrl) tags.push({ property: "og:url", content: m.canonicalUrl });
42
+ return tags;
43
+ };
44
+ function opinlyHead(args) {
45
+ const m = (0, import_shared.buildMetadata)(args.resolved, args.config);
46
+ return {
47
+ title: m.title,
48
+ meta: metaTags(m),
49
+ ...args.jsonLd?.length ? {
50
+ script: args.jsonLd.map((d) => ({
51
+ type: "application/ld+json",
52
+ innerHTML: JSON.stringify(d)
53
+ }))
54
+ } : {}
55
+ };
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ buildBlogPostingJsonLd,
60
+ buildBreadcrumbJsonLd,
61
+ buildCollectionJsonLd,
62
+ buildFaqJsonLd,
63
+ buildMetadata,
64
+ buildPersonJsonLd,
65
+ opinlyHead
66
+ });
67
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n buildMetadata,\n type OpinlyConfig,\n type OpinlyMeta,\n type SeoResolved,\n} from \"@opinly/shared\";\n\n/** A Nuxt `useHead()`-compatible input (structural — no Nuxt runtime import). */\nexport interface OpinlyHead {\n title: string;\n meta: { name?: string; property?: string; content: string }[];\n script?: { type: string; innerHTML: string }[];\n}\n\nconst metaTags = (m: OpinlyMeta): OpinlyHead[\"meta\"] => {\n const tags: OpinlyHead[\"meta\"] = [];\n if (m.description) tags.push({ name: \"description\", content: m.description });\n tags.push({ property: \"og:title\", content: m.title });\n if (m.description) tags.push({ property: \"og:description\", content: m.description });\n if (m.ogType) tags.push({ property: \"og:type\", content: m.ogType });\n if (m.ogImage) tags.push({ property: \"og:image\", content: m.ogImage });\n if (m.canonicalUrl) tags.push({ property: \"og:url\", content: m.canonicalUrl });\n return tags;\n};\n\n/**\n * Build a Nuxt `useHead()` input from a resolved blog route. Title + OG tags come\n * from @opinly/shared's `buildMetadata`; pass JSON-LD objects (built with\n * @opinly/shared's `buildBlogPostingJsonLd` etc.) via `jsonLd` to emit ld+json scripts.\n *\n * @example useHead(opinlyHead({ resolved, config, jsonLd: [buildBlogPostingJsonLd(...)] }))\n */\nexport function opinlyHead(args: {\n resolved: SeoResolved;\n config: OpinlyConfig;\n jsonLd?: object[];\n}): OpinlyHead {\n const m = buildMetadata(args.resolved, args.config);\n return {\n title: m.title,\n meta: metaTags(m),\n ...(args.jsonLd?.length\n ? {\n script: args.jsonLd.map((d) => ({\n type: \"application/ld+json\",\n innerHTML: JSON.stringify(d),\n })),\n }\n : {}),\n };\n}\n\nexport {\n buildMetadata,\n buildBlogPostingJsonLd,\n buildFaqJsonLd,\n buildBreadcrumbJsonLd,\n buildPersonJsonLd,\n buildCollectionJsonLd,\n} from \"@opinly/shared\";\nexport type { OpinlyConfig, OpinlyMeta, SeoResolved } from \"@opinly/shared\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKO;AA+CP,IAAAA,iBAOO;AA7CP,IAAM,WAAW,CAAC,MAAsC;AACtD,QAAM,OAA2B,CAAC;AAClC,MAAI,EAAE,YAAa,MAAK,KAAK,EAAE,MAAM,eAAe,SAAS,EAAE,YAAY,CAAC;AAC5E,OAAK,KAAK,EAAE,UAAU,YAAY,SAAS,EAAE,MAAM,CAAC;AACpD,MAAI,EAAE,YAAa,MAAK,KAAK,EAAE,UAAU,kBAAkB,SAAS,EAAE,YAAY,CAAC;AACnF,MAAI,EAAE,OAAQ,MAAK,KAAK,EAAE,UAAU,WAAW,SAAS,EAAE,OAAO,CAAC;AAClE,MAAI,EAAE,QAAS,MAAK,KAAK,EAAE,UAAU,YAAY,SAAS,EAAE,QAAQ,CAAC;AACrE,MAAI,EAAE,aAAc,MAAK,KAAK,EAAE,UAAU,UAAU,SAAS,EAAE,aAAa,CAAC;AAC7E,SAAO;AACT;AASO,SAAS,WAAW,MAIZ;AACb,QAAM,QAAI,6BAAc,KAAK,UAAU,KAAK,MAAM;AAClD,SAAO;AAAA,IACL,OAAO,EAAE;AAAA,IACT,MAAM,SAAS,CAAC;AAAA,IAChB,GAAI,KAAK,QAAQ,SACb;AAAA,MACE,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO;AAAA,QAC9B,MAAM;AAAA,QACN,WAAW,KAAK,UAAU,CAAC;AAAA,MAC7B,EAAE;AAAA,IACJ,IACA,CAAC;AAAA,EACP;AACF;","names":["import_shared"]}
@@ -0,0 +1,30 @@
1
+ import { SeoResolved, OpinlyConfig } from '@opinly/shared';
2
+ export { OpinlyConfig, OpinlyMeta, SeoResolved, buildBlogPostingJsonLd, buildBreadcrumbJsonLd, buildCollectionJsonLd, buildFaqJsonLd, buildMetadata, buildPersonJsonLd } from '@opinly/shared';
3
+
4
+ /** A Nuxt `useHead()`-compatible input (structural — no Nuxt runtime import). */
5
+ interface OpinlyHead {
6
+ title: string;
7
+ meta: {
8
+ name?: string;
9
+ property?: string;
10
+ content: string;
11
+ }[];
12
+ script?: {
13
+ type: string;
14
+ innerHTML: string;
15
+ }[];
16
+ }
17
+ /**
18
+ * Build a Nuxt `useHead()` input from a resolved blog route. Title + OG tags come
19
+ * from @opinly/shared's `buildMetadata`; pass JSON-LD objects (built with
20
+ * @opinly/shared's `buildBlogPostingJsonLd` etc.) via `jsonLd` to emit ld+json scripts.
21
+ *
22
+ * @example useHead(opinlyHead({ resolved, config, jsonLd: [buildBlogPostingJsonLd(...)] }))
23
+ */
24
+ declare function opinlyHead(args: {
25
+ resolved: SeoResolved;
26
+ config: OpinlyConfig;
27
+ jsonLd?: object[];
28
+ }): OpinlyHead;
29
+
30
+ export { type OpinlyHead, opinlyHead };
@@ -0,0 +1,30 @@
1
+ import { SeoResolved, OpinlyConfig } from '@opinly/shared';
2
+ export { OpinlyConfig, OpinlyMeta, SeoResolved, buildBlogPostingJsonLd, buildBreadcrumbJsonLd, buildCollectionJsonLd, buildFaqJsonLd, buildMetadata, buildPersonJsonLd } from '@opinly/shared';
3
+
4
+ /** A Nuxt `useHead()`-compatible input (structural — no Nuxt runtime import). */
5
+ interface OpinlyHead {
6
+ title: string;
7
+ meta: {
8
+ name?: string;
9
+ property?: string;
10
+ content: string;
11
+ }[];
12
+ script?: {
13
+ type: string;
14
+ innerHTML: string;
15
+ }[];
16
+ }
17
+ /**
18
+ * Build a Nuxt `useHead()` input from a resolved blog route. Title + OG tags come
19
+ * from @opinly/shared's `buildMetadata`; pass JSON-LD objects (built with
20
+ * @opinly/shared's `buildBlogPostingJsonLd` etc.) via `jsonLd` to emit ld+json scripts.
21
+ *
22
+ * @example useHead(opinlyHead({ resolved, config, jsonLd: [buildBlogPostingJsonLd(...)] }))
23
+ */
24
+ declare function opinlyHead(args: {
25
+ resolved: SeoResolved;
26
+ config: OpinlyConfig;
27
+ jsonLd?: object[];
28
+ }): OpinlyHead;
29
+
30
+ export { type OpinlyHead, opinlyHead };
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ // src/index.ts
2
+ import {
3
+ buildMetadata
4
+ } from "@opinly/shared";
5
+ import {
6
+ buildMetadata as buildMetadata2,
7
+ buildBlogPostingJsonLd,
8
+ buildFaqJsonLd,
9
+ buildBreadcrumbJsonLd,
10
+ buildPersonJsonLd,
11
+ buildCollectionJsonLd
12
+ } from "@opinly/shared";
13
+ var metaTags = (m) => {
14
+ const tags = [];
15
+ if (m.description) tags.push({ name: "description", content: m.description });
16
+ tags.push({ property: "og:title", content: m.title });
17
+ if (m.description) tags.push({ property: "og:description", content: m.description });
18
+ if (m.ogType) tags.push({ property: "og:type", content: m.ogType });
19
+ if (m.ogImage) tags.push({ property: "og:image", content: m.ogImage });
20
+ if (m.canonicalUrl) tags.push({ property: "og:url", content: m.canonicalUrl });
21
+ return tags;
22
+ };
23
+ function opinlyHead(args) {
24
+ const m = buildMetadata(args.resolved, args.config);
25
+ return {
26
+ title: m.title,
27
+ meta: metaTags(m),
28
+ ...args.jsonLd?.length ? {
29
+ script: args.jsonLd.map((d) => ({
30
+ type: "application/ld+json",
31
+ innerHTML: JSON.stringify(d)
32
+ }))
33
+ } : {}
34
+ };
35
+ }
36
+ export {
37
+ buildBlogPostingJsonLd,
38
+ buildBreadcrumbJsonLd,
39
+ buildCollectionJsonLd,
40
+ buildFaqJsonLd,
41
+ buildMetadata2 as buildMetadata,
42
+ buildPersonJsonLd,
43
+ opinlyHead
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n buildMetadata,\n type OpinlyConfig,\n type OpinlyMeta,\n type SeoResolved,\n} from \"@opinly/shared\";\n\n/** A Nuxt `useHead()`-compatible input (structural — no Nuxt runtime import). */\nexport interface OpinlyHead {\n title: string;\n meta: { name?: string; property?: string; content: string }[];\n script?: { type: string; innerHTML: string }[];\n}\n\nconst metaTags = (m: OpinlyMeta): OpinlyHead[\"meta\"] => {\n const tags: OpinlyHead[\"meta\"] = [];\n if (m.description) tags.push({ name: \"description\", content: m.description });\n tags.push({ property: \"og:title\", content: m.title });\n if (m.description) tags.push({ property: \"og:description\", content: m.description });\n if (m.ogType) tags.push({ property: \"og:type\", content: m.ogType });\n if (m.ogImage) tags.push({ property: \"og:image\", content: m.ogImage });\n if (m.canonicalUrl) tags.push({ property: \"og:url\", content: m.canonicalUrl });\n return tags;\n};\n\n/**\n * Build a Nuxt `useHead()` input from a resolved blog route. Title + OG tags come\n * from @opinly/shared's `buildMetadata`; pass JSON-LD objects (built with\n * @opinly/shared's `buildBlogPostingJsonLd` etc.) via `jsonLd` to emit ld+json scripts.\n *\n * @example useHead(opinlyHead({ resolved, config, jsonLd: [buildBlogPostingJsonLd(...)] }))\n */\nexport function opinlyHead(args: {\n resolved: SeoResolved;\n config: OpinlyConfig;\n jsonLd?: object[];\n}): OpinlyHead {\n const m = buildMetadata(args.resolved, args.config);\n return {\n title: m.title,\n meta: metaTags(m),\n ...(args.jsonLd?.length\n ? {\n script: args.jsonLd.map((d) => ({\n type: \"application/ld+json\",\n innerHTML: JSON.stringify(d),\n })),\n }\n : {}),\n };\n}\n\nexport {\n buildMetadata,\n buildBlogPostingJsonLd,\n buildFaqJsonLd,\n buildBreadcrumbJsonLd,\n buildPersonJsonLd,\n buildCollectionJsonLd,\n} from \"@opinly/shared\";\nexport type { OpinlyConfig, OpinlyMeta, SeoResolved } from \"@opinly/shared\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;AA+CP;AAAA,EACE,iBAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA7CP,IAAM,WAAW,CAAC,MAAsC;AACtD,QAAM,OAA2B,CAAC;AAClC,MAAI,EAAE,YAAa,MAAK,KAAK,EAAE,MAAM,eAAe,SAAS,EAAE,YAAY,CAAC;AAC5E,OAAK,KAAK,EAAE,UAAU,YAAY,SAAS,EAAE,MAAM,CAAC;AACpD,MAAI,EAAE,YAAa,MAAK,KAAK,EAAE,UAAU,kBAAkB,SAAS,EAAE,YAAY,CAAC;AACnF,MAAI,EAAE,OAAQ,MAAK,KAAK,EAAE,UAAU,WAAW,SAAS,EAAE,OAAO,CAAC;AAClE,MAAI,EAAE,QAAS,MAAK,KAAK,EAAE,UAAU,YAAY,SAAS,EAAE,QAAQ,CAAC;AACrE,MAAI,EAAE,aAAc,MAAK,KAAK,EAAE,UAAU,UAAU,SAAS,EAAE,aAAa,CAAC;AAC7E,SAAO;AACT;AASO,SAAS,WAAW,MAIZ;AACb,QAAM,IAAI,cAAc,KAAK,UAAU,KAAK,MAAM;AAClD,SAAO;AAAA,IACL,OAAO,EAAE;AAAA,IACT,MAAM,SAAS,CAAC;AAAA,IAChB,GAAI,KAAK,QAAQ,SACb;AAAA,MACE,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO;AAAA,QAC9B,MAAM;AAAA,QACN,WAAW,KAAK,UAAU,CAAC;AAAA,MAC7B,EAAE;AAAA,IACJ,IACA,CAAC;AAAA,EACP;AACF;","names":["buildMetadata"]}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@opinly/nuxt",
3
+ "description": "Nuxt SEO helpers for Opinly content — useHead() input from resolved content.",
4
+ "version": "1.0.0-alpha.0",
5
+ "private": false,
6
+ "type": "module",
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "dependencies": {
18
+ "@opinly/shared": "1.0.0-alpha.0"
19
+ },
20
+ "devDependencies": {
21
+ "tsup": "^8.5.0",
22
+ "typescript": "^5.3.3"
23
+ },
24
+ "engines": {
25
+ "node": ">=16"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "files": [
31
+ "dist/**"
32
+ ],
33
+ "sideEffects": false,
34
+ "scripts": {
35
+ "build": "tsup",
36
+ "packages-dev": "tsup --config tsup.config.ts --watch",
37
+ "check-types": "tsc --noEmit",
38
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
39
+ }
40
+ }