Changelog
@ogygia/compiler
Every release of @ogygia/compiler, newest first.
- Latest
- 0.16.0
- Versions
- 3
0.16.0 minor
Patch Changes
- A plugin macro call that its plugin does not compile now fails the build with
macro_in_markupinstead of reaching the page and throwing there: a call in a component's template expression, in a markdown page's (.svx,.md) prose expression ({…}), or in a markdown page's<script>for a macro that does not compile there. A markdown page's prose expression without the plugin listed fails withmacro_needs_plugin, like a script call. - A plugin macro call shown as text (a docs page writing
import.meta.og.image(path)in prose, a code span or a fenced code sample, wherever it sits: a list item, a block quote, any indent, a span over two lines, a markdown page's frontmatter) no longer fails withmacro_needs_plugin, while a real call still does: in a component's<script>or template expression, and in a markdown page's (.svx,.md)<script>or markup, whatever brace its frontmatter or prose leaves open. - The server build no longer waits forever on an external that a plugin marks external only for the module that imports it.
- The server build no longer fixes its runtime features while the bundler has parsed a module but not yet started loading its imports, which could stop the build with
server_features_latefor a feature the server's code would have carried.
Dependencies: @ogygia/core@0.16.0, @ogygia/machine@0.16.0
0.15.0 minor
Minor Changes
- A smaller boot and a faster server: the compiler now builds each page's runtime with only the features its regions use, so a static page's boot is about 28% smaller (brotli), a plain server's output about 25% smaller, server requests do about half the work, plain servers answer about 20% more requests a second, and router navigations are about 30% faster.
Patch Changes
- A region placed by a component outside
src/(an installed package such as@ogygia/content'sDocsShell, or a workspace package) now gets the runtime features it needs: the server build names the runtime its pages load once it has compiled every module, and the client build ships exactly that runtime, also when one compiler builds both. A kept region's next-page props reach it, and the build no longer warnsruntime_marks_latefor such a component. If the client build's scan finds a feature that runtime lacks, the build stops withruntime_features_unnamed; a handoff that names no runtime stops it withserver_runtime_unnamed; and a handoff the server build cannot write now stops the build instead of only warning. - A build stops with
server_features_latewhen a component the server build reached only while bundling (an installed package's component it does not list in"ogygia.files") needs a runtime feature the server's own code was built without, naming the feature and the component, instead of rendering that region without its code. - The server build fixes which runtime features its code carries only once it has compiled every other module of its bundle, so a component outside the app's
src/that it reaches while bundling (such as@ogygia/router's layout chain in an app that uses@ogygia/federation) is counted, instead of stopping the build withserver_features_late.
Dependencies: @ogygia/core@0.15.0
0.14.0 minor
Minor Changes
import.meta.og.bakemoves to its own package: install@ogygia/bake, listbake()besideogygia(), and reference@ogygia/bake/types; without the plugin a bake call fails the build withmacro_needs_plugin.- -
@ogygia/compiler: new package, ogygia's compiler and its Vite plugin:@ogygia/compiler(the compiler),@ogygia/compiler/vite(ogygia(),definePlugin) and@ogygia/compiler/ids. It uses core only through@ogygia/core/contract; core never depends on it. -@ogygia/core: breaking: the@ogygia/core/vite,@ogygia/core/internal/compilerand@ogygia/core/internal/compiler-idsimport paths are gone. Import fromogygia/vite(or@ogygia/compiler/vite),@ogygia/compilerand@ogygia/compiler/idsinstead; the names are the same. -@ogygia/core: the types of theogygia:*virtual modules and the build's switches are named in core (@ogygia/core/contract), so core's own types no longer reach into the compiler. -ogygia:ogygia/vite,ogygia/internal/compilerandogygia/internal/compiler-idsre-export@ogygia/compiler; apps change nothing. -@ogygia/barrels,@ogygia/cli,@ogygia/content,@ogygia/devtools,@ogygia/federation,@ogygia/flags,@ogygia/postrender,@ogygia/router: they takedefinePluginand the compiler from@ogygia/compiler, a new peer dependency (ogygiabrings it). - Breaking: shipping only the
page.datayour islands read is a plugin now,dataShake()from@ogygia/data-shake/vite, listed besideogygia()(plugins: [ogygia(), dataShake(), sveltekit()]). Without it every island that reads the page gets all ofpage.data, and every server hole looks the page up. - The flag inventory (
node_modules/.ogygia/flags-manifest.json) is now written byflags(): a build writes it only whenflags()is listed besideogygia(), and an app that imports@ogygia/flagswithout listing it gets a one-timeplugin_not_listedbuild warning. wakeon arender: 'deferred'import or preset, deprecated in 0.13, now fails the build (hole_wake_removed): a deferred region ships no JS, sowakenever applies. Write its timing asfetch:with { render: 'deferred', fetch: 'visible' }.- A named import takes the region mark, in
.svelte,.tsand.js, and replacesimport.meta.og.asRegion, which is now a build error (as_region_removed) that prints the import to write. Before:import { Search } from '@ogygia/content'; const SearchBox = import.meta.og.asRegion(Search, { wake: 'idle' });After:import { Search as SearchBox } from '@ogygia/content' with { wake: 'idle' };. Onewithcovers every name in its import; a marked name used as anything but a component, and a mark on a namespace, type-only or bare import, fail the build with a code. - The deprecated
ogygia.extensions()andogygia.preprocess()fromogygia/viteare removed (they did nothing): drop them fromsvelte.config.js, or for markdown useextensions()andpreprocess()from@ogygia/content/vite. - An import attribute ogygia does not know on a
.sveltecomponent import (a misspelling likewkae, or the retiredpartial) now fails the build asregion_attribute_unknown, naming the key and listing the ones the app has; thepartialattribute's own error is gone. Writeregion: 'raw'for a held component, orwake: …for an island.typeand attributes on other imports are left alone. - Breaking:
postrender()requiresdataShake(). Addimport { dataShake } from '@ogygia/data-shake/vite'and listdataShake()besidepostrender(). Without it the build fails withplugin_needs_plugin, because every deferred region would look the page up and render the stored page again. - The retired
ogygia()option keys (regions,regionTtl,continuity,preload,plugins,freeze,content,devtools,profiler) no longer have their own messages: any keyogygia()does not have, a misspelling included, now fails the build asoption_unknownand lists the keys it has. Move a retired key to its replacement (ttl,router: { forms }, or the feature's own plugin besideogygia()). - The build no longer appends a registration call after each exported
createContext(...), and the no-op__tag_contextit called is gone fromogygiaandogygia/internal: a module that exports only contexts is left exactly as written. Rebuild any package that shipped already-transformed output.
Patch Changes
- A barrel module with an import kept only for what loading it does (
import './theme.css', a polyfill, a namespace import it never exports) is no longer taken for a pure barrel, so the barrels pass keeps importing it and the CSS or polyfill still loads. - A portable snippet or
import.meta.og.$closure now captures a host name read after a class whosestatic {}block declares the same name, and no longer captures a class expression's own name read inside it. - A browser build that loads one of ogygia's server modules by its resolved id now fails with
virtual_wrong_realm, instead of getting the module's browser stand-in. - On Kit 2 without
OGYGIA_SECRET, the build's check that no browser file holds the signing key now looks for the key the server bundle really uses (before, it looked for a key nothing used, so that half of the check never fired) (#1412). - A module the compiler rewrites in several passes (a macro, the island transform, the module-script registrations, the client
$app/*shim, the server's ownership stamps) now carries a source map back to the file as written, so stack traces and breakpoints land on the right line and column. A text-only plugin macro leaves a map with no positions rather than wrong ones. - A second client build in one process (
vite build --watch) emits every island entry again and writes full location maps: it emitted none, so the rebuilt pages could not load their islands. - A component's script and style blocks are read the way its markup is read: a
<script>or<style>inside a comment or another block's text is no longer taken as code, a>inside an attribute value no longer cuts the tag (flag sites were missed),data-x="module"no longer marks the module script, and the CSS preprocess keeps a TypeScript script's$$propsas written (#1428). - A context that cannot cross into regions is now said, not dropped silently: a one-off
Symbol()key (context_key_one_off) or a function value (context_value_function) set withsetContextfromogygiaor in a<Provide>warns in dev, naming the key and what to use instead; the build warns on a one-offSymbol()key it can see (region_context_key_one_off), and its "island code reads a context nothing bridges" warning now coversSymbol.for(name)keys. - A deferred hole, a lake, a live region or a held region written directly in a csr=true
+page.svelteor+layout.sveltenow stays a real region, as the same import already did in a shared component. Before, it became a plain component: the hole rendered inline in the page's SSR and the lake was hydrated by Kit. Wake islands in a csr=true route file are still plain components Kit hydrates. - In dev, a page whose
csrchanges while the server runs (an option file added, edited or removed above it) is compiled again for its newcsr, so a page that becomescsr = falsegets its regions without a restart (before, its marks stayed stripped and its regions never hydrated) (#1375). - On the dev server, an
og.$function that a page hands an island (through context or props) now works. Before, the dev server sent no function table with the page, so the island's call threw... is not a function. Builds were not affected. - In dev, a region added while the server runs reloads the runtime entry and every other module that read the regions, so its wake works without a restart (before, a page's first
idleorvisibleregion never woke until a restart) (#1376). - In dev, every route file Kit reads counts when it is added, edited or removed (a
+page.mdpage too, not only.svelte/.js/.ts), and an edit that changes no route's options (a page's body, a comment in+layout.ts) no longer reloads the route modules (#1495). - In dev, a server-router page component's CSS is compiled as the build compiles it:
<style lang="scss">and<script lang="ts">are preprocessed first, so its styles are scoped in dev as they are in production (#1422). - In dev, deleting the app's last route file no longer throws
ENOENT ... scandir src/routes: a routes directory that is not there holds no routes (#1496). - In dev, a wire class, a
.remote.tsfile or a router page module added or edited while the server runs takes effect without a restart: the wire loaders, Kit's codecs and the router CSS follow it (before, they kept what the server saw at start) (#1395). import.meta.og.$captures exactly what its function reads from outside: a name a block or an inner function shadows is still captured where it is not shadowed, an imported name that shares a global's name (fetch) is captured instead of read as the global, and a class method name orimport.metais no capture; a$()inside another$()fails the build.- A function marked with
import.meta.og.$in TypeScript hoists as plain JS with optional parameters,!assignments, local types and interfaces,<T>xcasts,thisparameters and class modifiers; an enum, a namespace with values or a parameter property inside it fails the build at its line instead of breaking the page. - A dynamic
import()that names a region key is now refused withdynamic_region_importin a.ts/.jsmodule too, and for theregionkey as well. Before, it was left in place and did nothing. - Two modules with side effects that
export *each other no longer hang the dev server or the build (it ran out of memory); the export walk visits each module once, as JavaScript does. - A build no longer prints
relocation_unpatchedfor the fn manifest. The browser bundle carried a leftoverog.$registration module whose contents the bundler always dropped; the page's inline manifest is what delivers the factories, so the module is gone. - The
og.$fn-manifest is written sorted by tag, so two builds of the same app give the same runtime chunk whatever order the bundler transformed modules in. - An island from a mounted peer page now reads the cross-island context its page provides (
<Provide>,setContext,createContext), even when the shell provides no context of its own. Before, a production shell left the context bridge out and never handed context to a peer's island, so the island hydrated with its context silently empty. A federated build now also ships the live-region feature a peer's held or kept regions need. - A
{#snippet}that crosses into an island now brings along the functions itsuse:,transition:,in:,out:andanimate:directives name, the values itsstyle:directives read,<svelte:component this={…}>'s component, and a host name that aforloop only shadows. Before, the snippet's entry referenced them undeclared and failed at render. - A portable snippet now carries the names its pattern defaults read (
{#each xs as { a = dflt }}, a snippet parameter's default,{@const},{#await … then}), its{@debug}names, and a name read after acatchclause that bound the same name; each was missed and threw a ReferenceError on the far side, or left the snippet native. - A deferred hole whose server tree reads the page through a
$libre-export ofpage,getStores()orimport('$app/state')now getspage.data; before, it rendered with an empty one. - A production server that cannot find or read the client build's handoff (
og-region-deps.json) now says so (island_deps_handoff_missing, with the paths it tried) instead of rendering every hole without its CSS and preloads in silence. A handoff that failed to read or parse is tried again on the next request instead of being replaced by an empty one for the life of the process. - An app's Kit config (
kit.files.routes,kit.outDir,kit.inlineStyleThreshold) is now held by the plugin that read it, so it can never fall back to the defaults however many apps one process configures. ogygia:server/kit-wirere-exports only SvelteKit'screate_remote_key, the one helper ogygia uses, which Kit 2 and Kit 3 share; a canary checks it in every installed Kit.- In dev, a region module (a lake's wrapper) that was loaded while no file held it, after a missed file-watcher event, is reloaded once a later save gives it a host, instead of staying empty until a restart.
- A deferred or held region in a library component only the server bundle reaches gets its styles built: the client leg takes the server leg's final list of server regions, so the hole no longer shows unstyled.
- A portable snippet now captures a host name read by a legacy
let:directive's default (let:item={[a = d]}) instead of failing with a ReferenceError when it renders. - An
import.meta.og.code,md,loaderorregionscall in an app withoutcontent()listed now fails the build withmacro_needs_plugin, naming@ogygia/content; before, it reached the browser or the server untouched and threw a bare TypeError there. - An
import.meta.og.*call after a regex that follows a keyword (return /'/.test(s)) or anif (…), or inside a template's${…}, is found and rewritten: the macro scanner lost its place there and left the call in the module. - A context provider or a region reached through a local barrel (
export { setContext } from 'ogygia',export * from 'ogygia'), a namespace handed on, or a dynamicimport('ogygia')now ships the context bridge and Kit's region codec: before, islands lost that context and Kit could not decode the region (#1424). - Seed shaping now ships all of
page.datawhen the page is put in an array (other thanderived([…], fn)'s sources) or a method is called onpage.data(page.data.hasOwnProperty('x')). Before, both were read as a narrower key set, so an island could readundefinedfor a key that was left out of the seed. - Seed shaping now covers what a function handed the page reads through an alias of its parameter, a default parameter or
arguments, and it no longer follows a function binding that is later assigned another function. Before, those keys could be left out of the shipped page seed. - Seed shaping ships all of
page.datawhen a module re-exports the page store (export { page } from '$app/state',export *) or loads it withimport(), so an island reading the page through such a barrel no longer readsundefined. - Seed shaping ships all of
page.datato an island that reads the page throughgetStores()or a parameter default (function f(p = page)), and no longer mistakes a shadowed helper name or a localwindowfor the module's helper or the browser global; before, those reads could be left out of the page seed. - Seed shaping treats
getandderivedas Svelte's store helpers only when they are imported fromsvelte/store(under any name), and aderived(page, fn)whose callback is not written inline ships all ofpage.data. Before, aget(page, 'data.x')from another library or a foreignderivedcould leave keys out of the page seed. - A region preset takes the standard keys (
render,wake,fetch, …) when the app renames its import keys, as the docs say; before, a preset withrenderfailed the build underimportKeys: { render: 'mode' }, and the unknown-key message left outkeep. - The dev server sees a file change even after more than 100,000 cached compiler answers: the cache no longer drops what a file read, only answers computed from it.
- A route's
csroption is now read with a parser, the same way Kit reads it.export let/export var, a declaration with several declarators,export { local as csr }and a parenthesized value now count, and text in a string or comment no longer does. Before, such a page could be taken for the wrong kind: its islands stripped on acsr = falsepage, or the client build predicted wrong. - A region that a page and its layout both import now names the same host in every build, whatever order the bundler transforms them in.
- A component marked as a region is one region however it is imported:
$lib/…, a relative path, a root-absolute/src/…path or an app alias give one id, and a host with<script lang="ts">shares the same wrapper as a plain one (before, a root-absolute or aliased import made a second region, unstyled in dev, and the two hosts' wrappers overwrote each other) (#1415). - A region import mark that would do nothing now fails the build:
render: 'static'alone,keepon a hole, lake or live region, and a call-shaped schedule likewake: 'visible(200px)'(a media query is now media words around balanced conditions, everywhere a schedule is read). - A route that sets a claimed
configkey in both its universal and its server module now takes the server one, as SvelteKit does at run time (configmerges the other way fromcsr). - A route node that sets
csrin both its universal and its server option file now takes the universal one, as SvelteKit does. Before, the server one won for page worlds, so a page Kit hydrates could be treated as client-off. - A page or layout with a layout reset (
+page@.svelte,+layout@(group).svelte) is now a route to ogygia, read the way SvelteKit reads it: its csr and its route config come from the layouts it actually renders in, and a dev edit to it refreshes the route answers. - A build warns (
runtime_marks_late) when a file it first reaches while bundling places a region that needs a runtime feature the build already left out, naming the file and the feature (#1452). - A second build in one process (
vite build --watch, orbuild()called twice) scans the app again and reads each route'scsrafresh, so a region added or acsrflipped between builds is in the next build. - The client build also fails when it holds a signing secret written as an escaped string literal (a secret with a quote, backslash, newline, slash or non-ASCII character), not only the raw text.
- A build lists its server regions by id in the values it writes at the end of the server leg (the manifest's maps, the late loaders, the page-data reads), so two builds of one app give the same server chunk bytes whatever order the bundler reached their hosts in.
- A deferred or held region in a file the build only reaches late (a library outside
src/with noogygia.files) is now served in production: the build fills in the server manifest from its final list of regions and gives a late region's loader its own chunk. Before, the region was missing from the manifest and its requests were refused (#1420). import.meta.og.sourcein a.svelte<script module>puts its runtime import inside the script (it was put in front of the whole file, as page text), and adds no line to any module, so error lines stay right.- A source file the build's first scan cannot parse is now treated as one that may define a wire class, so a wire class in it keeps its loader and the wire feature; before, it could fail to decode on the client with no message.
- A region import in a
.ts/.jsmodule is read from the module's syntax tree: a comment or line break beforewithno longer hides it, and a named, namespace, bare or re-export form with a region key is refused (region_import_invalid) instead of passing through as a plain import. - A watch rebuild marks every file an island reaches as island code again, so a shared module keeps ogygia's
$app/*shim on the rebuild too (#1448). - A wire class whose codec member is typed (
static wire: Codec<Cart> = import.meta.og.wire(…)) orreadonlyis now found by the build, so it gets its loader and the wire feature; before, it failed to decode in production. A module with only an unrelated computed static, or a wire class it does not export, is no longer imported into every realm. - An island whose props carry a live value the build did not predict (a forwarded
children, a snippet passed as a prop, a spread of$props()) now hydrates: the runtime loads the wire codec when that island wakes, instead of failing with "wired prop but no wire feature". Builds that already ship the codec are unchanged. - A wire class exported with
export default(export default class Cart, orclass Cart {}thenexport default Cart) is now registered, tagged#default, and an anonymousexport default classwith a wire codec is the build errorwire_class_anonymous. Before, the first instance of either to cross into an island threwtransportable_unregistered.
Dependencies: @ogygia/core@0.14.0, @ogygia/machine@0.14.0