@ogygia/core 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/region/transform.js +10 -3
- package/dist/vite/index.d.ts +13 -0
- package/dist/vite/index.js +4 -0
- package/package.json +1 -1
|
@@ -839,7 +839,11 @@ var FileCompilation = class {
|
|
|
839
839
|
}
|
|
840
840
|
if (render_mode != null && !RENDER_MODES.has(render_mode)) throw fail(`unknown ${import_keys.render} '${render_mode}'. Use 'static' (inline HTML) | 'deferred' (a hole, fetched) | 'live' (a hole that revalidates).`);
|
|
841
841
|
const said = from_preset ? `preset '${from_preset}'` : "this import";
|
|
842
|
-
if (render_mode === "deferred" && wake_val != null)
|
|
842
|
+
if (render_mode === "deferred" && wake_val != null) {
|
|
843
|
+
if (fetch_val != null) throw fail(`${said} times a \`${import_keys.render}: 'deferred'\` hole twice, with \`${import_keys.fetch}: '${fetch_val}'\` and \`${import_keys.wake}: '${wake_val}'\`. Keep \`${import_keys.fetch}\`: it says when a hole's HTML arrives.`);
|
|
844
|
+
warn_once(`deferred-wake:${rel_host}:${said}:${wake_val}`, `[ogygia] ${rel_host}: ${said} times a \`${import_keys.render}: 'deferred'\` hole with \`${import_keys.wake}: '${wake_val}'\`, which is deprecated. Write \`${import_keys.render}: 'deferred', ${import_keys.fetch}: '${wake_val}'\` instead: \`${import_keys.fetch}\` says when a hole's HTML arrives. (\`${import_keys.wake}\` is when an island's JS runs; a hole ships no JS.)`);
|
|
845
|
+
fetch_val = wake_val;
|
|
846
|
+
}
|
|
843
847
|
if (fetch_val != null && render_mode !== "deferred") throw fail(`${said} sets \`${import_keys.fetch}: '${fetch_val}'\` without \`${import_keys.render}: 'deferred'\` — \`${import_keys.fetch}\` is a hole's timing. Write \`${import_keys.render}: 'deferred', ${import_keys.fetch}: '${fetch_val}'\` for a hole` + (render_mode == null ? `, or \`${import_keys.wake}: '${fetch_val}'\` for an island.` : "."));
|
|
844
848
|
if (render_mode === "deferred") attrs.set("defer", fetch_val ?? "load");
|
|
845
849
|
else if (render_mode === "live") {
|
|
@@ -1731,8 +1735,11 @@ var TsRegionCompilation = class {
|
|
|
1731
1735
|
if (marker.fetch != null && marker.render == null) throw new Error(`[ogygia] ${this.#rel_host}: \`${fetchKey}: '${marker.fetch}'\` without \`${renderKey}: 'deferred'\` — \`${fetchKey}\` is a hole's timing. Write \`${renderKey}: 'deferred', ${fetchKey}: '${marker.fetch}'\` for a hole, or \`${this.#wakeKey}: '${marker.fetch}'\` for an island.`);
|
|
1732
1736
|
if (marker.render != null) {
|
|
1733
1737
|
if (marker.render !== "deferred") throw new Error(marker.render === "live" ? `[ogygia] ${this.#rel_host}: \`${renderKey}: 'live'\` is not supported on a .ts import — use it in a .svelte file.` : `[ogygia] ${this.#rel_host}: unknown \`${renderKey}\` '${marker.render}'. Use 'deferred'.`);
|
|
1734
|
-
if (marker.wake != null)
|
|
1735
|
-
|
|
1738
|
+
if (marker.wake != null) {
|
|
1739
|
+
if (marker.fetch != null) throw new Error(`[ogygia] ${this.#rel_host}: a \`${renderKey}: 'deferred'\` hole timed twice, with \`${fetchKey}: '${marker.fetch}'\` and \`${this.#wakeKey}: '${marker.wake}'\`. Keep \`${fetchKey}\`: it says when a hole's HTML arrives.`);
|
|
1740
|
+
warn_once(`deferred-wake:${this.#rel_host}:ts:${marker.wake}`, `[ogygia] ${this.#rel_host}: a \`${renderKey}: 'deferred'\` hole timed with \`${this.#wakeKey}: '${marker.wake}'\`, which is deprecated. Write \`${renderKey}: 'deferred', ${fetchKey}: '${marker.wake}'\` instead: \`${fetchKey}\` says when a hole's HTML arrives. (\`${this.#wakeKey}\` is when an island's JS runs; a hole ships no JS.)`);
|
|
1741
|
+
}
|
|
1742
|
+
const dval = marker.fetch ?? marker.wake ?? "load";
|
|
1736
1743
|
let when;
|
|
1737
1744
|
if (DEFER_STRATEGIES.has(dval)) when = dval;
|
|
1738
1745
|
else if (is_media_query(dval)) when = dval;
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { debarrel } from "../compiler/debarrel/plugin.js";
|
|
|
5
5
|
import { BuildContext, MacroContext, MacroHandler, MarkupRegions, MarkupSource, OgygiaPlugin, PluginDefinition, definePlugin } from "./plugin-api.js";
|
|
6
6
|
import { DebarrelOptions, Matcher } from "../compiler/debarrel/options.js";
|
|
7
7
|
import { OgygiaOptions, OgygiaPreset, OgygiaRateLimit } from "./options.js";
|
|
8
|
+
import { PreprocessorGroup } from "svelte/compiler";
|
|
8
9
|
import { Plugin } from "vite";
|
|
9
10
|
/**
|
|
10
11
|
* Vite plugin: transforms `with { hydrate | defer | preset }` imports into islands,
|
|
@@ -16,4 +17,16 @@ import { Plugin } from "vite";
|
|
|
16
17
|
* @returns Vite plugins (`ogygia` pre + island sourcemap fix post). Vite flattens the array.
|
|
17
18
|
*/
|
|
18
19
|
export declare function ogygia(options?: OgygiaOptions): Plugin[];
|
|
20
|
+
export declare namespace ogygia {
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Does nothing: returns `['.svelte']`. Markdown extensions come from
|
|
23
|
+
* `extensions()` in `@ogygia/content/vite`.
|
|
24
|
+
*/
|
|
25
|
+
export const extensions: () => string[];
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Does nothing: returns `[]`. The markdown preprocessor comes from `preprocess()` in
|
|
28
|
+
* `@ogygia/content/vite`.
|
|
29
|
+
*/
|
|
30
|
+
export const preprocess: () => PreprocessorGroup[];
|
|
31
|
+
}
|
|
19
32
|
export { type BuildContext, CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, type Matcher as DebarrelMatcher, type DebarrelOptions, type ImportKeys, type MacroContext, type MacroHandler, type MarkupRegions, type MarkupSource, type OgygiaOptions, type OgygiaPlugin, type OgygiaPreset, type OgygiaRateLimit, type PluginDefinition, debarrel, definePlugin, import_keys_hint, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys, regionId, regionIdentity, rewrite_lake_import_to_placeholder, strategyKey, wrapperVirtualId };
|
package/dist/vite/index.js
CHANGED
|
@@ -818,4 +818,8 @@ function ogygia(options = {}) {
|
|
|
818
818
|
server_sourcemaps_plugin(() => measure)
|
|
819
819
|
];
|
|
820
820
|
}
|
|
821
|
+
Object.assign(ogygia, {
|
|
822
|
+
extensions: () => [".svelte"],
|
|
823
|
+
preprocess: () => []
|
|
824
|
+
});
|
|
821
825
|
export { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, debarrel, definePlugin, import_keys_hint, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys, ogygia, regionId, regionIdentity, rewrite_lake_import_to_placeholder, strategyKey, wrapperVirtualId };
|