Skip to content

Commit

Permalink
Update docs to reflect import changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dulnan committed Jan 8, 2023
1 parent e3209e3 commit ec9a846
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/advanced/default-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ middleware](https://nuxt.com/docs/guide/directory-structure/server#server-middle

::: code-group
```typescript [./server/middleware/routeCache.ts]
import { useRouteCache } from '#nuxt-multi-cache'
import { useRouteCache } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
// Cache all routes for 7 days.
Expand Down Expand Up @@ -156,7 +156,7 @@ useCDNHeaders((helper) => {

::: code-group
```typescript [./server/middleware/routeCache.ts]
import { useRouteCache } from '#nuxt-multi-cache'
import { useRouteCache } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
useCDNHeaders((helper) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/route-and-cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ does not affect the max age of the CDN cache control header.
Decide in a middleware where the page should be cached.

```typescript
import { useCDNHeaders } from '#nuxt-multi-cache'
import { useCDNHeaders } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
if (event.path.startsWith('/dashboard')) {
Expand Down
2 changes: 1 addition & 1 deletion docs/features/cdn-cache-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ automatically. In addition you have to provide the H3Event object as the second
argument:
```typescript
import { useCDNHeaders } from '#nuxt-multi-cache'
import { useCDNHeaders } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
useCDNHeaders((helper) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/features/data-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ You can use it in custom server handlers, but you have to provide the `H3Event`
object as the second argument.
```typescript
import { useDataCache } from '#nuxt-multi-cache'
import { useDataCache } from '#nuxt-multi-cache/composables'

export default defineEventHandler(async (event) => {
const { value, addToCache } = await useDataCache('weather')
Expand Down
2 changes: 1 addition & 1 deletion docs/features/route-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The composable is not imported automatically and you have to provide the
`H3Event` object as the second argument:
```typescript
import { useRouteCache } from '#nuxt-multi-cache'
import { useRouteCache } from '#nuxt-multi-cache/composables'

const getResult = function () {
return new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion playground/server/api/cdnHeaders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCDNHeaders } from '#nuxt-multi-cache'
import { useCDNHeaders } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
useCDNHeaders((helper) => {
Expand Down
2 changes: 1 addition & 1 deletion playground/server/api/delay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRouteCache } from '#nuxt-multi-cache'
import { useRouteCache } from '#nuxt-multi-cache/composables'

const getResult = function () {
return new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion playground/server/api/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCDNHeaders, useRouteCache } from '#nuxt-multi-cache'
import { useCDNHeaders, useRouteCache } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
const cacheTags: string[] = [
Expand Down
2 changes: 1 addition & 1 deletion playground/server/api/withCacheTags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRouteCache } from '#nuxt-multi-cache'
import { useRouteCache } from '#nuxt-multi-cache/composables'

export default defineEventHandler((event) => {
useRouteCache((helper) => {
Expand Down
5 changes: 3 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineNuxtModule<ModuleOptions>({
// Add RenderCacheable component if feature is enabled.
if (options.component) {
await addComponent({
filePath: resolve('./runtime/components/RenderCacheable/index.ts'),
filePath: resolve('./runtime/components/RenderCacheable/index'),
name: 'RenderCacheable',
global: true,
})
Expand Down Expand Up @@ -112,7 +112,8 @@ export default defineNuxtModule<ModuleOptions>({
})
}

// Hooks into sending the response.
// Hooks into sending the response and adds route to cache and adds CDN
// headers.
if (options.cdn?.enabled || options.route?.enabled) {
addServerHandler({
handler: resolve('./runtime/serverHandler/responseSend'),
Expand Down

0 comments on commit ec9a846

Please sign in to comment.