solidstep 0.1.8 → 0.2.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 CHANGED
@@ -370,6 +370,10 @@ export const options = {
370
370
  },
371
371
  };
372
372
  ```
373
+ - Regarding caching, setting `ttl` to `0` or omitting it will disable caching for that page.
374
+ - Setting a positive integer value will cache the page for that duration in milliseconds.
375
+ - Invalidation of cached pages can be done using the `invalidateCache` and `revalidatePath` utilities.
376
+ - The `responseHeaders` option allows you to set custom HTTP headers for the page response.
373
377
 
374
378
  ## API Routes
375
379
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solidstep",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Next Step SolidJS Framework for building web applications.",
5
5
  "type": "module",
6
6
  "author": "HamzaKV <hamzakv333@gmail.com>",
package/server.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAyhBA,QAAA,MAAM,OAAO,+FAgVX,CAAC;AAEH,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AA0hBA,QAAA,MAAM,OAAO,+FAgVX,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/server.js CHANGED
@@ -362,12 +362,13 @@ const render = async ({ toRender, entry, routeParams, searchParams, req, cspNonc
362
362
  const composed = await compose();
363
363
  const rendered = await renderToString(() => composed());
364
364
  if (toRender === 'main') {
365
+ const options = cachingOptions;
365
366
  setCache(path, {
366
367
  rendered: rendered,
367
368
  documentMeta: meta,
368
369
  documentAssets: assets,
369
370
  loaderData: loaderData,
370
- }, cachingOptions ? cachingOptions.ttl : 0);
371
+ }, options?.ttl ? options.ttl : 0);
371
372
  }
372
373
  return {
373
374
  rendered: rendered,
package/utils/cache.js CHANGED
@@ -37,7 +37,7 @@ const removeTail = () => {
37
37
  };
38
38
  export const getCache = (key) => {
39
39
  const entry = cacheMap.get(key);
40
- if (!entry)
40
+ if (!entry || !entry.expiresAt)
41
41
  return null;
42
42
  if (entry.expiresAt && entry.expiresAt < Date.now()) {
43
43
  cacheMap.delete(key);