vowel 0.6.3 → 0.7.0-beta.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 (165) hide show
  1. package/README.md +23 -17
  2. package/bin.js +87 -30
  3. package/cli.js +15 -0
  4. package/config.js +102 -16
  5. package/extractDate.js +70 -6
  6. package/index.js +14 -5
  7. package/package.json +42 -7
  8. package/plugins/assets/index.js +65 -0
  9. package/plugins/atproto/index.js +132 -0
  10. package/plugins/atproto/password.js +71 -0
  11. package/plugins/atproto/publish.js +406 -0
  12. package/plugins/atproto/record.js +144 -0
  13. package/plugins/atproto/rkey.js +54 -0
  14. package/plugins/deploy-cloudflare/index.js +92 -0
  15. package/plugins/fonts/index.js +18 -21
  16. package/plugins/html/assets/bundle-BeK1Hptv.css +21 -0
  17. package/plugins/html/bundle/assets/index-BeK1Hptv.css +21 -0
  18. package/plugins/html/bundle/index.js +21145 -0
  19. package/plugins/html/editor/EditButton.svelte +152 -0
  20. package/plugins/html/editor/Editor.svelte +51 -0
  21. package/plugins/html/editor/Overlays.svelte +6 -0
  22. package/plugins/html/editor/SettingsPanel.svelte +397 -0
  23. package/plugins/html/editor/Toolbar.svelte +644 -0
  24. package/plugins/html/editor/create-session.js +250 -0
  25. package/plugins/html/editor/directives.js +128 -0
  26. package/plugins/html/editor/frontmatter.js +97 -0
  27. package/plugins/html/editor/ingest.js +339 -0
  28. package/plugins/html/editor/main.js +94 -0
  29. package/plugins/html/editor/nodes/Alert.svelte +21 -0
  30. package/plugins/html/editor/nodes/Blockquote.svelte +9 -0
  31. package/plugins/html/editor/nodes/CodeBlock.svelte +19 -0
  32. package/plugins/html/editor/nodes/Embed.svelte +19 -0
  33. package/plugins/html/editor/nodes/Emphasis.svelte +11 -0
  34. package/plugins/html/editor/nodes/Heading.svelte +15 -0
  35. package/plugins/html/editor/nodes/Highlight.svelte +11 -0
  36. package/plugins/html/editor/nodes/Image.svelte +18 -0
  37. package/plugins/html/editor/nodes/InlineCode.svelte +11 -0
  38. package/plugins/html/editor/nodes/Link.svelte +17 -0
  39. package/plugins/html/editor/nodes/List.svelte +15 -0
  40. package/plugins/html/editor/nodes/ListItem.svelte +9 -0
  41. package/plugins/html/editor/nodes/Page.svelte +21 -0
  42. package/plugins/html/editor/nodes/Paragraph.svelte +9 -0
  43. package/plugins/html/editor/nodes/Strikethrough.svelte +11 -0
  44. package/plugins/html/editor/nodes/Strong.svelte +11 -0
  45. package/plugins/html/editor/nodes/ThematicBreak.svelte +9 -0
  46. package/plugins/html/editor/nodes/index.js +18 -0
  47. package/plugins/html/editor/rollup.config.js +35 -0
  48. package/plugins/html/editor/serialize.js +157 -0
  49. package/plugins/html/editor/settings-file.js +83 -0
  50. package/plugins/html/editor/socket.js +202 -0
  51. package/plugins/html/editor/source.js +43 -0
  52. package/plugins/html/image.js +104 -0
  53. package/plugins/html/index.js +760 -0
  54. package/plugins/html/partials.js +299 -0
  55. package/plugins/html/socialLinks.js +67 -0
  56. package/plugins/html/writeRules.js +377 -0
  57. package/plugins/icons/index.js +2 -6
  58. package/plugins/images/index.js +78 -55
  59. package/plugins/markdown/brandColors.js +10 -0
  60. package/plugins/markdown/colorScheme.js +64 -0
  61. package/plugins/markdown/emoji.js +30 -0
  62. package/plugins/markdown/frontmatter.js +253 -0
  63. package/plugins/markdown/index.js +287 -1274
  64. package/plugins/markdown/links.js +97 -0
  65. package/plugins/markdown/metadata.js +308 -0
  66. package/plugins/markdown/readRules.js +143 -0
  67. package/plugins/markdown/typography.js +109 -0
  68. package/plugins/markdown/visitor.js +143 -0
  69. package/plugins/publish/index.js +34 -0
  70. package/plugins/robots/agents.js +79 -0
  71. package/plugins/robots/index.js +30 -10
  72. package/plugins/robots/robots.js +48 -0
  73. package/plugins/styles/index.js +111 -26
  74. package/plugins/styles/theme.js +116 -0
  75. package/plugins/urls/index.js +78 -0
  76. package/plugins/urls/urlMetadata.js +246 -0
  77. package/plugins/vectors/index.js +5 -9
  78. package/plugins/xml/entryContent.js +103 -0
  79. package/plugins/xml/index.js +123 -50
  80. package/secretPaths.js +170 -0
  81. package/stylesheets/DefaultStyles.css +367 -437
  82. package/stylesheets/ResetStyles.css +2 -38
  83. package/stylesheets/SyntaxHighlightingStyles.css +269 -0
  84. package/stylesheets/TypographyStyles.css +386 -128
  85. package/systemPaths.js +48 -0
  86. package/utils.js +56 -5
  87. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -73
  88. package/.github/ISSUE_TEMPLATE/config.yml +0 -7
  89. package/docs-source/.cache.json +0 -9
  90. package/docs-source/.obsidian/app.json +0 -3
  91. package/docs-source/.obsidian/appearance.json +0 -3
  92. package/docs-source/.obsidian/core-plugins-migration.json +0 -30
  93. package/docs-source/.obsidian/core-plugins.json +0 -20
  94. package/docs-source/.obsidian/workspace.json +0 -168
  95. package/docs-source/.stackblitzrc +0 -3
  96. package/docs-source/.votive.db +0 -0
  97. package/docs-source/about.md +0 -3
  98. package/docs-source/blog/home.md +0 -5
  99. package/docs-source/blog/url-ui.md +0 -21
  100. package/docs-source/blog.md +0 -5
  101. package/docs-source/docs/.votive.db +0 -0
  102. package/docs-source/docs/deploy.md +0 -67
  103. package/docs-source/docs/file-structure.md +0 -31
  104. package/docs-source/docs/folder-settings.md +0 -23
  105. package/docs-source/docs/home.md +0 -55
  106. package/docs-source/docs/images.md +0 -10
  107. package/docs-source/docs/items.md +0 -13
  108. package/docs-source/docs/pages.md +0 -141
  109. package/docs-source/docs/settings.md +0 -4
  110. package/docs-source/docs/styling.md +0 -34
  111. package/docs-source/docs/taxonomies.md +0 -37
  112. package/docs-source/features/cards.md +0 -7
  113. package/docs-source/features/editing.md +0 -7
  114. package/docs-source/features/emoji.md +0 -7
  115. package/docs-source/features/frontmatter.md +0 -7
  116. package/docs-source/features/lists.md +0 -7
  117. package/docs-source/features/navigation.md +0 -7
  118. package/docs-source/features/rich-previews.md +0 -7
  119. package/docs-source/features/robots.md +0 -7
  120. package/docs-source/features/rss.md +0 -7
  121. package/docs-source/features/sitemap.md +0 -7
  122. package/docs-source/features/speed.md +0 -7
  123. package/docs-source/features/static.md +0 -7
  124. package/docs-source/features/taxonomies.md +0 -7
  125. package/docs-source/home.md +0 -42
  126. package/docs-source/output/about.html +0 -1
  127. package/docs-source/output/blog/url-ui.html +0 -8
  128. package/docs-source/output/blog.html +0 -1
  129. package/docs-source/output/default.css +0 -1
  130. package/docs-source/output/docs/deploy.html +0 -34
  131. package/docs-source/output/docs/file-structure.html +0 -24
  132. package/docs-source/output/docs/folder-settings.html +0 -20
  133. package/docs-source/output/docs/images.html +0 -2
  134. package/docs-source/output/docs/items.html +0 -6
  135. package/docs-source/output/docs/pages.html +0 -101
  136. package/docs-source/output/docs/styling.html +0 -18
  137. package/docs-source/output/docs/taxonomies.html +0 -20
  138. package/docs-source/output/docs.html +0 -28
  139. package/docs-source/output/features/cards.html +0 -1
  140. package/docs-source/output/features/editing.html +0 -1
  141. package/docs-source/output/features/emoji.html +0 -1
  142. package/docs-source/output/features/frontmatter.html +0 -1
  143. package/docs-source/output/features/lists.html +0 -1
  144. package/docs-source/output/features/navigation.html +0 -1
  145. package/docs-source/output/features/rich-previews.html +0 -1
  146. package/docs-source/output/features/robots.html +0 -1
  147. package/docs-source/output/features/rss.html +0 -1
  148. package/docs-source/output/features/sitemap.html +0 -1
  149. package/docs-source/output/features/speed.html +0 -1
  150. package/docs-source/output/features/static.html +0 -1
  151. package/docs-source/output/features/taxonomies.html +0 -1
  152. package/docs-source/output/features.html +0 -1
  153. package/docs-source/output/feed.xml +0 -1
  154. package/docs-source/output/index.html +0 -21
  155. package/docs-source/output/reset.css +0 -1
  156. package/docs-source/output/roadmap.html +0 -87
  157. package/docs-source/output/robots.txt +0 -14
  158. package/docs-source/output/sitemap.xml +0 -16
  159. package/docs-source/output/typography.css +0 -1
  160. package/docs-source/roadmap.md +0 -98
  161. package/docs-source/settings.md +0 -13
  162. package/getMetadata.js +0 -41
  163. package/jsconfig.json +0 -10
  164. package/regex.js +0 -36
  165. package/stylesheets/brand-colors.css +0 -119
