weifuwu 0.27.20 → 0.27.22

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/index.d.ts CHANGED
@@ -66,4 +66,4 @@ export { loadModule, clearModuleCache } from './ssr/compile.ts';
66
66
  export { cssContext, cssRouter, clearCSSCache } from './ssr/css.ts';
67
67
  export type { CssAsset } from './ssr/css.ts';
68
68
  export { assetRouter, assetScripts } from './ssr/assets.ts';
69
- export { wfuwAssets } from './ssr/ui/assets.ts';
69
+ export { wfuwAssets, wfuwVersion } from './ssr/ui/assets.ts';
package/dist/index.js CHANGED
@@ -3664,6 +3664,15 @@ import { readFileSync as readFileSync3 } from "node:fs";
3664
3664
  import { resolve as resolve7, dirname } from "node:path";
3665
3665
  import { fileURLToPath } from "node:url";
3666
3666
  var __dirname = dirname(fileURLToPath(import.meta.url));
3667
+ var wfuwVersion = (() => {
3668
+ try {
3669
+ const js = readFileSync3(resolve7(__dirname, "weifuwu-ui.js"), "utf-8");
3670
+ const m = js.match(/WFU_VERSION = '([^']+)'/);
3671
+ return m ? m[1] : "0.0.0";
3672
+ } catch {
3673
+ return "0.0.0";
3674
+ }
3675
+ })();
3667
3676
  function wfuwAssets() {
3668
3677
  const router = new Router();
3669
3678
  const jsPath = resolve7(__dirname, "weifuwu-ui.js");
@@ -3681,7 +3690,7 @@ function wfuwAssets() {
3681
3690
  return new Response(jsContent, {
3682
3691
  headers: {
3683
3692
  "content-type": "application/javascript; charset=utf-8",
3684
- "cache-control": "public, max-age=0, must-revalidate"
3693
+ "cache-control": "public, max-age=31536000, immutable"
3685
3694
  }
3686
3695
  });
3687
3696
  });
@@ -3696,7 +3705,7 @@ function wfuwAssets() {
3696
3705
  return new Response(cssContent, {
3697
3706
  headers: {
3698
3707
  "content-type": "text/css; charset=utf-8",
3699
- "cache-control": "public, max-age=0, must-revalidate"
3708
+ "cache-control": "public, max-age=31536000, immutable"
3700
3709
  }
3701
3710
  });
3702
3711
  });
@@ -3786,5 +3795,6 @@ export {
3786
3795
  validate,
3787
3796
  view,
3788
3797
  wfuwAssets,
3798
+ wfuwVersion,
3789
3799
  withTestDb
3790
3800
  };
@@ -1,2 +1,4 @@
1
1
  import { Router } from '../../core/router.ts';
2
+ /** Current weifuwu version, extracted from weifuwu-ui.js header. */
3
+ export declare const wfuwVersion: string;
2
4
  export declare function wfuwAssets(): Router;
@@ -1,4 +1,4 @@
1
- import { html, raw } from 'weifuwu'
1
+ import { html, raw, wfuwVersion } from 'weifuwu'
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  export default function (body: string, ctx: any) {
@@ -16,8 +16,8 @@ export default function (body: string, ctx: any) {
16
16
  <meta charset="utf-8" />
17
17
  <meta name="viewport" content="width=device-width, initial-scale=1" />
18
18
  <title>weifuwu</title>
19
- <link rel="stylesheet" href="/__wfw/css/weifuwu-ui.css" />
20
- <script src="/__wfw/js/weifuwu-ui.js"></script>
19
+ <link rel="stylesheet" href="/__wfw/css/weifuwu-ui.css?v=${wfuwVersion}" />
20
+ <script src="/__wfw/js/weifuwu-ui.js?v=${wfuwVersion}"></script>
21
21
  <script id="__wfw-i18n" type="application/json">
22
22
  ${raw(JSON.stringify(messages))}
23
23
  </script>
@@ -11,7 +11,7 @@
11
11
  * @license MIT
12
12
  * @version 0.1.0
13
13
  */
14
- const WFU_VERSION = '0.27.19';
14
+ const WFU_VERSION = '0.27.20';
15
15
  (function () {
16
16
  'use strict'
17
17
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.27.20",
4
+ "version": "0.27.22",
5
5
  "description": "Web-standard HTTP microframework for Node.js — (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": "./dist/index.js"
@@ -1,7 +0,0 @@
1
- /**
2
- * cn() — Merge class names, handling conditional and array inputs.
3
- * Lightweight alternative to clsx + tailwind-merge.
4
- */
5
- export function cn(...classes: (string | false | null | undefined)[]): string {
6
- return classes.filter(Boolean).join(' ')
7
- }