@moku-labs/web 0.1.0-alpha.3 → 0.2.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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +71 -23
  3. package/dist/chunk-DQk6qfdC.mjs +18 -0
  4. package/dist/index.cjs +5514 -36
  5. package/dist/index.d.cts +2078 -104
  6. package/dist/index.d.mts +2078 -104
  7. package/dist/index.mjs +5394 -28
  8. package/package.json +60 -60
  9. package/dist/bin/moku.cjs +0 -1383
  10. package/dist/bin/moku.d.cts +0 -1
  11. package/dist/bin/moku.d.mts +0 -1
  12. package/dist/bin/moku.mjs +0 -1383
  13. package/dist/factory-BHhulW27.d.mts +0 -90
  14. package/dist/factory-D0m7Xil2.d.cts +0 -90
  15. package/dist/factory-DVcAQYEZ.cjs +0 -1710
  16. package/dist/factory-DwpBwjDk.mjs +0 -1602
  17. package/dist/index-CddOHo8I.d.mts +0 -413
  18. package/dist/plugins/head/build.cjs +0 -35
  19. package/dist/plugins/head/build.d.cts +0 -17
  20. package/dist/plugins/head/build.d.mts +0 -17
  21. package/dist/plugins/head/build.mjs +0 -27
  22. package/dist/plugins/spa/index.cjs +0 -26
  23. package/dist/plugins/spa/index.d.cts +0 -30
  24. package/dist/plugins/spa/index.d.mts +0 -30
  25. package/dist/plugins/spa/index.mjs +0 -24
  26. package/dist/primitives-BBo4wxUL.d.cts +0 -69
  27. package/dist/primitives-BYUp6kae.cjs +0 -100
  28. package/dist/primitives-Dlfi3JTx.d.mts +0 -69
  29. package/dist/primitives-gO5i1tD8.mjs +0 -58
  30. package/dist/project-1pAh4RxJ.cjs +0 -1270
  31. package/dist/project-BaG_ipVz.mjs +0 -1203
  32. package/dist/route-builder-CKvvehVO.d.cts +0 -413
  33. package/dist/test.cjs +0 -82
  34. package/dist/test.d.cts +0 -61
  35. package/dist/test.d.mts +0 -61
  36. package/dist/test.mjs +0 -79
  37. package/dist/wrangler-BHdkyMRj.cjs +0 -423
  38. package/dist/wrangler-Coyrznz4.mjs +0 -369
