Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/builder docs #78

Merged
merged 50 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
bb0325f
chore: updated to latest dependencies
yankeeinlondon Mar 7, 2022
2932b47
chore: added files to help contributors better stick to existing stan…
yankeeinlondon Mar 7, 2022
d5318f4
feature: added GreyMatterOptions interface
yankeeinlondon Mar 7, 2022
9362cec
chore: add simple test to show usage
yankeeinlondon Mar 7, 2022
38ce61f
reverted prettier and linter configuration
yankeeinlondon Mar 8, 2022
9c8fd33
chore: formating
antfu Mar 9, 2022
cd3fe39
chore: initial implementation and tests
yankeeinlondon Mar 14, 2022
04b4da2
Feature/baseline builders (#1)
yankeeinlondon Mar 20, 2022
8ccb3a5
Merge remote-tracking branch 'upstream/main' into develop
yankeeinlondon Mar 20, 2022
ecc13b5
fix: fixed faulty merge on options resolver
yankeeinlondon Mar 20, 2022
ba7b3f1
fix: fixed the regression in README; makes it more like current version
yankeeinlondon Mar 21, 2022
09da7c3
chore: updated docs for MetaBuilder
yankeeinlondon Mar 21, 2022
a7f6057
fix: remove reference to `replaceAll` to remove testing errors
yankeeinlondon Mar 21, 2022
495f6ed
chore: improved BuilderApi docs
yankeeinlondon Mar 21, 2022
23b5b1b
chore: `@types` folder to `types`
yankeeinlondon Mar 21, 2022
326e6e6
Merge remote-tracking branch 'upstream/main' into develop
yankeeinlondon Mar 21, 2022
d702862
Merge remote-tracking branch 'upstream/main' into develop
yankeeinlondon Mar 27, 2022
bf36ee2
fix: ensures that wrapper classes are set regardless of whether wrapp…
yankeeinlondon Mar 27, 2022
52e6688
test: added tests for HEAD functionality and re-introduce code block …
yankeeinlondon Mar 27, 2022
93756c5
test: added tests to test behavior of exposeFrontmatter prop on Vue2 …
yankeeinlondon Mar 28, 2022
8cb16ed
fix: fixed lint regression
yankeeinlondon Mar 28, 2022
01fe38c
refactor: changed the pipeline to support async tasks
yankeeinlondon Apr 6, 2022
d130534
chore: conversion of whole pipeline to TaskEither functions
yankeeinlondon Apr 8, 2022
55701e8
chore: pipeline fully converted to async
yankeeinlondon Apr 8, 2022
514692c
chore: switch all tests over to use of async pipeline
yankeeinlondon Apr 9, 2022
92fef87
chore: added happy-dom utility's and started line number highlighting
yankeeinlondon Apr 12, 2022
9816b17
chore: all advanced tests for wrapWithText() are passing
yankeeinlondon Apr 13, 2022
fd24b67
chore: better abstractions for happy-dom utilities
yankeeinlondon Apr 16, 2022
017ff8d
Merge remote-tracking branch 'upstream/main' into feature/code-builder
yankeeinlondon Apr 16, 2022
3a2c5ee
chore: adjusted doc structure and simplified props parsing
yankeeinlondon Apr 18, 2022
88a632c
chore: refinements to happy-wrapper
yankeeinlondon Apr 20, 2022
060e529
chore: mild DOM structure improvements in code layout
yankeeinlondon Apr 22, 2022
e443922
fix: got frontmatter exports working again!
yankeeinlondon Apr 22, 2022
d3e9459
Merge remote-tracking branch 'up2/main' into feature/feature/fix-exports
yankeeinlondon Apr 22, 2022
377ba2e
chore: formatting updates
yankeeinlondon Apr 22, 2022
e7fae2a
Merge branch 'feature/feature/fix-exports' into develop
yankeeinlondon Apr 23, 2022
3e0b96d
Merge branch 'develop' into feature/code-builder
yankeeinlondon Apr 23, 2022
3daf785
test: updated snapshots
yankeeinlondon Apr 23, 2022
d681382
chore: refactor of example app
yankeeinlondon Apr 23, 2022
4dabe59
chore: improved some core tests around script hoisting, head function…
yankeeinlondon May 5, 2022
828d4a6
chore: tabular formatting 95% working
yankeeinlondon May 13, 2022
496c298
chore: tuned the prism color themes a bit
yankeeinlondon May 19, 2022
c52a88b
- fix: frontmatter exports (#67)
yankeeinlondon May 20, 2022
a4571b3
chore: lint check/fiix, update happy-dom
yankeeinlondon May 24, 2022
a6af9de
Merge remote-tracking branch 'up2/main'
yankeeinlondon May 24, 2022
10f6d3d
chore: added build dependency to build happy-wrapper
yankeeinlondon May 24, 2022
d24c0aa
chore: removed "happy-wrapper" to it's own repo
yankeeinlondon May 24, 2022
d426e5c
chore: remove extraneous global link file
yankeeinlondon May 24, 2022
3ea4813
docs: updated builder docs to be (hopefully) more clear about pipelin…
yankeeinlondon May 24, 2022
d522dd9
Merge branch 'main' into feature/builder-docs
yankeeinlondon May 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: added tests to test behavior of exposeFrontmatter prop on Vue2 …
…and Vue3
  • Loading branch information
yankeeinlondon committed Mar 28, 2022
commit 93756c56082206389539e1a431ef04d50d4d8404
40 changes: 40 additions & 0 deletions test/__snapshots__/exposeFrontmatter.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Vitest Snapshot v1

exports[`exposeFrontmatter property > Vue2 -- when exposeFrontmatter set to false -- does NOT use defineExpose method from Vue3 1`] = `
"<script>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
export const title = \\"Hello World\\"
export const description = \\"testing is the path to true happiness\\"
export const excerpt = undefined
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;

exports[`exposeFrontmatter property > Vue2 -- when exposeFrontmatter set to true -- does NOT use defineExpose method from Vue3 but does expose frontmattter 1`] = `
"<script>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
export const title = \\"Hello World\\"
export const description = \\"testing is the path to true happiness\\"
export const excerpt = undefined
export default { data() { return { frontmatter } } }

const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;

exports[`exposeFrontmatter property > Vue3 -- when exposeFrontmatter set to false -- does NOT use defineExpose to expose frontmatter 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;

exports[`exposeFrontmatter property > Vue3 -- when exposeFrontmatter set to true -- uses defineExpose method to expose to other components 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;
69 changes: 0 additions & 69 deletions test/__snapshots__/head.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
// Vitest Snapshot v1

exports[`using HEAD variables > !headEnabled 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;

exports[`using HEAD variables > default settings 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;

exports[`using HEAD variables > headEnabled 1`] = `
"<script setup>import { useHead } from \\"@vueuse/head\\"
const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
const meta = [{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
useHead(head)
</script>"
`;

exports[`using HEAD variables > when headEnabled property is set to \`false\`, behavior is same as the default 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
Expand All @@ -55,39 +22,3 @@ const head = {\\"title\\":\\"Hello World\\",\\"meta\\":[{\\"property\\":\\"og:ti
useHead(head)
</script>"
`;

exports[`using HEAD variables > when the headEnabled property is set, 1`] = `
"<script setup>import { useHead } from \\"@vueuse/head\\"
const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
const meta = [{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
useHead(head)
</script>"
`;

exports[`using HEAD variables > when the headEnabled property is set, all interaction with useHead is enabled 1`] = `
"<script setup>import { useHead } from \\"@vueuse/head\\"
const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
const meta = [{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"meta\\":[{\\"property\\":\\"og:title\\",\\"content\\":\\"Hello World\\"},{\\"property\\":\\"og:description\\",\\"content\\":\\"testing is the path to true happiness\\"},{\\"name\\":\\"description\\",\\"content\\":\\"testing is the path to true happiness\\"}]}
useHead(head)
</script>"
`;

exports[`using HEAD variables > with default settings, head variable defined but no references to useHead 1`] = `
"<script setup>const frontmatter = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
const title = \\"Hello World\\"
const description = \\"testing is the path to true happiness\\"
const excerpt = undefined
defineExpose({ frontmatter })
const head = {\\"title\\":\\"Hello World\\",\\"description\\":\\"testing is the path to true happiness\\"}
</script>"
`;
41 changes: 41 additions & 0 deletions test/exposeFrontmatter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { readFile } from 'fs/promises'
import { beforeAll, describe, expect, it } from 'vitest'
import { composeSfcBlocks } from '../src/pipeline'

let md = ''
const defineExposeFound = /defineExpose\({ frontmatter }\)/
const vue2ExposeFound = /export default { data\(\) { return { frontmatter } } }/

describe('exposeFrontmatter property', () => {
beforeAll(async () => {
md = await readFile('test/fixtures/simple.md', 'utf-8')
})
it('Vue3 -- when exposeFrontmatter set to true -- uses defineExpose method to expose to other components', () => {
const { scriptBlock } = composeSfcBlocks('test/fixtures/simple.md', md, { exposeFrontmatter: true })
expect(defineExposeFound.test(scriptBlock)).toBeTruthy()
expect(vue2ExposeFound.test(scriptBlock)).toBeFalsy()
expect(scriptBlock).toMatchSnapshot()
})

it('Vue3 -- when exposeFrontmatter set to false -- does NOT use defineExpose to expose frontmatter', () => {
const { scriptBlock } = composeSfcBlocks('test/fixtures/simple.md', md, { exposeFrontmatter: false })
expect(defineExposeFound.test(scriptBlock)).toBeFalsy()
expect(vue2ExposeFound.test(scriptBlock)).toBeFalsy()
expect(scriptBlock).toMatchSnapshot()
})

it('Vue2 -- when exposeFrontmatter set to true -- does NOT use defineExpose method from Vue3 but does expose frontmattter', () => {
const { scriptBlock } = composeSfcBlocks('test/fixtures/simple.md', md, { exposeFrontmatter: true, vueVersion: '2.0' })
expect(defineExposeFound.test(scriptBlock)).toBeFalsy()
expect(vue2ExposeFound.test(scriptBlock)).toBeTruthy()
expect(scriptBlock).toMatchSnapshot()
})

it('Vue2 -- when exposeFrontmatter set to false -- does NOT use defineExpose method from Vue3', () => {
const { scriptBlock } = composeSfcBlocks('test/fixtures/simple.md', md, { exposeFrontmatter: false, vueVersion: '2.0' })
expect(defineExposeFound.test(scriptBlock)).toBeFalsy()
expect(vue2ExposeFound.test(scriptBlock)).toBeFalsy()

expect(scriptBlock).toMatchSnapshot()
})
})