Skip to content

Commit

Permalink
refactor(preact): export createProgress from adapters, excludes pro…
Browse files Browse the repository at this point in the history
…gress from bundle by default
  • Loading branch information
jrson83 committed Apr 26, 2024
1 parent 6e53be7 commit 42145a0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
10 changes: 10 additions & 0 deletions packages/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
"default": "./dist/index.mjs"
}
},
"./progress": {
"require": {
"types": "./dist/progress.d.cts",
"default": "./dist/progress.cjs"
},
"import": {
"types": "./dist/progress.d.mts",
"default": "./dist/progress.mjs"
}
},
"./server": {
"require": {
"types": "./dist/server.d.cts",
Expand Down
27 changes: 10 additions & 17 deletions packages/preact/src/createInertiaApp.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
type HeadManagerOnUpdate,
type HeadManagerTitleCallback,
type Page,
type PageProps,
type PageResolver,
setupProgress,
import type {
HeadManagerOnUpdate,
HeadManagerTitleCallback,
Page,
PageProps,
PageResolver,
ProgressCallback,
} from '@inertiajs-revamped/core'
import {
type ComponentChild,
Expand Down Expand Up @@ -42,14 +42,7 @@ export type InertiaAppOptionsForCSR<SharedProps extends PageProps> =
id?: string
page?: Page | string
render?: undefined
progress?:
| false
| {
delay?: number
color?: string
includeCSS?: boolean
showSpinner?: boolean
}
progress?: ProgressCallback
setup(options: SetupOptions<SharedProps>): CreateInertiaAppSetupReturnType
}

Expand Down Expand Up @@ -80,7 +73,7 @@ export default async function createInertiaApp<
resolve,
setup,
title,
progress = {},
progress,
page,
render,
}:
Expand Down Expand Up @@ -123,7 +116,7 @@ export default async function createInertiaApp<
)

if (!isServer && progress) {
setupProgress(progress)
progress()
}

if (isServer && render) {
Expand Down
1 change: 1 addition & 0 deletions packages/preact/src/progress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as createProgress } from '@inertiajs-revamped/core/progress'

0 comments on commit 42145a0

Please sign in to comment.