@svebcomponents/utils Changelog
0.3.0
Minor Changes
-
86e6596: Remove
defineElement.It was once mandatory: every component entry point hand-wrote a guarded
customElements.define(), anddefineElementexisted to own that arcana. Two changes took its purpose away.@svebcomponents/buildnow makes Svelte’s own generated registration call idempotent, so a component that declares its tag needs no registration code at all; and element types and the custom elements manifest are generated by reading that declaration, so a tag registered only throughdefineElementis invisible to both.That left it as the escape hatch for tags that cannot be a literal in
<svelte:options>— a case svebcomponents no longer supports, because such a tag cannot be typed, cannot enterHTMLElementTagNameMap, and cannot be self-registered by the SSR renderer.Migration
Declare the tag in the component and delete the registration call:
import { defineElement } from "@svebcomponents/utils";import MyComponent from "./MyComponent.svelte";export default MyComponent;defineElement("my-component", MyComponent);<svelte:options customElement="my-component" />The entry point becomes the component itself — see the direct Svelte entries migration in
@svebcomponents/build.If you register elements outside the svebcomponents pipeline and still want the guards, the implementation was small enough to keep locally:
const defineElement = (tagName: string, component: unknown): void => {if (typeof customElements === "undefined") return;const ctor = (component as { element?: CustomElementConstructor } | null)?.element;if (!ctor || customElements.get(tagName)) return;customElements.define(tagName, ctor);};
Patch Changes
-
e7267f8: Documentation pass across the package READMEs ahead of the beta launch.
@svebcomponents/ssr,ssr-vue,ssr-reactandssr-astrogained the install command they were missing.@svebcomponents/build’s options table was missinghydratable,ssrEntryFileNameandsvelteConfig, and did not show how a package with several components composesdefineConfigcalls.@svebcomponents/ssr’s package-author example usedimportwithouttypeswhere every other example in the docs usesdefaultwith them, and theenable-asyncopt-in for non-Svelte hosts was undocumented.- The three integration READMEs each restated the shared SSR layer’s
behaviour — the Lit renderer registry, the server-side
svelterequirement, the declarative shadow DOM contract, the definition of an asynchronous component. Each now links to the canonical explanation and keeps only what is specific to its framework. - Removed references to internal
e2e/*directories, which readers cannot run, and normalised the product name to lowercasesvebcomponents.
-
86e6596: Declare
license,descriptionandhomepage, and ship the license text in the published tarball.Every package was published without a
licensefield and without a license file of its own. npm only includesLICENSE*from the package directory, so the repository’s MIT license never reached consumers and automated license scanners had nothing to read. Each package now carries its own copy ofLICENSE.mdalongside"license": "MIT".descriptionis what npm shows on the package page and in search results, andhomepagenow points at each package’s reference page on the documentation site. -
86e6596: Stop publishing the compiled test file.
fileslisteddistwithout the!dist/**/*.test.*exclusion the other packages carry, sodist/index.test.jsand its declarations shipped in the tarball.
0.2.0
Minor Changes
-
567aef3: Add
@svebcomponents/ssr-vue, a Vue host integration for server-rendering Svelte-built custom elements.A Vite plugin rewrites custom element tags in SFC templates to a wrapper component, which drives the element’s registered
ElementRendereron the server and emits declarative shadow DOM. Vue’srenderToStringawaits asyncsetup(), so async element renderers work through the same wrapper as synchronous ones — no sync/async split.Documented on the site under Core Concepts → Framework Integrations, with a package reference page for the new integration.
Supporting changes:
@svebcomponents/ssrgainsshadowContentonRenderedCustomElement, for hosts that build the<template>element themselves rather than emitting raw markup.- The custom-element tag-name predicates move to
@svebcomponents/utilsso host integrations can share the detection without importing the Svelte-bound SSR runtime.@svebcomponents/ssrre-exports them from their previous path.
0.1.0
Minor Changes
-
c2f1b6c: Add
defineElement(tagName, component)— a safe registration helper for component entry points.Every component package previously hand-wrote the same guarded
customElements.defineboilerplate, with subtle variations (some checked"element" in Component, someComponent.elementtruthiness, some forgot the already-registered guard).defineElementowns the arcana:- no-ops when the component has no custom element constructor (the server compile)
- no-ops when there is no
customElementsregistry at all - no-ops when the tag is already registered — svelte auto-defines when
<svelte:options customElement={{ tag }}>declares a tag, and a page can load two bundles containing the same component; first registration wins instead of throwing
Entry points shrink to:
import { defineElement } from "@svebcomponents/utils";import MyComponent from "./MyComponent.svelte";export default MyComponent;defineElement("my-component", MyComponent);
0.0.3
Patch Changes
- 9be6326: Allow digits in
isKebabCaseso attribute names likecol-2orheading2are correctly detected as attributes, fixing SSR/client markup divergence. - 724f00a: Declare supported Node versions (
engines.node: ">=20.19.0") so consumers get a clear error instead of an opaque runtime failure on unsupported Node versions. - e7e4adf: Fix publint compliance: put the
typesexport condition first so TypeScript resolves declarations as published, addfilesfields so tarballs only shipdist(andbin.jsfor the build package), and run publint as part of every publishable package’s build. - d2094d2: Remove the unused
TODO()helper export and its README documentation. Nothing in the repo (or any published svebcomponents package) called it — it was dead code that only logged to the console. Strictly speaking, dropping an export is a breaking change, but the package is 0.x and the helper was documented as internal/experimental, so this ships as a patch.
0.0.2
Patch Changes
- 8aa8512: fix: publish private utils dependency