Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6e3d7e9
refactor: split out renderMeta into separate function
danielroe Jun 28, 2022
488d3ba
feat: support rendering individual components
danielroe Jun 28, 2022
aa98041
feat: render styles/scripts and extract type
danielroe Jul 1, 2022
109d48a
fix: workaround upstream vue issue
danielroe Jul 1, 2022
7547e03
fix: suppress vue-router warning
danielroe Jul 1, 2022
fdb09e2
feat: support POST requests as well
danielroe Jul 1, 2022
12d2592
refactor: use `destr` to parse
danielroe Jul 1, 2022
be7ab20
refactor: clarity
danielroe Jul 1, 2022
4759e41
fix: remove setHeader for `application/json`
danielroe Jul 1, 2022
8d6e23a
refactor: styles & scripts
danielroe Jul 1, 2022
4a1db3b
feat: add `isIndividualRender` composable
danielroe Jul 7, 2022
b1c32db
feat: support passing url in `customRender` payload
danielroe Jul 7, 2022
11c8e14
test: add test suite for server rendering individual components
danielroe Jul 7, 2022
f832468
test: improve snapshot readability
danielroe Jul 7, 2022
63978b4
chore: revert changes
danielroe Jul 7, 2022
be889e8
fix: disable universal router too
danielroe Jul 7, 2022
685fc4b
refactor: remove `isIndividualRender` and detect directly from app flag
danielroe Jul 8, 2022
08b8274
fix: use based on url
danielroe Jul 8, 2022
5696fd8
test: update state snapshots
danielroe Jul 8, 2022
9bb09f7
Merge branch 'main' into feat/selective-rendering
pi0 Jul 14, 2022
f180149
revert back json header
pi0 Jul 14, 2022
4a8e5f9
fix: always repond json in custom render mode
pi0 Jul 14, 2022
cc273c3
refactor: rename to isolated
pi0 Jul 14, 2022
206469f
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Jul 22, 2022
eb889fa
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Aug 1, 2022
0efce9a
refactor: only render island components (via `~/components/islands` o…
danielroe Aug 1, 2022
e712bd2
test: update components fixture for global + islands components
danielroe Aug 1, 2022
4fe0bf5
feat: strip server-only component code from client build
danielroe Aug 1, 2022
192ff02
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Aug 3, 2022
0a96bb5
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Aug 7, 2022
9ff0f7d
Merge branch 'main' into feat/selective-rendering
danielroe Aug 17, 2022
bf458c1
refactor: return `RenderResponse` for components too, remove nuxt hoo…
danielroe Aug 17, 2022
ea7e9ba
Merge branch 'main' into feat/selective-rendering
pi0 Aug 17, 2022
54300ff
isolated ~> island
pi0 Aug 17, 2022
e18942a
refactor: use single render endpoint
pi0 Aug 17, 2022
33858ed
Merge branch 'main' into feat/selective-rendering
pi0 Aug 18, 2022
9e18a88
fix lint and update test
pi0 Aug 18, 2022
8b8fa7a
update
pi0 Aug 18, 2022
d610fbb
update types
pi0 Aug 18, 2022
1cb6406
remove server-components plugin
pi0 Aug 18, 2022
b41bb84
add render:island hook
pi0 Aug 18, 2022
66d61fa
improved url format for caching and prerendering
pi0 Aug 18, 2022
6f8a2d9
handle 404 components
pi0 Aug 18, 2022
5372a87
feat: `NuxtIsland` component
pi0 Aug 18, 2022
7cad463
chore: remove unused imports
pi0 Aug 18, 2022
752dfc0
nullify island renderer for client-side
pi0 Aug 18, 2022
2891b0b
improve url matching
pi0 Aug 18, 2022
71a0c88
fix hashId matching
pi0 Aug 18, 2022
d5b8c1e
update tests
pi0 Aug 18, 2022
8994268
use NuxtIslandContext for nuxt app
pi0 Aug 18, 2022
3956bfb
refactor: reduce git diff
pi0 Aug 18, 2022
1101eba
fix: add name to hashId to make it always unique
pi0 Aug 18, 2022
340f858
update snapshot test
pi0 Aug 18, 2022
811c193
fix: split component islands
pi0 Aug 18, 2022
5d15708
nuxt-island: test client side and handle parallel requests to same
pi0 Aug 18, 2022
82e919c
remove comments from snapshot
pi0 Aug 18, 2022
b2fcd74
Merge branch 'main' into feat/selective-rendering
pi0 Aug 18, 2022
c2a723f
refactor: move tag parsing to the server renderer
pi0 Aug 18, 2022
4d10638
fix: strip all comments
pi0 Aug 18, 2022
b363043
update test
pi0 Aug 18, 2022
4a8fb3d
fix tag parsing and compress
pi0 Aug 18, 2022
22dfbcd
use computed object for head
pi0 Aug 18, 2022
aa7e07a
eslint is sometimes not funny either
pi0 Aug 18, 2022
d41fd7a
update fixture
pi0 Aug 18, 2022
dc7db7f
chore: typo
danielroe Sep 26, 2022
410beda
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Sep 26, 2022
2dce064
fix: respect island url
danielroe Sep 26, 2022
bbb12e4
test: remove hashes
danielroe Sep 26, 2022
ae18933
style: revert indent
danielroe Sep 26, 2022
1d98c28
test: add support for extracting style/title tags
danielroe Sep 26, 2022
96d1648
fix: type assertion
danielroe Sep 26, 2022
dd09120
style: reorder import
danielroe Sep 26, 2022
734bfcc
style: move comment
danielroe Sep 26, 2022
bd3e3d4
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Sep 26, 2022
7cb15e7
test: sort after map
danielroe Sep 26, 2022
d7f810d
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Sep 26, 2022
3334dbd
Merge remote-tracking branch 'origin/main' into feat/selective-rendering
danielroe Oct 9, 2022
de7d997
test: update snapshot
danielroe Oct 9, 2022
ee495e3
Merge branch 'main' into feat/selective-rendering
pi0 Nov 11, 2022
33c2658
small fixes
pi0 Nov 11, 2022
7c66c41
feat: implement style inlining with unique keys
pi0 Nov 11, 2022
2484081
debug test
pi0 Nov 11, 2022
3be020c
enable behind `experimental.componentIslands`
pi0 Nov 11, 2022
b25019b
Merge branch 'main' into feat/selective-rendering
pi0 Nov 15, 2022
24ea58d
try to normalize head for dev
pi0 Nov 15, 2022
73f6bb5
add fallback for components.islands.mjs when disabled
pi0 Nov 15, 2022
dfaaf6d
Merge branch 'main' into feat/selective-rendering
pi0 Nov 15, 2022
e1148a4
rest: mask data-v- id
pi0 Nov 15, 2022
3529f0c
Merge branch 'main' into feat/selective-rendering
pi0 Nov 24, 2022
3a65a8d
fix missing key type
pi0 Nov 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tag parsing and compress
  • Loading branch information
pi0 committed Aug 18, 2022
commit 4a8fb3db5ec8315a1c7e5b746278a097a72e68ed
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/components/nuxt-island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
const res: NuxtIslandResponse = await nuxtApp[pKey][hashId.value]
// TODO: Use better head meerging
useHead({
link: res.tags.filter(tag => tag.tag === 'link').map(tag => tag.attrs)
link: res.tags.filter(tag => tag[0] === 'link').map(tag => tag[1] || {})
})
html.value = res.html
}
Expand Down
8 changes: 4 additions & 4 deletions packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface NuxtIslandResponse {
id?: string
html: string
state: Record<string, any>
tags: { tag: string, attrs: Record<string, string> }[]
tags: [tag: string, attrs?: Record<string, string>][]
}

export interface NuxtRenderResponse {
Expand Down Expand Up @@ -276,15 +276,15 @@ function renderHTMLDocument (html: NuxtRenderHTMLContext) {

// TOOD: Move to external library
const HTML_TAG_RE = /<(?<tag>[a-z]+)(?<rawAttrs> [^>]*)>/g
const HTML_TAG_ATTR_RE = /(?<name>[a-z]+)=(?<value>"[^"]*"|'[^']*'|[^ >]*)/g
const HTML_TAG_ATTR_RE = /(?<name>[a-z]+)="(?<value>[^"]*)"/g
function extractHTMLTags (html: string) {
const tags: {tag: string, attrs: Record<string, string>}[] = []
const tags: [tag: string, attrs?: Record<string, string>][] = []
for (const tagMatch of html.matchAll(HTML_TAG_RE)) {
const attrs = {} as Record<string, string>
for (const attraMatch of tagMatch.groups!.rawAttrs.matchAll(HTML_TAG_ATTR_RE)) {
attrs[attraMatch.groups!.name] = attraMatch.groups!.value
}
tags.push({ tag: tagMatch.groups!.tag, attrs })
tags.push([tagMatch.groups!.tag, attrs])
}
return tags
}