Changelog

@ogygia/compiler

Every release of @ogygia/compiler, newest first.

Latest
0.16.0
Versions
6
  1. 0.16.0 minor

    Patch Changes

    • A plugin macro call that its plugin does not compile now fails the build with macro_in_markup instead 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 with macro_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 with macro_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_late for a feature the server's code would have carried.

    Dependencies: @ogygia/core@0.16.0, @ogygia/machine@0.16.0

  2. 0.15.1 patch

    Dependency updates only @ogygia/compiler

  3. 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's DocsShell, 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 warns runtime_marks_late for such a component. If the client build's scan finds a feature that runtime lacks, the build stops with runtime_features_unnamed; a handoff that names no runtime stops it with server_runtime_unnamed; and a handoff the server build cannot write now stops the build instead of only warning.
    • A build stops with server_features_late when 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 with server_features_late.

    Dependencies: @ogygia/core@0.15.0

  4. 0.14.2 patch

    Patch Changes

    • fix(compiler): a content page's own styles compile with the app's Svelte options, so a custom cssHash scopes them like its markup
  5. 0.14.1 patch

    Patch Changes

    • In dev, a route option file (such as a +page.ts with csr) saved by an editor that empties the file before writing it is now read again once the write lands. Before, the dev server could keep the empty read, and a page kept the wrong csr until the next save or a restart.
    • Server HTML now carries a small <!--@html--> marker at the start of each non-empty {@html} that sits beside other children in an element, so the runtime can tell its content from the template's own elements.
    • A server region whose tree reads page.data is now always marked as reading it. Before, the answer could follow the folder the app was built in: when the bundle listed a component's style module after the component, the region was marked as reading nothing and rendered without the page's data.
    • A remote query made outside any island (a click handler, a module's top level) right after the island that used the same query left the page now gets fresh data, not an empty answer.
    • Region stylesheets are now compiled with the app's own Svelte compiler options (as vite-plugin-svelte resolved them), so an app with a custom cssHash (or rootDir) gets server region and router page CSS whose class names match the markup instead of rules that style nothing.
    • The virtual_wrong_realm build error now names the files that imported the module, nearest first, back to the entry ( through src/lib/panel.ts ← src/routes/+page.svelte ), so the import that broke the build no longer takes a bisect to find.

    Dependencies: @ogygia/core@0.14.1

  6. 0.14.0 minor

    Minor Changes

    • import.meta.og.bake moves to its own package: install @ogygia/bake, list bake() beside ogygia(), and reference @ogygia/bake/types; without the plugin a bake call fails the build with macro_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/compiler and @ogygia/core/internal/compiler-ids import paths are gone. Import from ogygia/vite (or @ogygia/compiler/vite), @ogygia/compiler and @ogygia/compiler/ids instead; the names are the same. - @ogygia/core: the types of the ogygia:* 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/compiler and ogygia/internal/compiler-ids re-export @ogygia/compiler; apps change nothing. - @ogygia/barrels, @ogygia/cli, @ogygia/content, @ogygia/devtools, @ogygia/federation, @ogygia/flags, @ogygia/postrender, @ogygia/router: they take definePlugin and the compiler from @ogygia/compiler, a new peer dependency (ogygia brings it).
    • Breaking: shipping only the page.data your islands read is a plugin now, dataShake() from @ogygia/data-shake/vite, listed beside ogygia() (plugins: [ogygia(), dataShake(), sveltekit()]). Without it every island that reads the page gets all of page.data, and every server hole looks the page up.
    • The flag inventory (node_modules/.ogygia/flags-manifest.json) is now written by flags(): a build writes it only when flags() is listed beside ogygia(), and an app that imports @ogygia/flags without listing it gets a one-time plugin_not_listed build warning.
    • wake on a render: 'deferred' import or preset, deprecated in 0.13, now fails the build (hole_wake_removed): a deferred region ships no JS, so wake never applies. Write its timing as fetch: with { render: 'deferred', fetch: 'visible' }.
    • A named import takes the region mark, in .svelte, .ts and .js, and replaces import.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' };. One with covers 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() and ogygia.preprocess() from ogygia/vite are removed (they did nothing): drop them from svelte.config.js, or for markdown use extensions() and preprocess() from @ogygia/content/vite.
    • An import attribute ogygia does not know on a .svelte component import (a misspelling like wkae, or the retired partial) now fails the build as region_attribute_unknown, naming the key and listing the ones the app has; the partial attribute's own error is gone. Write region: 'raw' for a held component, or wake: … for an island. type and attributes on other imports are left alone.
    • Breaking: postrender() requires dataShake(). Add import { dataShake } from '@ogygia/data-shake/vite' and list dataShake() beside postrender(). Without it the build fails with plugin_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 key ogygia() does not have, a misspelling included, now fails the build as option_unknown and lists the keys it has. Move a retired key to its replacement (ttl, router: { forms }, or the feature's own plugin beside ogygia()).
    • The build no longer appends a registration call after each exported createContext(...), and the no-op __tag_context it called is gone from ogygia and ogygia/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 whose static {} 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 $$props as 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 with setContext from ogygia or in a <Provide> warns in dev, naming the key and what to use instead; the build warns on a one-off Symbol() key it can see (region_context_key_one_off), and its "island code reads a context nothing bridges" warning now covers Symbol.for(name) keys.
    • A deferred hole, a lake, a live region or a held region written directly in a csr=true +page.svelte or +layout.svelte now 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 csr changes while the server runs (an option file added, edited or removed above it) is compiled again for its new csr, so a page that becomes csr = false gets 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 idle or visible region never woke until a restart) (#1376).
    • In dev, every route file Kit reads counts when it is added, edited or removed (a +page.md page 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.ts file 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 or import.meta is 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>x casts, this parameters 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 with dynamic_region_import in a .ts / .js module too, and for the region key 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_unpatched for the fn manifest. The browser bundle carried a leftover og.$ 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 its use:, transition:, in:, out: and animate: directives name, the values its style: directives read, <svelte:component this={…}>'s component, and a host name that a for loop 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 a catch clause 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 $lib re-export of page, getStores() or import('$app/state') now gets page.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-wire re-exports only SvelteKit's create_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, loader or regions call in an app without content() listed now fails the build with macro_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 an if (…), 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 dynamic import('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.data when the page is put in an array (other than derived([…], fn)'s sources) or a method is called on page.data (page.data.hasOwnProperty('x')). Before, both were read as a narrower key set, so an island could read undefined for 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.data when a module re-exports the page store (export { page } from '$app/state', export *) or loads it with import(), so an island reading the page through such a barrel no longer reads undefined.
    • Seed shaping ships all of page.data to an island that reads the page through getStores() or a parameter default (function f(p = page)), and no longer mistakes a shadowed helper name or a local window for the module's helper or the browser global; before, those reads could be left out of the page seed.
    • Seed shaping treats get and derived as Svelte's store helpers only when they are imported from svelte/store (under any name), and a derived(page, fn) whose callback is not written inline ships all of page.data. Before, a get(page, 'data.x') from another library or a foreign derived could 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 with render failed the build under importKeys: { render: 'mode' }, and the unknown-key message left out keep.
    • 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 csr option 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 a csr = false page, 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, keep on a hole, lake or live region, and a call-shaped schedule like wake: 'visible(200px)' (a media query is now media words around balanced conditions, everywhere a schedule is read).
    • A route that sets a claimed config key in both its universal and its server module now takes the server one, as SvelteKit does at run time (config merges the other way from csr).
    • A route node that sets csr in 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, or build() called twice) scans the app again and reads each route's csr afresh, so a region added or a csr flipped 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 no ogygia.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.source in 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 / .js module is read from the module's syntax tree: a comment or line break before with no 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(…)) or readonly is 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, or class Cart {} then export default Cart) is now registered, tagged #default, and an anonymous export default class with a wire codec is the build error wire_class_anonymous. Before, the first instance of either to cross into an island threw transportable_unregistered.

    Dependencies: @ogygia/core@0.14.0, @ogygia/machine@0.14.0