@@ -0,0 +1,92 @@
1
+ import votive from "votive"
2
+ import { spawn } from "node:child_process"
3
+ import path from "node:path"
4
+
5
+ /**
6
+ * Publishes a full build to Cloudflare Pages via `wrangler pages deploy`.
7
+ *
8
+ * Always runs a complete build first, regardless of whether a dev server
9
+ * happens to already be running against this config - a command's
10
+ * context (config, notify) has no reference to a live server's own build
11
+ * queue, and this needs to behave identically whether triggered from the
12
+ * CLI (no server at all, see votive's runCommand) or a live "Publish"
13
+ * button over WS. Modest redundant cost when a dev server IS already
14
+ * running (bundle() is cheap when nothing's stale), traded for one
15
+ * deploy command that works the same everywhere.
16
+ *
17
+ * Shells out to `wrangler` rather than calling Cloudflare's REST API
18
+ * directly - Pages deploys require content-hashing every asset and
19
+ * building a manifest in Cloudflare's specific format, which wrangler
20
+ * already implements and maintains. `wrangler` reads
21
+ * CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID from the environment
22
+ * natively; this never touches credentials itself, and none should ever
23
+ * be added to `config` (it isn't a place secrets should live).
24
+ *
25
+ * @param {any} payload
26
+ * @param {{ config: import("votive").VotiveConfig & { cloudflareProjectName?: string }, notify: (message: object) => void }} context
27
+ */
28
+ async function deployToCloudflarePages(payload, { config, notify }) {
29
+ notify({ status: "progress", message: "Building..." })
30
+
31
+ // Unlike a dev server's own rebuilds, a deploy needs everything done -
32
+ // there's no "next edit" to stay responsive for - so the deferred
33
+ // work (image derivatives, link previews) is awaited, and the site is
34
+ // closed: the database is a cache on disk, and this process is done
35
+ // with it.
36
+ const site = await votive({ ...config, verbose: false })
37
+ await (await site.build()).deferred
38
+ const setting = site.database.setting.getByFolder("").lastNonNull("fm_cloudflare_project")
39
+ await site.close()
40
+
41
+ // The Pages project, from the command's payload (`vowel --command
42
+ // deploy --payload '{"projectName":"my-site"}'`, or a Publish button's
43
+ // body), the root settings.md's `cloudflare_project:`, or the config an
44
+ // embedder built.
45
+ const projectName = payload?.projectName ?? setting ?? config.cloudflareProjectName
46
+ if (!projectName) throw new Error("a Cloudflare Pages project name is required to deploy: set cloudflare_project in the root settings.md, or pass {\"projectName\": \"…\"} as the payload")
47
+
48
+ // `{"dryRun": true}` builds and stops short of wrangler.
49
+ if (payload?.dryRun) {
50
+ notify({ status: "done", message: `Would deploy ${config.targetFolder} to Cloudflare Pages project ${projectName}` })
51
+ return { deployed: false, projectName, dryRun: true }
52
+ }
53
+
54
+ notify({ status: "progress", message: `Publishing ${config.targetFolder} to Cloudflare Pages...` })
55
+
56
+ return new Promise((resolve, reject) => {
57
+ const proc = spawn(
58
+ "wrangler",
59
+ ["pages", "deploy", config.targetFolder, "--project-name", projectName],
60
+ { stdio: ["ignore", "pipe", "pipe"] }
61
+ )
62
+
63
+ // Piped, not "inherit" - this can run with no terminal attached at
64
+ // all (triggered over WS from a browser), so wrangler's own output
65
+ // has to go through notify() to reach whoever's actually watching.
66
+ proc.stdout.on("data", chunk => notify({ status: "progress", message: chunk.toString() }))
67
+ proc.stderr.on("data", chunk => notify({ status: "progress", message: chunk.toString() }))
68
+
69
+ proc.on("error", reject) // e.g. wrangler isn't installed
70
+ proc.on("exit", code => {
71
+ if (code === 0) resolve({ deployed: true, projectName })
72
+ else reject(new Error(`wrangler exited with code ${code}`))
73
+ })
74
+ })
75
+ }
76
+
77
+ /**
78
+ * In vowel's default plugin list (config.js), so `vowel --command
79
+ * deploy` reaches it from any project. Registering a command costs
80
+ * nothing until it is invoked, and invoking it needs a project name,
81
+ * so a site that deploys elsewhere never meets it.
82
+ * @type {import("votive").VotivePlugin}
83
+ */
84
+ const vowelDeployCloudflarePlugin = {
85
+ name: "vowel-deploy-cloudflare",
86
+ commands: {
87
+ deploy: deployToCloudflarePages
88
+ }
89
+ }
90
+
91
+ export default vowelDeployCloudflarePlugin
92
+ export { deployToCloudflarePages }
@@ -1,38 +1,35 @@
1
- import { readFile } from "node:fs/promises"
2
1
  /** @import * as Votive from "votive" */
