@ogygia/compiler
0.14.0 minor
@ogygia/compiler
Minor Changes
- #1357
55e05d4Thanks @PuruVJ! -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. - #533
49ff074Thanks @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/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). - #1665
096de6cThanks @PuruVJ! - Breaking: shipping only thepage.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. - #1363
c7ed8cfThanks @PuruVJ! - 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. - #1705
78c6d48Thanks @PuruVJ! -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' }. - #1354
53e96f0Thanks @PuruVJ! - 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. - #1678
ea6effbThanks @PuruVJ! - The deprecatedogygia.extensions()andogygia.preprocess()fromogygia/viteare removed (they did nothing): drop them fromsvelte.config.js, or for markdown useextensions()andpreprocess()from@ogygia/content/vite. - #1704
ddbf46eThanks @PuruVJ! - 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. - #1665
096de6cThanks @PuruVJ! - 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. - #1704
ddbf46eThanks @PuruVJ! - The retiredogygia()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()). - #1688
0602ba2Thanks @PuruVJ! - The build no longer appends a registration call after each exportedcreateContext(...), 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
- #1323
e1f6a87Thanks @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
13b7427Thanks @PuruVJ! - A portable snippet orimport.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. - #1661
6c215fdThanks @PuruVJ! - A browser build that loads one of ogygia's server modules by its resolved id now fails withvirtual_wrong_realm, instead of getting the module's browser stand-in. - #1413
938f79fThanks @PuruVJ! - On Kit 2 withoutOGYGIA_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
6cfab1aThanks @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
cc1b757Thanks @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
cf4be5bThanks @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$$propsas written (#1428). - #1541
1a475deThanks @PuruVJ! - A context that cannot cross into regions is now said, not dropped silently: a one-offSymbol()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. - #1295
2fea150Thanks @PuruVJ! - 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. - #1546
a4de38aThanks @PuruVJ! - In dev, a page whosecsrchanges 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). - #1972
c688e01Thanks @PuruVJ! - On the dev server, anog.$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
a4de38aThanks @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 firstidleorvisibleregion never woke until a restart) (#1376). - #1546
a4de38aThanks @PuruVJ! - 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). - #1423
6fcf4e2Thanks @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
a4de38aThanks @PuruVJ! - In dev, deleting the app's last route file no longer throwsENOENT ... scandir src/routes: a routes directory that is not there holds no routes (#1496). - #1546
a4de38aThanks @PuruVJ! - 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). - #1381
e42f8d0Thanks @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 orimport.metais no capture; a$()inside another$()fails the build. - #1558
d3f9cc7Thanks @PuruVJ! - A function marked withimport.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. - #1181
8fa29ecThanks @PuruVJ! - A dynamicimport()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. - #1321
a46af31Thanks @PuruVJ! - Two modules with side effects thatexport *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
1f2bdb7Thanks @PuruVJ! - A build no longer printsrelocation_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. - #1392
586d8d6Thanks @PuruVJ! - Theog.$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
f9ebb02Thanks @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
fe5c2c8Thanks @PuruVJ! - 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. - #1374
5c5b673Thanks @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 acatchclause that bound the same name; each was missed and threw a ReferenceError on the far side, or left the snippet native. - #1316
55177a4Thanks @PuruVJ! - 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. - #1203
2378a3cThanks @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
e39d03cThanks @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
9d5cdfaThanks @PuruVJ! -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. - #1731
b60d52fThanks @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
5a43feaThanks @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
e61ca82Thanks @PuruVJ! - A portable snippet now captures a host name read by a legacylet:directive's default (let:item={[a = d]}) instead of failing with a ReferenceError when it renders. - #1347
0ecb8afThanks @PuruVJ! - Animport.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. - #1456
78f3eddThanks @PuruVJ! - Animport.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. - #1426
cea7fe0Thanks @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 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). - #1230
b168cf7Thanks @PuruVJ! - Seed shaping now ships all ofpage.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. - #1237
13b589fThanks @PuruVJ! - Seed shaping now covers what a function handed the page reads through an alias of its parameter, a default parameter orarguments, 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
4b7d56bThanks @PuruVJ! - Seed shaping ships all ofpage.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. - #1319
886446fThanks @PuruVJ! - Seed shaping ships all ofpage.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. - #1258
5c3b43cThanks @PuruVJ! - Seed shaping treatsgetandderivedas 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. - #1521
b970e6dThanks @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 withrenderfailed the build underimportKeys: { render: 'mode' }, and the unknown-key message left outkeep. - #1686
07d2165Thanks @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
bae4982Thanks @PuruVJ! - A route'scsroption 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. - #1359
5ff44f8Thanks @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
88858ccThanks @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
1073b6aThanks @PuruVJ! - 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). - #1303
709372eThanks @PuruVJ! - A route that sets a claimedconfigkey in both its universal and its server module now takes the server one, as SvelteKit does at run time (configmerges the other way fromcsr). - #1282
8bc2778Thanks @PuruVJ! - A route node that setscsrin 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
d70e275Thanks @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
1b08debThanks @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
493898dThanks @PuruVJ! - 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. - #1047
acfd819Thanks @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
dfb60d0Thanks @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
dfb60d0Thanks @PuruVJ! - A deferred or held region in a file the build only reaches late (a library outsidesrc/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). - #1366
4fda955Thanks @PuruVJ! -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. - #1487
c429240Thanks @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
234a23dThanks @PuruVJ! - 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. - #1389
493898dThanks @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
95dc4e3Thanks @PuruVJ! - 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. - #1311
779fa59Thanks @PuruVJ! - An island whose props carry a live value the build did not predict (a forwardedchildren, 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
c92ebbbThanks @PuruVJ! - A wire class exported withexport 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.
Updated dependencies: @ogygia/[email protected], @ogygia/[email protected]