oc-template-preact-compiler 3.1.2 → 3.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-template-preact-compiler",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Compiler for the Preact OC template",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@preact/preset-vite": "^2.7.0",
32
32
  "oc-template-preact": "^0.1.1",
33
- "oc-vite-compiler": "^5.1.2",
33
+ "oc-vite-compiler": "^5.1.3",
34
34
  "preact": "^10"
35
35
  },
36
36
  "peerDependencies": {
@@ -26,8 +26,8 @@
26
26
  "@testing-library/react": "^14.0.0",
27
27
  "@testing-library/user-event": "^14.4.3",
28
28
  "jsdom": "^21.1.1",
29
- "oc-server": "^3.1.0",
30
- "oc-template-preact-compiler": "^3.1.1",
29
+ "oc-server": "^4.0.0",
30
+ "oc-template-preact-compiler": "^3.1.4",
31
31
  "preact": "^10.13.2",
32
32
  "typescript": "5.0.2",
33
33
  "vitest": "^0.29.7"
@@ -1,5 +1,9 @@
1
1
  import { useState } from 'preact/hooks';
2
- import { ActionOutput, InitialData, serverClient } from 'oc-server';
2
+ import {
3
+ type ActionOutput,
4
+ type InitialData,
5
+ serverClient,
6
+ } from 'oc-server/client';
3
7
  import styles from './styles.css';
4
8
  import logo from '../public/logo.png';
5
9
 
@@ -53,7 +53,10 @@ export const server = new Server({
53
53
 
54
54
  // Set cache headers when same params produce same result
55
55
  // This improves performance by reducing server load
56
- ctx.setHeader('Cache-Control', 'max-age=300'); // Cache for 5 minutes
56
+ // Don't cache in local environment because we might get render mismatches
57
+ if (ctx.env.name !== 'local') {
58
+ ctx.setHeader('Cache-Control', 'max-age=300'); // Cache for 5 minutes
59
+ }
57
60
 
58
61
  // Return data that will be passed as props to React component
59
62
  return {
@@ -16,7 +16,7 @@
16
16
  // These values are required and cannot be changed by the user
17
17
  // Keep this in sync with the rollup config
18
18
  "module": "esnext",
19
- "moduleResolution": "node",
19
+ "moduleResolution": "bundler",
20
20
  "resolveJsonModule": true,
21
21
  "isolatedModules": true,
22
22
  "jsx": "react-jsx",