3
2
 
4
- /** @type {Votive.ProcessorWrite} */
5
- async function writeFile(destination, database, config) {
6
- const buffer = await readFile(destination.abstract.filePath)
7
- return {
8
- data: buffer,
9
- }
10
- }
11
-
12
- function readFont(filePath) {
13
- return {
14
- abstract: { filePath },
15
- metadata: {}
16
- }
3
+ /**
4
+ * A font the project ships is copied straight through: target.buffer()
5
+ * resolves the source against sourceFolder at the moment of reading, so
6
+ * nothing about this machine is ever stored. The @font-face that uses
7
+ * it is the author's, in their own stylesheet.
8
+ *
9
+ * Vowel bundles no fonts of its own any more - the families and their
10
+ * stubs went with the typography ramps into TypographyStyles.css, which
11
+ * names a brand family through --font-*-brand and falls back to the
12
+ * system stack. Fonts by url: tasks/2-in-progress/load-fonts.md.
13
+ * @type {Votive.ProcessorWrite}
14
+ */
15
+ function writeFile(target) {
16
+ return { data: target.buffer() }
17
17
  }
18
18
 
19
19
  /** @type {Votive.VotiveProcessor} */
20
20
  const fontsReader = {
21
21
  format: "buffer",
22
22
  extensions: [".woff", ".woff2", ".ttf", ".otf"],
23
- readFile: readFont,
23
+ router: ({ name, dir, ext }) => ({ name, dir, ext }),
24
+ // A font carries no metadata worth inferring.
25
+ readFile: () => ({ metadata: {} }),
24
26
  writeFile
25
27
  }
26
28
 
27
29
  /** @type {Votive.VotivePlugin} */
28
30
  const vowelFontsPlugin = {
29
31
  name: "vowel-fonts",
30
- processors: [fontsReader],
31
- router: ({ name, dir, ext }) => {
32
- return {
33
- name, dir, ext
34
- }
35
- }
32
+ processors: [fontsReader]
36
33
  }
37
34
 
38
35
  export default vowelFontsPlugin
@@ -0,0 +1,21 @@
1
+ @layer svedit-defaults {
2
+ :root {
3
+ /* Primary accent for active editing controls, carets, and selections. */
4
+ --editing: oklch(60% 0.22 283);
5
+ /* Low-opacity version of the editing accent for passive highlights. */
6
+ --editing-muted: oklch(from var(--editing) l c h / 0.1);
7
+ /* Low-emphasis strokes and outlines, such as inactive node gaps. */
8
+ --editing-stroke: color-mix(in oklch, currentColor 25%, transparent);
9
+ /* Foreground color for content displayed on the editing accent. */
10
+ --editing-foreground: oklch(100% 0 0);
11
+ }
12
+ }
13
+
14
+ @layer svedit-defaults {
15
+ @keyframes node-caret-blink {
16
+ 0%, 60% { opacity: 1; }
17
+ 68% { opacity: 0; }
18
+ 88% { opacity: 0; }
19
+ 100% { opacity: 1; }
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ @layer svedit-defaults {
2
+ :root {
3
+ /* Primary accent for active editing controls, carets, and selections. */
4
+ --editing: oklch(60% 0.22 283);
5
+ /* Low-opacity version of the editing accent for passive highlights. */
6
+ --editing-muted: oklch(from var(--editing) l c h / 0.1);
7
+ /* Low-emphasis strokes and outlines, such as inactive node gaps. */
8
+ --editing-stroke: color-mix(in oklch, currentColor 25%, transparent);
9
+ /* Foreground color for content displayed on the editing accent. */
10
+ --editing-foreground: oklch(100% 0 0);
11
+ }
12
+ }
13
+
14
+ @layer svedit-defaults {
15
+ @keyframes node-caret-blink {
16
+ 0%, 60% { opacity: 1; }
17
+ 68% { opacity: 0; }
18
+ 88% { opacity: 0; }
19
+ 100% { opacity: 1; }
20
+ }
21
+ }