v1 Release
Release v1 is here, learn what new features are available and how to migrate.
Background
After releasing 0.x it was clear that the package was missing some functionality:
- No schema.dts support
- Package added ~30kb to your page weight
- Reactivity was dodgy
After a few weeks rebuilding the core and struggling with the module resolutions, I've managed to solve all of the above.
Breaking changes were attempted to be minimised but have been implemented where needed to simplify the API.
🚀 Features
🌲 Performance Improvements
The package now supports mocking out runtime define functions and components for client-side builds.
- Ships 0kb of JS to the client - ~30kb reduction! This is enabled by default for environments using SSR. See the
client
User Config for more details. - Script is embedded to the end of the
body
to avoid slowing down DOM render
🇹 Simple and Full Types
Types for define functions are now runtime, supporting switching the types being used.
- Supports schema-dts You can opt-in to "full" mode which augments the types to use schema-dts.
See the
full
User Config for more details. - Reactivity Type Types for fields are now all
MaybeRef
able. - Automatic Aliasing When switching between full and simple modes your tsconfig.json wil be updated for you.
💪 New Core
The core was rebuilt and is now available as its own package: @unhead/schema-org.
- Improved reactivity
- Less performance overhead in resolving graph
- Runtime overrides of user config
- New Schema.org: Course, Event, Book, SoftwareApp
- Better resolving of relationships requiring less boilerplate
Others
- Webpack support
- New Docs powered by Docus
Migration Guide
As a first step, you should follow the new installation docs for your framework again and verify integration is up-to-date:
High Risk - Breaking Changes
Partial define functions removed
To allow for empty define functions while providing a strict API, the define${Node}Partial
functions existed. This has been removed to simplify the API.
You will need to remove any define partial functions in favour of the main define functions.
defineWebPagePartial({
// ...
})
Component prop render-scoped-slots
removed
Previously you were able to provide the render-scoped-slots
prop to allow scoped slots to render. This was useful
to minimise code, but was removed as the functionality was misleading.
You will now need to render within the default slot.
<template>
<SchemaOrgQuestion render-scoped-slots>
<template #question>
What is the question?
</template>
<template #answer>
Not sure
</template>
</SchemaOrgQuestion>
</template>
SchemaOrgInspector renamed to SchemaOrgDebug
<template>
<SchemaOrgInspector />
</template>
SearchAction and ReadAction composables renamed
defineWebSite({
potentialAction: [
asSearchAction({
target: '/search?q={search_term_string}'
})
]
})
Next Steps
Once you have finished migrating, it's worth re-testing your Schema.org using https://validator.schema.org/ and https://search.google.com/test/rich-results.
If you see any issues please create an issue.