vitral 0.11.4 → 0.12.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 +133 -91
- package/dist/angular.js +7 -7
- package/dist/auto.js +7 -7
- package/dist/{channel-ABGK26Q5.js → channel-BHOVSU5X.js} +1 -1
- package/dist/{chunk-AL6MLNVY.js → chunk-52D6ZT4A.js} +16 -9
- package/dist/{chunk-6JH2I65O.js → chunk-I7IFR65H.js} +6 -6
- package/dist/{chunk-2SAI6S2H.js → chunk-JKTZODC5.js} +2 -2
- package/dist/{chunk-MICF64AZ.js → chunk-QGAEXUP5.js} +1 -1
- package/dist/{chunk-I3CDUKHO.js → chunk-RGYVSS3X.js} +11 -6
- package/dist/{chunk-SVYL6UCB.js → chunk-UFETTKDP.js} +4 -4
- package/dist/{chunk-SPSAXBPR.js → chunk-VDNFRNOG.js} +25 -8
- package/dist/{chunk-GGMM56TM.js → chunk-VDVVEGAO.js} +7 -0
- package/dist/{chunk-IKCEA3YN.js → chunk-YDO7SPF4.js} +3 -3
- package/dist/{chunk-NQ6ZTGQZ.js → chunk-YKLWMIEH.js} +1 -1
- package/dist/cli.js +22 -3
- package/dist/element.js +7 -7
- package/dist/embed.js +2 -2
- package/dist/{expose-2S3TCXSP.js → expose-KL6TA472.js} +5 -5
- package/dist/{hydrate-FJHHLW5G.js → hydrate-LS3MLFGN.js} +6 -6
- package/dist/iframe.js +6 -6
- package/dist/index.js +5 -5
- package/dist/next-host.d.ts +16 -3
- package/dist/next-host.js +30 -23
- package/dist/preact.d.ts +1 -0
- package/dist/preact.js +7 -7
- package/dist/prefetch.js +5 -5
- package/dist/react.d.ts +5 -1
- package/dist/react.js +7 -7
- package/dist/{reframe-HIYA2TIU.js → reframe-AD2UEPIO.js} +6 -6
- package/dist/{route-4KQITYD4.js → route-CEMWXHJI.js} +19 -1
- package/dist/routes.js +6 -6
- package/dist/{shadow-7ZV4JEO6.js → shadow-ABRO7JNY.js} +2 -2
- package/dist/solid.d.ts +2 -1
- package/dist/solid.js +18 -7
- package/dist/{sri-AMQOKKWR.js → sri-Z5U32IR2.js} +3 -3
- package/dist/svelte.js +6 -6
- package/dist/sw.d.ts +21 -19
- package/dist/sw.js +20 -9
- package/dist/testing.js +5 -5
- package/dist/vite.js +35 -0
- package/dist/vue.js +7 -7
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -86,67 +86,94 @@ Os 10 frameworks têm testes de ponta a ponta no CI, com host e remote de framew
|
|
|
86
86
|
|
|
87
87
|
## Começo rápido
|
|
88
88
|
|
|
89
|
-
Exemplo: uma loja em React
|
|
89
|
+
Exemplo: uma loja em React mostra o carrinho, feito por outra equipe. Os dois lados abaixo têm os mesmos arquivos, na mesma ordem.
|
|
90
90
|
|
|
91
91
|
### Hoje, com Module Federation
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
```jsx
|
|
94
|
+
// carrinho/src/Carrinho.jsx
|
|
95
|
+
export default function Carrinho({ userId }) {
|
|
96
|
+
return <p>Carrinho do usuário {userId}</p>
|
|
97
|
+
}
|
|
98
|
+
```
|
|
94
99
|
|
|
95
100
|
```js
|
|
96
101
|
// carrinho/webpack.config.js
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const { ModuleFederationPlugin } = require('webpack').container
|
|
103
|
+
|
|
104
|
+
module.exports = {
|
|
105
|
+
plugins: [
|
|
106
|
+
new ModuleFederationPlugin({
|
|
107
|
+
name: 'carrinho',
|
|
108
|
+
filename: 'remoteEntry.js',
|
|
109
|
+
exposes: { './Carrinho': './src/Carrinho.jsx' },
|
|
110
|
+
shared: { react: { singleton: true }, 'react-dom': { singleton: true } },
|
|
111
|
+
}),
|
|
112
|
+
],
|
|
113
|
+
}
|
|
103
114
|
```
|
|
104
115
|
|
|
105
116
|
```js
|
|
106
117
|
// loja/webpack.config.js
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
const { ModuleFederationPlugin } = require('webpack').container
|
|
119
|
+
|
|
120
|
+
module.exports = {
|
|
121
|
+
plugins: [
|
|
122
|
+
new ModuleFederationPlugin({
|
|
123
|
+
name: 'loja',
|
|
124
|
+
remotes: { carrinho: 'carrinho@https://cdn.empresa.com/carrinho/remoteEntry.js' },
|
|
125
|
+
shared: { react: { singleton: true }, 'react-dom': { singleton: true } },
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
}
|
|
112
129
|
```
|
|
113
130
|
|
|
114
131
|
```jsx
|
|
115
132
|
// loja/src/App.jsx
|
|
116
|
-
|
|
133
|
+
import { lazy, Suspense } from 'react'
|
|
134
|
+
|
|
135
|
+
const Carrinho = lazy(() => import('carrinho/Carrinho'))
|
|
117
136
|
|
|
118
137
|
export function App() {
|
|
119
138
|
return (
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
</Suspense>
|
|
124
|
-
</ErrorBoundary>
|
|
139
|
+
<Suspense fallback={<p>Carregando…</p>}>
|
|
140
|
+
<Carrinho userId={42} />
|
|
141
|
+
</Suspense>
|
|
125
142
|
)
|
|
126
143
|
}
|
|
127
144
|
```
|
|
128
145
|
|
|
129
146
|
### O mesmo app com vitral
|
|
130
147
|
|
|
131
|
-
Só o carrinho tem plugin. O build da loja não muda.
|
|
132
|
-
|
|
133
148
|
```jsx
|
|
134
|
-
// carrinho/src/
|
|
135
|
-
export default function Carrinho({ userId }) {
|
|
149
|
+
// carrinho/src/Carrinho.jsx (igual)
|
|
150
|
+
export default function Carrinho({ userId }) {
|
|
151
|
+
return <p>Carrinho do usuário {userId}</p>
|
|
152
|
+
}
|
|
136
153
|
```
|
|
137
154
|
|
|
138
155
|
```js
|
|
139
|
-
// carrinho/vite.config.js (no lugar do
|
|
156
|
+
// carrinho/vite.config.js (no lugar do webpack.config.js)
|
|
140
157
|
import react from '@vitejs/plugin-react'
|
|
141
158
|
import vitral from 'vitral/vite'
|
|
142
159
|
|
|
143
|
-
export default {
|
|
160
|
+
export default {
|
|
161
|
+
plugins: [
|
|
162
|
+
react(),
|
|
163
|
+
vitral({ name: 'carrinho', entry: 'src/Carrinho.jsx', dedupe: ['react'] }),
|
|
164
|
+
],
|
|
165
|
+
}
|
|
144
166
|
```
|
|
145
167
|
|
|
146
|
-
|
|
168
|
+
```js
|
|
169
|
+
// loja/webpack.config.js (sem o ModuleFederationPlugin)
|
|
170
|
+
module.exports = {
|
|
171
|
+
plugins: [],
|
|
172
|
+
}
|
|
173
|
+
```
|
|
147
174
|
|
|
148
175
|
```jsx
|
|
149
|
-
// loja/src/App.jsx
|
|
176
|
+
// loja/src/App.jsx
|
|
150
177
|
import { configure } from 'vitral'
|
|
151
178
|
import { Remote } from 'vitral/react'
|
|
152
179
|
|
|
@@ -157,22 +184,21 @@ export function App() {
|
|
|
157
184
|
}
|
|
158
185
|
```
|
|
159
186
|
|
|
160
|
-
|
|
187
|
+
`vite build` no carrinho gera o JS, o CSS e o `vitral.json`. Publique a pasta `dist` em qualquer CDN. Para gerar loja e carrinho prontos: `npm create vitral@latest`.
|
|
161
188
|
|
|
162
189
|
### O que muda
|
|
163
190
|
|
|
164
191
|
| | Module Federation | vitral |
|
|
165
192
|
|---|---|---|
|
|
166
|
-
| Build da loja | Plugin com `remotes` e `shared` |
|
|
167
|
-
| Versão do React | Combinada entre as equipes (`singleton`) |
|
|
168
|
-
| Carregando e erro | `Suspense` e `ErrorBoundary` | `fallback` e `error` do `<Remote>` |
|
|
193
|
+
| Build da loja | Plugin com `remotes` e `shared` | Sem plugin |
|
|
194
|
+
| Versão do React | Combinada entre as equipes (`singleton`) | O carrinho usa o React da loja quando a versão serve (`dedupe`), senão o próprio |
|
|
169
195
|
| Framework | O mesmo nos dois lados | Qualquer um. A loja em React pode mostrar um carrinho em Vue |
|
|
170
196
|
|
|
171
197
|
Numa página HTML qualquer, sem build:
|
|
172
198
|
|
|
173
199
|
```html
|
|
174
200
|
<script type="module" src="https://cdn.jsdelivr.net/npm/vitral/dist/auto.js"></script>
|
|
175
|
-
<vitral-remote src="https://cdn.empresa.com/carrinho/vitral.json"></vitral-remote>
|
|
201
|
+
<vitral-remote src="https://cdn.empresa.com/carrinho/vitral.json" props='{"userId": 42}'></vitral-remote>
|
|
176
202
|
```
|
|
177
203
|
|
|
178
204
|
Guia completo: [Migrar do Module Federation](https://joaogabriel15.github.io/vitral/migracao/module-federation).
|
|
@@ -196,7 +222,7 @@ Host e remote não precisam ser do mesmo framework. Cada um tem uma página com
|
|
|
196
222
|
|
|
197
223
|
## Next.js como host
|
|
198
224
|
|
|
199
|
-
Exemplo: uma loja em Next.js com a área "Minha conta", feita por outra equipe.
|
|
225
|
+
Exemplo: uma loja em Next.js com a área "Minha conta", feita por outra equipe. Os dois lados abaixo têm os mesmos arquivos, na mesma ordem. Com vitral, a loja ganha um arquivo novo no fim.
|
|
200
226
|
|
|
201
227
|
<p align="center">
|
|
202
228
|
<picture>
|
|
@@ -207,13 +233,18 @@ Exemplo: uma loja em Next.js com a área "Minha conta", feita por outra equipe.
|
|
|
207
233
|
|
|
208
234
|
### Hoje, com Multi-Zones
|
|
209
235
|
|
|
210
|
-
São dois apps Next. A loja repassa as URLs de `/conta` para o app da conta.
|
|
211
|
-
|
|
212
236
|
```
|
|
213
237
|
loja/ app Next principal
|
|
214
238
|
conta/ segundo app Next (a zona)
|
|
215
239
|
```
|
|
216
240
|
|
|
241
|
+
```tsx
|
|
242
|
+
// conta/pages/index.tsx
|
|
243
|
+
export default function Conta() {
|
|
244
|
+
return <h1>Minha conta</h1>
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
217
248
|
```js
|
|
218
249
|
// conta/next.config.js
|
|
219
250
|
module.exports = {
|
|
@@ -222,13 +253,6 @@ module.exports = {
|
|
|
222
253
|
}
|
|
223
254
|
```
|
|
224
255
|
|
|
225
|
-
```tsx
|
|
226
|
-
// conta/pages/index.tsx
|
|
227
|
-
export default function Conta() {
|
|
228
|
-
return <h1>Minha conta</h1>
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
256
|
```js
|
|
233
257
|
// loja/next.config.js
|
|
234
258
|
module.exports = {
|
|
@@ -242,6 +266,13 @@ module.exports = {
|
|
|
242
266
|
}
|
|
243
267
|
```
|
|
244
268
|
|
|
269
|
+
```tsx
|
|
270
|
+
// loja/pages/_app.tsx
|
|
271
|
+
export default function App({ Component, pageProps }) {
|
|
272
|
+
return <Component {...pageProps} />
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
245
276
|
```tsx
|
|
246
277
|
// loja/components/Menu.tsx
|
|
247
278
|
// <a>, não <Link>: a página recarrega e baixa Next e React de novo.
|
|
@@ -250,30 +281,33 @@ module.exports = {
|
|
|
250
281
|
|
|
251
282
|
### O mesmo app com vitral
|
|
252
283
|
|
|
253
|
-
A loja continua sendo o único app Next. A conta vira um remote: um projeto Vite com o mesmo componente.
|
|
254
|
-
|
|
255
284
|
```
|
|
256
285
|
loja/ app Next (o host)
|
|
257
|
-
conta/
|
|
286
|
+
conta/ o mesmo código, buildado com Vite (o remote)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
// conta/pages/index.tsx (igual)
|
|
291
|
+
export default function Conta() {
|
|
292
|
+
return <h1>Minha conta</h1>
|
|
293
|
+
}
|
|
258
294
|
```
|
|
259
295
|
|
|
260
296
|
```js
|
|
261
|
-
// conta/vite.config.js (no lugar do next.config.js
|
|
297
|
+
// conta/vite.config.js (no lugar do next.config.js)
|
|
262
298
|
import react from '@vitejs/plugin-react'
|
|
263
299
|
import vitral from 'vitral/vite'
|
|
264
300
|
|
|
265
|
-
export default {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
export default function Conta() {
|
|
271
|
-
return <h1>Minha conta</h1>
|
|
301
|
+
export default {
|
|
302
|
+
plugins: [
|
|
303
|
+
react(),
|
|
304
|
+
vitral({ name: 'conta', entry: 'pages/index.tsx', next: { basePath: '/conta' }, dedupe: ['react'] }),
|
|
305
|
+
],
|
|
272
306
|
}
|
|
273
307
|
```
|
|
274
308
|
|
|
275
309
|
```js
|
|
276
|
-
// loja/next.config.js (no lugar das rewrites)
|
|
310
|
+
// loja/next.config.js (withVitral no lugar das rewrites)
|
|
277
311
|
const { withVitral } = require('vitral/next-config')
|
|
278
312
|
|
|
279
313
|
module.exports = withVitral({}, {
|
|
@@ -284,7 +318,7 @@ module.exports = withVitral({}, {
|
|
|
284
318
|
```
|
|
285
319
|
|
|
286
320
|
```tsx
|
|
287
|
-
// loja/pages/_app.tsx (
|
|
321
|
+
// loja/pages/_app.tsx (mais o <VitralNext />)
|
|
288
322
|
import { VitralNext } from 'vitral/next-host'
|
|
289
323
|
|
|
290
324
|
export default function App({ Component, pageProps }) {
|
|
@@ -293,49 +327,52 @@ export default function App({ Component, pageProps }) {
|
|
|
293
327
|
```
|
|
294
328
|
|
|
295
329
|
```tsx
|
|
296
|
-
// loja/
|
|
330
|
+
// loja/components/Menu.tsx
|
|
331
|
+
// <Link>: a troca é sem recarregar, e o React não baixa de novo.
|
|
332
|
+
<Link href="/conta">Minha conta</Link>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
// loja/pages/conta/[[...slug]].tsx (arquivo novo: a página da loja que mostra a conta)
|
|
297
337
|
import { NextRemote } from 'vitral/next-host'
|
|
298
338
|
|
|
299
339
|
export default function Conta() {
|
|
300
|
-
return <
|
|
340
|
+
return <NextRemote name="conta" fallback={<p>Carregando…</p>} />
|
|
301
341
|
}
|
|
302
342
|
```
|
|
303
343
|
|
|
304
|
-
|
|
305
|
-
// loja/components/Menu.tsx
|
|
306
|
-
// <Link> normal: a troca é sem recarregar, e o React não baixa de novo.
|
|
307
|
-
<Link href="/conta">Minha conta</Link>
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Se o código da conta já usa `next/link` ou `useRouter`, não precisa reescrever: `vitral({ name: 'conta', next: { basePath: '/conta' } })` builda esse código com o Vite.
|
|
344
|
+
Com `next: { basePath }`, o código da conta pode continuar usando `next/link` e `useRouter`.
|
|
311
345
|
|
|
312
346
|
### O que muda
|
|
313
347
|
|
|
314
348
|
| | Multi-Zones | vitral |
|
|
315
349
|
|---|---|---|
|
|
316
350
|
| Apps Next | Um por área | Só a loja |
|
|
317
|
-
| Configuração | `basePath` e `assetPrefix` na zona, `rewrites` na loja |
|
|
351
|
+
| Configuração | `basePath` e `assetPrefix` na zona, `rewrites` na loja | Plugin na conta, `withVitral` na loja |
|
|
318
352
|
| Trocar de área | Recarrega a página (0,8 s no benchmark) | Sem recarregar (0,2 s) |
|
|
319
353
|
| React e Next | Baixados de novo em cada área | Uma cópia para a página toda |
|
|
320
354
|
| Layout da loja | Cada zona repete o seu | A conta fica dentro do layout da loja |
|
|
321
355
|
|
|
322
|
-
Guia completo, com SSR por rota e prefetch: [Migrar do Next.js Multi-Zones](https://joaogabriel15.github.io/vitral/migracao/multi-zones).
|
|
323
|
-
|
|
324
|
-
No App Router, o host usa `<Remote>` de `vitral/react` num componente `'use client'`. Exemplo em [Next.js](https://joaogabriel15.github.io/vitral/frameworks/next#host-com-app-router).
|
|
356
|
+
Guia completo, com SSR por rota e prefetch: [Migrar do Next.js Multi-Zones](https://joaogabriel15.github.io/vitral/migracao/multi-zones). No App Router, o host usa `<Remote>` de `vitral/react` num componente `'use client'`: veja [Next.js](https://joaogabriel15.github.io/vitral/frameworks/next#host-com-app-router).
|
|
325
357
|
|
|
326
358
|
## Nuxt como host
|
|
327
359
|
|
|
328
|
-
Exemplo: uma loja em Nuxt com a área "Catálogo", feita por outra equipe.
|
|
360
|
+
Exemplo: uma loja em Nuxt com a área "Catálogo", feita por outra equipe. Os dois lados abaixo têm os mesmos arquivos, na mesma ordem. Com vitral, a loja ganha dois arquivos novos no fim.
|
|
329
361
|
|
|
330
362
|
### Hoje, com dois apps Nuxt
|
|
331
363
|
|
|
332
|
-
A loja repassa as URLs de `/catalogo` para o app do catálogo.
|
|
333
|
-
|
|
334
364
|
```
|
|
335
365
|
loja/ app Nuxt principal
|
|
336
366
|
catalogo/ segundo app Nuxt
|
|
337
367
|
```
|
|
338
368
|
|
|
369
|
+
```vue
|
|
370
|
+
<!-- catalogo/app/pages/index.vue -->
|
|
371
|
+
<template>
|
|
372
|
+
<h1>Catálogo</h1>
|
|
373
|
+
</template>
|
|
374
|
+
```
|
|
375
|
+
|
|
339
376
|
```ts
|
|
340
377
|
// catalogo/nuxt.config.ts
|
|
341
378
|
export default defineNuxtConfig({
|
|
@@ -343,11 +380,6 @@ export default defineNuxtConfig({
|
|
|
343
380
|
})
|
|
344
381
|
```
|
|
345
382
|
|
|
346
|
-
```vue
|
|
347
|
-
<!-- catalogo/app/pages/index.vue -->
|
|
348
|
-
<template><h1>Catálogo</h1></template>
|
|
349
|
-
```
|
|
350
|
-
|
|
351
383
|
```ts
|
|
352
384
|
// loja/nuxt.config.ts
|
|
353
385
|
export default defineNuxtConfig({
|
|
@@ -365,28 +397,44 @@ export default defineNuxtConfig({
|
|
|
365
397
|
|
|
366
398
|
### O mesmo app com vitral
|
|
367
399
|
|
|
368
|
-
A loja continua sendo o único app Nuxt. O catálogo vira um remote: um projeto Vite com o mesmo componente.
|
|
369
|
-
|
|
370
400
|
```
|
|
371
401
|
loja/ app Nuxt (o host)
|
|
372
|
-
catalogo/
|
|
402
|
+
catalogo/ o mesmo componente, buildado com Vite (o remote)
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
```vue
|
|
406
|
+
<!-- catalogo/app/pages/index.vue (igual) -->
|
|
407
|
+
<template>
|
|
408
|
+
<h1>Catálogo</h1>
|
|
409
|
+
</template>
|
|
373
410
|
```
|
|
374
411
|
|
|
375
412
|
```js
|
|
376
|
-
// catalogo/vite.config.js (no lugar do
|
|
413
|
+
// catalogo/vite.config.js (no lugar do nuxt.config.ts)
|
|
377
414
|
import vue from '@vitejs/plugin-vue'
|
|
378
415
|
import vitral from 'vitral/vite'
|
|
379
416
|
|
|
380
|
-
export default {
|
|
417
|
+
export default {
|
|
418
|
+
plugins: [
|
|
419
|
+
vue(),
|
|
420
|
+
vitral({ name: 'catalogo', entry: 'app/pages/index.vue', dedupe: ['vue'] }),
|
|
421
|
+
],
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
// loja/nuxt.config.ts (sem o proxy)
|
|
427
|
+
export default defineNuxtConfig({})
|
|
381
428
|
```
|
|
382
429
|
|
|
383
430
|
```vue
|
|
384
|
-
<!--
|
|
385
|
-
<
|
|
431
|
+
<!-- loja/app/components/Menu.vue -->
|
|
432
|
+
<!-- <NuxtLink>: a troca é sem recarregar. -->
|
|
433
|
+
<NuxtLink to="/catalogo">Catálogo</NuxtLink>
|
|
386
434
|
```
|
|
387
435
|
|
|
388
436
|
```ts
|
|
389
|
-
// loja/app/plugins/vitral.client.ts (
|
|
437
|
+
// loja/app/plugins/vitral.client.ts (arquivo novo: registra o catálogo)
|
|
390
438
|
import * as Vue from 'vue'
|
|
391
439
|
import { configure } from 'vitral'
|
|
392
440
|
|
|
@@ -399,7 +447,7 @@ export default defineNuxtPlugin(() => {
|
|
|
399
447
|
```
|
|
400
448
|
|
|
401
449
|
```vue
|
|
402
|
-
<!-- loja/app/pages/catalogo.vue (arquivo novo: a página que mostra o catálogo) -->
|
|
450
|
+
<!-- loja/app/pages/catalogo/[...slug].vue (arquivo novo: a página da loja que mostra o catálogo) -->
|
|
403
451
|
<script setup lang="ts">
|
|
404
452
|
import { VitralRemote } from 'vitral/vue'
|
|
405
453
|
</script>
|
|
@@ -411,12 +459,6 @@ import { VitralRemote } from 'vitral/vue'
|
|
|
411
459
|
</template>
|
|
412
460
|
```
|
|
413
461
|
|
|
414
|
-
```vue
|
|
415
|
-
<!-- loja/app/components/Menu.vue -->
|
|
416
|
-
<!-- <NuxtLink> normal: a troca é sem recarregar. -->
|
|
417
|
-
<NuxtLink to="/catalogo">Catálogo</NuxtLink>
|
|
418
|
-
```
|
|
419
|
-
|
|
420
462
|
O servidor renderiza o `fallback` e o catálogo monta no navegador. Não precisa de `<ClientOnly>`.
|
|
421
463
|
|
|
422
464
|
### O que muda
|
package/dist/angular.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-UFETTKDP.js";
|
|
4
|
+
import "./chunk-JKTZODC5.js";
|
|
5
5
|
import {
|
|
6
6
|
defineRemote,
|
|
7
7
|
memoSelect,
|
|
8
8
|
same,
|
|
9
9
|
shared
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-I7IFR65H.js";
|
|
11
11
|
import {
|
|
12
12
|
configure
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-52D6ZT4A.js";
|
|
14
|
+
import "./chunk-QGAEXUP5.js";
|
|
15
|
+
import "./chunk-YDO7SPF4.js";
|
|
16
|
+
import "./chunk-VDVVEGAO.js";
|
|
17
17
|
import "./chunk-BQGVAXFM.js";
|
|
18
18
|
import "./chunk-JWDDXX5O.js";
|
|
19
19
|
import "./chunk-2Z4OH3BP.js";
|
package/dist/auto.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineVitralElement
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-UFETTKDP.js";
|
|
4
|
+
import "./chunk-JKTZODC5.js";
|
|
5
|
+
import "./chunk-I7IFR65H.js";
|
|
6
|
+
import "./chunk-52D6ZT4A.js";
|
|
7
|
+
import "./chunk-QGAEXUP5.js";
|
|
8
|
+
import "./chunk-YDO7SPF4.js";
|
|
9
|
+
import "./chunk-VDVVEGAO.js";
|
|
10
10
|
import "./chunk-BQGVAXFM.js";
|
|
11
11
|
import "./chunk-JWDDXX5O.js";
|
|
12
12
|
import "./chunk-2Z4OH3BP.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dedupeModule,
|
|
3
3
|
sriModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QGAEXUP5.js";
|
|
5
5
|
import {
|
|
6
6
|
prefetchCss
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YDO7SPF4.js";
|
|
8
8
|
import {
|
|
9
9
|
absolute,
|
|
10
10
|
addLink,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
pageOrigin,
|
|
14
14
|
withRetry,
|
|
15
15
|
withTimeout
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VDVVEGAO.js";
|
|
17
17
|
import {
|
|
18
18
|
RemoteError,
|
|
19
19
|
fail,
|
|
@@ -106,7 +106,7 @@ function loadRemote(name) {
|
|
|
106
106
|
return load(name).then((r) => r.module);
|
|
107
107
|
}
|
|
108
108
|
function loadModule(name) {
|
|
109
|
-
return import("./expose-
|
|
109
|
+
return import("./expose-KL6TA472.js").then((m) => m.resolveModule(name, (n) => loadFile(n))).catch(fail);
|
|
110
110
|
}
|
|
111
111
|
function preload(name, options = {}) {
|
|
112
112
|
const done = load(name);
|
|
@@ -146,7 +146,7 @@ function warmSsr(holder) {
|
|
|
146
146
|
}
|
|
147
147
|
function load(name, isolate, priority) {
|
|
148
148
|
const file = (n) => loadFile(n, isolate, priority);
|
|
149
|
-
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-
|
|
149
|
+
return (protocol().entry(name) || !name.includes("/") ? file(name).then((r) => mountable(name, r)) : import("./expose-KL6TA472.js").then((m) => m.resolveTarget(name, file))).catch(fail);
|
|
150
150
|
}
|
|
151
151
|
function loadFile(name, isolate, priority) {
|
|
152
152
|
const p = protocol();
|
|
@@ -195,7 +195,7 @@ async function resolveEntry(name, entry, priority, early) {
|
|
|
195
195
|
checkOrigin(name, entry.url);
|
|
196
196
|
const keys = signed(entry);
|
|
197
197
|
const m = entry.manifest ?? (new URL(entry.url).pathname.endsWith(".json") ? await (early ?? manifestOf(entry.url, name, priority, keys)) : { name, entry: entry.url });
|
|
198
|
-
if (m?.stable) return resolveEntry(name, await (await import("./channel-
|
|
198
|
+
if (m?.stable) return resolveEntry(name, await (await import("./channel-BHOVSU5X.js")).pick(name, entry, m), priority);
|
|
199
199
|
if (typeof m?.entry !== "string") throw new RemoteError("INVALID_MODULE", name, `manifesto inv\xE1lido em ${entry.url}`);
|
|
200
200
|
if (m.contract && (entry.contract || protocol().settings().contract)) {
|
|
201
201
|
const why = await (await import("./contract-3JY7SOGQ.js")).checkContract(m.contract, entry.contract);
|
|
@@ -251,9 +251,11 @@ function prefetchManifest(url, name, priority, keys) {
|
|
|
251
251
|
}
|
|
252
252
|
function manifestOf(url, name, priority, keys) {
|
|
253
253
|
const { timeout, maxStale } = protocol().settings();
|
|
254
|
-
const
|
|
254
|
+
const hinted = typeof document != "undefined" && [...document.querySelectorAll("link[as=fetch]")].some((l) => l.href == url);
|
|
255
|
+
const fresh = fetchJson(url, timeout, name, { ...!hinted && { cache: "no-cache" }, credentials: "same-origin", priority, integrity: keys.slice(1) });
|
|
255
256
|
return maxStale ? import("./stale-XV4LNHDX.js").then((m) => m.stale(url, fresh, maxStale), () => fresh) : fresh;
|
|
256
257
|
}
|
|
258
|
+
var plainFailed = /* @__PURE__ */ new Map();
|
|
257
259
|
async function importModule(name, r) {
|
|
258
260
|
const { timeout } = protocol().settings();
|
|
259
261
|
const run = (url) => withTimeout(timeout, name, import(
|
|
@@ -264,13 +266,18 @@ async function importModule(name, r) {
|
|
|
264
266
|
throw isRemoteError(e) ? e : new RemoteError("LOAD_FAILED", name, `falha ao importar ${r.entry}`, e);
|
|
265
267
|
});
|
|
266
268
|
if (!r.integrity) {
|
|
267
|
-
|
|
269
|
+
const n = plainFailed.get(r.entry);
|
|
270
|
+
const again = (e, next) => {
|
|
271
|
+
plainFailed.set(r.entry, next);
|
|
272
|
+
throw e;
|
|
273
|
+
};
|
|
274
|
+
if (n != null || !r.split) return run(n ? r.entry + (r.entry.includes("?") ? "&" : "?") + "vitral-retry=" + n : r.entry).catch((e) => again(e, (n ?? 0) + 1));
|
|
268
275
|
if (r.split.dedupe?.length) {
|
|
269
276
|
const { shared, planned } = await dedupeModule();
|
|
270
277
|
for (const d of planned(name, r.split).dedupe)
|
|
271
278
|
shared(protocol())(d.name, d.range, { version: d.version, url: d.file, load: async () => (await run(d.file)).default });
|
|
272
279
|
}
|
|
273
|
-
return run(r.split.entry);
|
|
280
|
+
return run(r.split.entry).catch((e) => again(e, 0));
|
|
274
281
|
}
|
|
275
282
|
const sri = await paths;
|
|
276
283
|
if (!sri) throw new RemoteError("LOAD_FAILED", name, "n\xE3o foi poss\xEDvel carregar o verificador de integrity");
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
loadFile,
|
|
4
4
|
registerSrc,
|
|
5
5
|
resolveEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-52D6ZT4A.js";
|
|
7
7
|
import {
|
|
8
8
|
injectStyles
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YDO7SPF4.js";
|
|
10
10
|
import {
|
|
11
11
|
metric
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VDVVEGAO.js";
|
|
13
13
|
import {
|
|
14
14
|
RemoteError,
|
|
15
15
|
fail,
|
|
@@ -87,7 +87,7 @@ var noop = () => {
|
|
|
87
87
|
async function checkUpdates() {
|
|
88
88
|
const p = protocol();
|
|
89
89
|
const found = [];
|
|
90
|
-
const { splitName } = await import("./expose-
|
|
90
|
+
const { splitName } = await import("./expose-KL6TA472.js");
|
|
91
91
|
const remotes = /* @__PURE__ */ new Map();
|
|
92
92
|
for (const name of live.keys()) {
|
|
93
93
|
const root = splitName(name)[0];
|
|
@@ -132,8 +132,8 @@ async function mountOnce(target, name, props, options) {
|
|
|
132
132
|
const p = protocol();
|
|
133
133
|
await p.pending();
|
|
134
134
|
const isolate = options.isolate ?? registered(name)?.isolate ?? p.settings().isolate;
|
|
135
|
-
if (isolate === "iframe") return (frames ?? (await import("./reframe-
|
|
136
|
-
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-
|
|
135
|
+
if (isolate === "iframe") return (frames ?? (await import("./reframe-AD2UEPIO.js")).noFrames)(target, name, props, options).catch(fail);
|
|
136
|
+
const { module: mod, ...resolved } = await (isolate == "reframe" ? (await import("./reframe-AD2UEPIO.js")).load : load)(name, isolate, options.priority);
|
|
137
137
|
const untrack = track(name, resolved);
|
|
138
138
|
ctxHooks.watch?.(name);
|
|
139
139
|
const label = resolved.name ?? name;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/core/bundled.ts
|
|
2
2
|
var bundled = {};
|
|
3
3
|
var dedupeModule = () => bundled.dedupe ? Promise.resolve(bundled.dedupe) : import("./dedupe-M63VMCWA.js");
|
|
4
|
-
var sriModule = () => bundled.sri ? Promise.resolve(bundled.sri) : import("./sri-
|
|
4
|
+
var sriModule = () => bundled.sri ? Promise.resolve(bundled.sri) : import("./sri-Z5U32IR2.js");
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
bundled,
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
hostSlot,
|
|
8
8
|
when
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JKTZODC5.js";
|
|
10
10
|
import {
|
|
11
11
|
defineRemote,
|
|
12
12
|
memoSelect,
|
|
13
13
|
same,
|
|
14
14
|
shared
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I7IFR65H.js";
|
|
16
16
|
import {
|
|
17
17
|
policy,
|
|
18
18
|
preload
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-52D6ZT4A.js";
|
|
20
20
|
import {
|
|
21
21
|
dedupeModule
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QGAEXUP5.js";
|
|
23
23
|
import {
|
|
24
24
|
events
|
|
25
25
|
} from "./chunk-EQZOJU3B.js";
|
|
@@ -137,6 +137,11 @@ function preload2(name, options) {
|
|
|
137
137
|
offerReact();
|
|
138
138
|
preload(name, options);
|
|
139
139
|
}
|
|
140
|
+
var defaultError = (retry) => /* @__PURE__ */ jsxs("div", { role: "alert", "data-vitral-default": "error", children: [
|
|
141
|
+
"N\xE3o foi poss\xEDvel carregar.",
|
|
142
|
+
" ",
|
|
143
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: retry, children: "Tentar de novo" })
|
|
144
|
+
] });
|
|
140
145
|
function Remote({
|
|
141
146
|
name,
|
|
142
147
|
src,
|
|
@@ -187,7 +192,7 @@ function Remote({
|
|
|
187
192
|
let dead = false;
|
|
188
193
|
let s = null;
|
|
189
194
|
if (holder) {
|
|
190
|
-
const go = () => import("./hydrate-
|
|
195
|
+
const go = () => import("./hydrate-LS3MLFGN.js").then((m) => {
|
|
191
196
|
if (!dead) slot.current = s = m.hydrateSlot(target.current, holder, { ...options, props: latest.current ?? {} });
|
|
192
197
|
});
|
|
193
198
|
const stop = policy() === "lazy" ? when(target.current, "visible", go) : (go(), () => {
|
|
@@ -211,7 +216,7 @@ function Remote({
|
|
|
211
216
|
const { status, error: err } = state;
|
|
212
217
|
return /* @__PURE__ */ jsxs("div", { className, "data-vitral": name ?? src, "data-vitral-status": status, children: [
|
|
213
218
|
status === "loading" && !html && !snapped && fallback,
|
|
214
|
-
status === "error" && err && (typeof error === "function" ? error(err, retry) : error
|
|
219
|
+
status === "error" && err && (error === void 0 ? defaultError(retry) : typeof error === "function" ? error(err, retry) : error),
|
|
215
220
|
html ? /* @__PURE__ */ jsx("div", { ref: target, dangerouslySetInnerHTML: { __html: html }, suppressHydrationWarning: true }) : /* @__PURE__ */ jsx("div", { ref: target })
|
|
216
221
|
] });
|
|
217
222
|
}
|