@@ -1,69 +0,0 @@
1
- //#region src/plugins/head/types.d.ts
2
- /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
3
- type HeadElement = {
4
- tag: 'meta' | 'link' | 'script' | 'title';
5
- attrs: Record<string, string>;
6
- content?: string;
7
- };
8
- type HeadConfig = {
9
- title?: string;
10
- elements?: HeadElement[];
11
- };
12
- type ArticleMeta = {
13
- publishedTime?: string;
14
- modifiedTime?: string;
15
- author?: string;
16
- tags?: string[];
17
- section?: string;
18
- };
19
- type OGFontConfig = {
20
- subset: string;
21
- weights: number[];
22
- };
23
- type OGImageConfig = {
24
- template?: unknown;
25
- fontDir?: string;
26
- fontName?: string;
27
- fonts?: OGFontConfig[];
28
- };
29
- type HeadPluginConfig = {
30
- ogImage?: OGImageConfig;
31
- titleSeparator?: string;
32
- autoCanonical?: boolean;
33
- };
34
- type HeadState = {
35
- config: Readonly<HeadPluginConfig>;
36
- ogImageDefaults: Readonly<OGImageConfig> | null;
37
- };
38
- type RenderContext = {
39
- url: string;
40
- locale: string;
41
- };
42
- type HeadApi = {
43
- render(config: HeadConfig, ctx: RenderContext): string;
44
- primitives: {
45
- meta(name: string, content: string): HeadElement;
46
- og(property: string, content: string): HeadElement;
47
- jsonLd(data: unknown): HeadElement;
48
- canonical(url: string): HeadElement;
49
- hreflang(locale: string, url: string): HeadElement;
50
- twitter(name: string, content: string): HeadElement;
51
- feedLink(title: string, url: string, type?: 'rss' | 'atom'): HeadElement;
52
- };
53
- buildArticleHead(meta: ArticleMeta, canonicalUrl: string): HeadElement[];
54
- };
55
- //#endregion
56
- //#region src/plugins/head/primitives.d.ts
57
- declare const meta: (name: string, content: string) => HeadElement;
58
- declare const og: (property: string, content: string) => HeadElement;
59
- /**
60
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `</script>` injection.
61
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
62
- */
63
- declare const jsonLd: (data: unknown) => HeadElement;
64
- declare const canonical: (url: string) => HeadElement;
65
- declare const hreflang: (locale: string, url: string) => HeadElement;
66
- declare const twitter: (name: string, content: string) => HeadElement;
67
- declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
68
- //#endregion
69
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
@@ -1,100 +0,0 @@
1
-
2
- //#region src/plugins/head/primitives.ts
3
- const meta = (name, content) => ({
4
- tag: "meta",
5
- attrs: {
6
- name,
7
- content
8
- }
9
- });
10
- const og = (property, content) => ({
11
- tag: "meta",
12
- attrs: {
13
- property: `og:${property}`,
14
- content
15
- }
16
- });
17
- /**
18
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `<\/script>` injection.
19
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
20
- */
21
- const jsonLd = (data) => ({
22
- tag: "script",
23
- attrs: { type: "application/ld+json" },
24
- content: JSON.stringify(data).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026")
25
- });
26
- const canonical = (url) => ({
27
- tag: "link",
28
- attrs: {
29
- rel: "canonical",
30
- href: url
31
- }
32
- });
33
- const hreflang = (locale, url) => ({
34
- tag: "link",
35
- attrs: {
36
- rel: "alternate",
37
- hreflang: locale,
38
- href: url
39
- }
40
- });
41
- const twitter = (name, content) => ({
42
- tag: "meta",
43
- attrs: {
44
- name: `twitter:${name}`,
45
- content
46
- }
47
- });
48
- const feedLink = (title, url, type = "rss") => ({
49
- tag: "link",
50
- attrs: {
51
- rel: "alternate",
52
- type: type === "rss" ? "application/rss+xml" : "application/atom+xml",
53
- title,
54
- href: url
55
- }
56
- });
57
-
58
- //#endregion
59
- Object.defineProperty(exports, 'canonical', {
60
- enumerable: true,
61
- get: function () {
62
- return canonical;
63
- }
64
- });
65
- Object.defineProperty(exports, 'feedLink', {
66
- enumerable: true,
67
- get: function () {
68
- return feedLink;
69
- }
70
- });
71
- Object.defineProperty(exports, 'hreflang', {
72
- enumerable: true,
73
- get: function () {
74
- return hreflang;
75
- }
76
- });
77
- Object.defineProperty(exports, 'jsonLd', {
78
- enumerable: true,
79
- get: function () {
80
- return jsonLd;
81
- }
82
- });
83
- Object.defineProperty(exports, 'meta', {
84
- enumerable: true,
85
- get: function () {
86
- return meta;
87
- }
88
- });
89
- Object.defineProperty(exports, 'og', {
90
- enumerable: true,
91
- get: function () {
92
- return og;
93
- }
94
- });
95
- Object.defineProperty(exports, 'twitter', {
96
- enumerable: true,
97
- get: function () {
98
- return twitter;
99
- }
100
- });
@@ -1,69 +0,0 @@
1
- //#region src/plugins/head/types.d.ts
2
- /** @file head plugin types — HeadElement, HeadConfig, ArticleMeta, OGImageConfig. */
3
- type HeadElement = {
4
- tag: 'meta' | 'link' | 'script' | 'title';
5
- attrs: Record<string, string>;
6
- content?: string;
7
- };
8
- type HeadConfig = {
9
- title?: string;
10
- elements?: HeadElement[];
11
- };
12
- type ArticleMeta = {
13
- publishedTime?: string;
14
- modifiedTime?: string;
15
- author?: string;
16
- tags?: string[];
17
- section?: string;
18
- };
19
- type OGFontConfig = {
20
- subset: string;
21
- weights: number[];
22
- };
23
- type OGImageConfig = {
24
- template?: unknown;
25
- fontDir?: string;
26
- fontName?: string;
27
- fonts?: OGFontConfig[];
28
- };
29
- type HeadPluginConfig = {
30
- ogImage?: OGImageConfig;
31
- titleSeparator?: string;
32
- autoCanonical?: boolean;
33
- };
34
- type HeadState = {
35
- config: Readonly<HeadPluginConfig>;
36
- ogImageDefaults: Readonly<OGImageConfig> | null;
37
- };
38
- type RenderContext = {
39
- url: string;
40
- locale: string;
41
- };
42
- type HeadApi = {
43
- render(config: HeadConfig, ctx: RenderContext): string;
44
- primitives: {
45
- meta(name: string, content: string): HeadElement;
46
- og(property: string, content: string): HeadElement;
47
- jsonLd(data: unknown): HeadElement;
48
- canonical(url: string): HeadElement;
49
- hreflang(locale: string, url: string): HeadElement;
50
- twitter(name: string, content: string): HeadElement;
51
- feedLink(title: string, url: string, type?: 'rss' | 'atom'): HeadElement;
52
- };
53
- buildArticleHead(meta: ArticleMeta, canonicalUrl: string): HeadElement[];
54
- };
55
- //#endregion
56
- //#region src/plugins/head/primitives.d.ts
57
- declare const meta: (name: string, content: string) => HeadElement;
58
- declare const og: (property: string, content: string) => HeadElement;
59
- /**
60
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `</script>` injection.
61
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
62
- */
63
- declare const jsonLd: (data: unknown) => HeadElement;
64
- declare const canonical: (url: string) => HeadElement;
65
- declare const hreflang: (locale: string, url: string) => HeadElement;
66
- declare const twitter: (name: string, content: string) => HeadElement;
67
- declare const feedLink: (title: string, url: string, type?: "rss" | "atom") => HeadElement;
68
- //#endregion
69
- export { meta as a, ArticleMeta as c, HeadPluginConfig as d, HeadState as f, jsonLd as i, HeadApi as l, feedLink as n, og as o, OGImageConfig as p, hreflang as r, twitter as s, canonical as t, HeadElement as u };
@@ -1,58 +0,0 @@
1
- //#region src/plugins/head/primitives.ts
2
- const meta = (name, content) => ({
3
- tag: "meta",
4
- attrs: {
5
- name,
6
- content
7
- }
8
- });
9
- const og = (property, content) => ({
10
- tag: "meta",
11
- attrs: {
12
- property: `og:${property}`,
13
- content
14
- }
15
- });
16
- /**
17
- * JSON-LD with unicode-escape XSS protection. `JSON.stringify` alone is exploitable via `<\/script>` injection.
18
- * Escape sequence prevents script-context breakout. NEVER add an `unsafe: true` opt-out — this is non-negotiable.
19
- */
20
- const jsonLd = (data) => ({
21
- tag: "script",
22
- attrs: { type: "application/ld+json" },
23
- content: JSON.stringify(data).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026")
24
- });
25
- const canonical = (url) => ({
26
- tag: "link",
27
- attrs: {
28
- rel: "canonical",
29
- href: url
30
- }
31
- });
32
- const hreflang = (locale, url) => ({
33
- tag: "link",
34
- attrs: {
35
- rel: "alternate",
36
- hreflang: locale,
37
- href: url
38
- }
39
- });
40
- const twitter = (name, content) => ({
41
- tag: "meta",
42
- attrs: {
43
- name: `twitter:${name}`,
44
- content
45
- }
46
- });
47
- const feedLink = (title, url, type = "rss") => ({
48
- tag: "link",
49
- attrs: {
50
- rel: "alternate",
51
- type: type === "rss" ? "application/rss+xml" : "application/atom+xml",
52
- title,
53
- href: url
54
- }
55
- });
56
-
57
- //#endregion
58
- export { meta as a, jsonLd as i, feedLink as n, og as o, hreflang as r, twitter as s, canonical as t };