@moku-labs/web 1.6.2 → 1.8.0
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/README.md +9 -6
- package/dist/browser.mjs +169 -48
- package/dist/{convention-krwh7Y6Q.cjs → convention-BpDfzX7e.cjs} +28 -4
- package/dist/{convention-CepUwWmT.mjs → convention-Dp650o3y.mjs} +28 -4
- package/dist/index.cjs +677 -193
- package/dist/index.d.cts +30 -4
- package/dist/index.d.mts +30 -4
- package/dist/index.mjs +677 -193
- package/dist/{writer-Dc_lx22j.mjs → writer-CaoyORyZ.mjs} +1 -1
- package/dist/{writer-DV5hWB2i.cjs → writer-JdhX1Wld.cjs} +1 -1
- package/package.json +10 -5
package/dist/index.d.cts
CHANGED
|
@@ -1667,8 +1667,13 @@ type Config$3 = {
|
|
|
1667
1667
|
* - `true` — the built-in default page.
|
|
1668
1668
|
* - `{ body }` — literal HTML body content, wrapped in a minimal document shell.
|
|
1669
1669
|
* - `{ path }` — path to a complete HTML page file (resolved from the project
|
|
1670
|
-
* root)
|
|
1671
|
-
*
|
|
1670
|
+
* root) so the app owns the whole document (its own `<head>`, asset links,
|
|
1671
|
+
* and body).
|
|
1672
|
+
*
|
|
1673
|
+
* In every variant the `<!--moku:assets-->` / `<!--moku:assets:css-->` /
|
|
1674
|
+
* `<!--moku:assets:js-->` placeholders are substituted with the fingerprinted
|
|
1675
|
+
* bundle tags (bundle filenames embed a content hash, so a 404 page cannot
|
|
1676
|
+
* hardcode them); a page without placeholders is written byte-for-byte.
|
|
1672
1677
|
*
|
|
1673
1678
|
* `path` takes precedence over `body` when both are set. Default `false`.
|
|
1674
1679
|
*/
|
|
@@ -1685,10 +1690,31 @@ type Config$3 = {
|
|
|
1685
1690
|
* `<!--moku:lang-->` (page locale for `<html lang>`),
|
|
1686
1691
|
* `<!--moku:head-->` (composed `<head>` inner HTML),
|
|
1687
1692
|
* `<!--moku:assets-->` (injected `<link>`/`<script>` tags),
|
|
1693
|
+
* `<!--moku:assets:css-->` / `<!--moku:assets:js-->` (one asset kind each, for
|
|
1694
|
+
* shells that link stylesheets in `<head>` but script tags elsewhere),
|
|
1688
1695
|
* `<!--moku:body-->` (SSR body HTML).
|
|
1689
1696
|
* When unset, the built-in shell is used (it emits charset + viewport by default).
|
|
1690
1697
|
*/
|
|
1691
1698
|
template?: string;
|
|
1699
|
+
/**
|
|
1700
|
+
* Emit `outDir/_headers` (Cloudflare Pages header rules) for CDN/browser cache
|
|
1701
|
+
* protection. Generated rules: every fingerprinted bundle output gets a
|
|
1702
|
+
* per-file `Cache-Control: <assets>` rule (default immutable, 1 year — its URL
|
|
1703
|
+
* embeds a content hash, so the bytes behind it can never change), and every
|
|
1704
|
+
* other URL — pages, content images, feeds, data sidecars: stable URLs whose
|
|
1705
|
+
* bytes MAY change between deploys — gets the catch-all
|
|
1706
|
+
* `Cache-Control: <pages>` rule (default always-revalidate: unchanged files
|
|
1707
|
+
* still answer `304 Not Modified` from their ETag, changed files are picked up
|
|
1708
|
+
* immediately). The app's own `<publicDir>/_headers` content is appended AFTER
|
|
1709
|
+
* the generated rules so the app can override them (detach a generated header
|
|
1710
|
+
* first with `! Cache-Control` — Cloudflare comma-joins duplicate headers).
|
|
1711
|
+
* `false` disables the phase; an object overrides one or both values.
|
|
1712
|
+
* Default `true`.
|
|
1713
|
+
*/
|
|
1714
|
+
cacheHeaders?: boolean | {
|
|
1715
|
+
assets?: string;
|
|
1716
|
+
pages?: string;
|
|
1717
|
+
};
|
|
1692
1718
|
};
|
|
1693
1719
|
/**
|
|
1694
1720
|
* A typed asset-manifest entry for one bundled asset kind (CSS or JS): a map of the
|
|
@@ -1755,7 +1781,7 @@ interface State$3 {
|
|
|
1755
1781
|
* const phase: PhaseName = "bundle";
|
|
1756
1782
|
* ```
|
|
1757
1783
|
*/
|
|
1758
|
-
type PhaseName = "bundle" | "content" | "images" | "pages" | "content-images" | "feeds" | "sitemap" | "og-images" | "public" | "not-found" | "locale-redirects" | "root-index";
|
|
1784
|
+
type PhaseName = "bundle" | "content" | "images" | "pages" | "content-images" | "feeds" | "sitemap" | "og-images" | "public" | "not-found" | "locale-redirects" | "cache-headers" | "root-index";
|
|
1759
1785
|
/**
|
|
1760
1786
|
* Result of a completed build run.
|
|
1761
1787
|
*
|
|
@@ -1784,7 +1810,7 @@ interface BuildResult {
|
|
|
1784
1810
|
* const dev: BuildRunOverrides = { minify: false, feeds: false, sitemap: false };
|
|
1785
1811
|
* ```
|
|
1786
1812
|
*/
|
|
1787
|
-
type BuildRunOverrides = Readonly<Partial<Pick<Config$3, "minify" | "feeds" | "sitemap" | "ogImage" | "images" | "localeRedirects" | "notFound">>>;
|
|
1813
|
+
type BuildRunOverrides = Readonly<Partial<Pick<Config$3, "minify" | "feeds" | "sitemap" | "ogImage" | "images" | "localeRedirects" | "notFound" | "cacheHeaders">>>;
|
|
1788
1814
|
/**
|
|
1789
1815
|
* Options for a single {@link Api.run} call. All fields are optional; an absent/empty
|
|
1790
1816
|
* options object runs the full production build (clean + every configured phase). The
|
package/dist/index.d.mts
CHANGED
|
@@ -1667,8 +1667,13 @@ type Config$3 = {
|
|
|
1667
1667
|
* - `true` — the built-in default page.
|
|
1668
1668
|
* - `{ body }` — literal HTML body content, wrapped in a minimal document shell.
|
|
1669
1669
|
* - `{ path }` — path to a complete HTML page file (resolved from the project
|
|
1670
|
-
* root)
|
|
1671
|
-
*
|
|
1670
|
+
* root) so the app owns the whole document (its own `<head>`, asset links,
|
|
1671
|
+
* and body).
|
|
1672
|
+
*
|
|
1673
|
+
* In every variant the `<!--moku:assets-->` / `<!--moku:assets:css-->` /
|
|
1674
|
+
* `<!--moku:assets:js-->` placeholders are substituted with the fingerprinted
|
|
1675
|
+
* bundle tags (bundle filenames embed a content hash, so a 404 page cannot
|
|
1676
|
+
* hardcode them); a page without placeholders is written byte-for-byte.
|
|
1672
1677
|
*
|
|
1673
1678
|
* `path` takes precedence over `body` when both are set. Default `false`.
|
|
1674
1679
|
*/
|
|
@@ -1685,10 +1690,31 @@ type Config$3 = {
|
|
|
1685
1690
|
* `<!--moku:lang-->` (page locale for `<html lang>`),
|
|
1686
1691
|
* `<!--moku:head-->` (composed `<head>` inner HTML),
|
|
1687
1692
|
* `<!--moku:assets-->` (injected `<link>`/`<script>` tags),
|
|
1693
|
+
* `<!--moku:assets:css-->` / `<!--moku:assets:js-->` (one asset kind each, for
|
|
1694
|
+
* shells that link stylesheets in `<head>` but script tags elsewhere),
|
|
1688
1695
|
* `<!--moku:body-->` (SSR body HTML).
|
|
1689
1696
|
* When unset, the built-in shell is used (it emits charset + viewport by default).
|
|
1690
1697
|
*/
|
|
1691
1698
|
template?: string;
|
|
1699
|
+
/**
|
|
1700
|
+
* Emit `outDir/_headers` (Cloudflare Pages header rules) for CDN/browser cache
|
|
1701
|
+
* protection. Generated rules: every fingerprinted bundle output gets a
|
|
1702
|
+
* per-file `Cache-Control: <assets>` rule (default immutable, 1 year — its URL
|
|
1703
|
+
* embeds a content hash, so the bytes behind it can never change), and every
|
|
1704
|
+
* other URL — pages, content images, feeds, data sidecars: stable URLs whose
|
|
1705
|
+
* bytes MAY change between deploys — gets the catch-all
|
|
1706
|
+
* `Cache-Control: <pages>` rule (default always-revalidate: unchanged files
|
|
1707
|
+
* still answer `304 Not Modified` from their ETag, changed files are picked up
|
|
1708
|
+
* immediately). The app's own `<publicDir>/_headers` content is appended AFTER
|
|
1709
|
+
* the generated rules so the app can override them (detach a generated header
|
|
1710
|
+
* first with `! Cache-Control` — Cloudflare comma-joins duplicate headers).
|
|
1711
|
+
* `false` disables the phase; an object overrides one or both values.
|
|
1712
|
+
* Default `true`.
|
|
1713
|
+
*/
|
|
1714
|
+
cacheHeaders?: boolean | {
|
|
1715
|
+
assets?: string;
|
|
1716
|
+
pages?: string;
|
|
1717
|
+
};
|
|
1692
1718
|
};
|
|
1693
1719
|
/**
|
|
1694
1720
|
* A typed asset-manifest entry for one bundled asset kind (CSS or JS): a map of the
|
|
@@ -1755,7 +1781,7 @@ interface State$3 {
|
|
|
1755
1781
|
* const phase: PhaseName = "bundle";
|
|
1756
1782
|
* ```
|
|
1757
1783
|
*/
|
|
1758
|
-
type PhaseName = "bundle" | "content" | "images" | "pages" | "content-images" | "feeds" | "sitemap" | "og-images" | "public" | "not-found" | "locale-redirects" | "root-index";
|
|
1784
|
+
type PhaseName = "bundle" | "content" | "images" | "pages" | "content-images" | "feeds" | "sitemap" | "og-images" | "public" | "not-found" | "locale-redirects" | "cache-headers" | "root-index";
|
|
1759
1785
|
/**
|
|
1760
1786
|
* Result of a completed build run.
|
|
1761
1787
|
*
|
|
@@ -1784,7 +1810,7 @@ interface BuildResult {
|
|
|
1784
1810
|
* const dev: BuildRunOverrides = { minify: false, feeds: false, sitemap: false };
|
|
1785
1811
|
* ```
|
|
1786
1812
|
*/
|
|
1787
|
-
type BuildRunOverrides = Readonly<Partial<Pick<Config$3, "minify" | "feeds" | "sitemap" | "ogImage" | "images" | "localeRedirects" | "notFound">>>;
|
|
1813
|
+
type BuildRunOverrides = Readonly<Partial<Pick<Config$3, "minify" | "feeds" | "sitemap" | "ogImage" | "images" | "localeRedirects" | "notFound" | "cacheHeaders">>>;
|
|
1788
1814
|
/**
|
|
1789
1815
|
* Options for a single {@link Api.run} call. All fields are optional; an absent/empty
|
|
1790
1816
|
* options object runs the full production build (clean + every configured phase). The
|