@ogygia/compiler

AllMajorMinorPatch Hide pre-releases
0.14.0 minor

@ogygia/compiler

Minor Changes

  • #1357 55e05d4 Thanks @PuruVJ! - 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.
  • #533 49ff074 Thanks @PuruVJ! - - @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).
  • #1665 096de6c Thanks @PuruVJ! - 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.
  • #1363 c7ed8cf Thanks @PuruVJ! - 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.
  • #1705 78c6d48 Thanks @PuruVJ! - 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' }.
  • #1354 53e96f0 Thanks @PuruVJ! - 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.
  • #1678 ea6effb Thanks @PuruVJ! - 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.
  • #1704 ddbf46e Thanks @PuruVJ! - 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.
  • #1665 096de6c Thanks @PuruVJ! - 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.
  • #1704 ddbf46e Thanks @PuruVJ! - 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()).
  • #1688 0602ba2 Thanks @PuruVJ! - 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

  • #1323 e1f6a87 Thanks @PuruVJ! - 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.
  • #1640 13b7427 Thanks @PuruVJ! - 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.
  • #1661 6c215fd Thanks @PuruVJ! - 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.
  • #1413 938f79f Thanks @PuruVJ! - 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).
  • #1520 6cfab1a Thanks @PuruVJ! - 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.
  • #1188 cc1b757 Thanks @PuruVJ! - 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.
  • #1431 cf4be5b Thanks @PuruVJ! - 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).
  • #1541 1a475de Thanks @PuruVJ! - 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.
  • #1295 2fea150 Thanks @PuruVJ! - 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.
  • #1546 a4de38a Thanks @PuruVJ! - 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).
  • #1972 c688e01 Thanks @PuruVJ! - 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.
  • #1546 a4de38a Thanks @PuruVJ! - 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).
  • #1546 a4de38a Thanks @PuruVJ! - 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).
  • #1423 6fcf4e2 Thanks @PuruVJ! - 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).
  • #1546 a4de38a Thanks @PuruVJ! - 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).
  • #1546 a4de38a Thanks @PuruVJ! - 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).
  • #1381 e42f8d0 Thanks @PuruVJ! - 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.
  • #1558 d3f9cc7 Thanks @PuruVJ! - 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.
  • #1181 8fa29ec Thanks @PuruVJ! - 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.
  • #1321 a46af31 Thanks @PuruVJ! - 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.
  • #1899 1f2bdb7 Thanks @PuruVJ! - 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.
  • #1392 586d8d6 Thanks @PuruVJ! - 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.
  • #1970 f9ebb02 Thanks @PuruVJ! - 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.
  • #1248 fe5c2c8 Thanks @PuruVJ! - 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.
  • #1374 5c5b673 Thanks @PuruVJ! - 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.
  • #1316 55177a4 Thanks @PuruVJ! - 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.
  • #1203 2378a3c Thanks @PuruVJ! - 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.
  • #1691 e39d03c Thanks @PuruVJ! - 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.
  • #1906 9d5cdfa Thanks @PuruVJ! - 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.
  • #1731 b60d52f Thanks @PuruVJ! - 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.
  • #1477 5a43fea Thanks @PuruVJ! - 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.
  • #1641 e61ca82 Thanks @PuruVJ! - 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.
  • #1347 0ecb8af Thanks @PuruVJ! - 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.
  • #1456 78f3edd Thanks @PuruVJ! - 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.
  • #1426 cea7fe0 Thanks @PuruVJ! - 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).
  • #1230 b168cf7 Thanks @PuruVJ! - 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.
  • #1237 13b589f Thanks @PuruVJ! - 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.
  • #1256 4b7d56b Thanks @PuruVJ! - 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.
  • #1319 886446f Thanks @PuruVJ! - 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.
  • #1258 5c3b43c Thanks @PuruVJ! - 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.
  • #1521 b970e6d Thanks @PuruVJ! - 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.
  • #1686 07d2165 Thanks @PuruVJ! - 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.
  • #1240 bae4982 Thanks @PuruVJ! - 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.
  • #1359 5ff44f8 Thanks @PuruVJ! - 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.
  • #1419 88858cc Thanks @PuruVJ! - 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).
  • #1371 1073b6a Thanks @PuruVJ! - 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).
  • #1303 709372e Thanks @PuruVJ! - 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).
  • #1282 8bc2778 Thanks @PuruVJ! - 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.
  • #1298 d70e275 Thanks @PuruVJ! - A page or layout with a layout reset ([email protected], +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.
  • #1455 1b08deb Thanks @PuruVJ! - 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).
  • #1389 493898d Thanks @PuruVJ! - 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.
  • #1047 acfd819 Thanks @PuruVJ! - 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.
  • #1421 dfb60d0 Thanks @PuruVJ! - 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.
  • #1421 dfb60d0 Thanks @PuruVJ! - 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).
  • #1366 4fda955 Thanks @PuruVJ! - 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.
  • #1487 c429240 Thanks @PuruVJ! - 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.
  • #1268 234a23d Thanks @PuruVJ! - 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.
  • #1389 493898d Thanks @PuruVJ! - 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).
  • #1313 95dc4e3 Thanks @PuruVJ! - 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.
  • #1311 779fa59 Thanks @PuruVJ! - 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.
  • #1170 c92ebbb Thanks @PuruVJ! - 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.

Updated dependencies: @ogygia/[email protected], @ogygia/[email protected]