nuxt-studio 1.0.0-alpha.0 → 1.0.0-alpha.2
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 +11 -9
- package/dist/app/en-CeGQDKH5.js +7 -0
- package/dist/app/en-D0jd_r21.js +7 -0
- package/dist/app/en-XbfkDcMn.js +7 -0
- package/dist/app/fr-CbcFrmHX.js +7 -0
- package/dist/app/fr-Ct4HO5e1.js +7 -0
- package/dist/app/fr-ILHmVnG9.js +7 -0
- package/dist/app/main.d.ts +83 -33
- package/dist/app/main.js +34187 -30512
- package/dist/app/service-worker.js +29 -5
- package/dist/app/shared-B6H2zqDG.js +8 -0
- package/dist/app/{shared-D04791PA.js → shared-DLETHbvn.js} +2311 -2307
- package/dist/app/{shared-DI6F-ifc.js → shared-Dvm_mWyG.js} +3120 -3132
- package/dist/app/shared.d.ts +1 -20
- package/dist/app/shared.js +2 -4
- package/dist/module/module.d.mts +70 -27
- package/dist/module/module.json +1 -1
- package/dist/module/module.mjs +101 -58
- package/dist/module/runtime/host.dev.js +19 -12
- package/dist/module/runtime/host.js +124 -61
- package/dist/module/runtime/plugins/studio.client.js +1 -1
- package/dist/module/runtime/server/routes/admin.js +11 -2
- package/dist/module/runtime/server/routes/auth/github.get.d.ts +4 -4
- package/dist/module/runtime/server/routes/auth/github.get.js +17 -9
- package/dist/module/runtime/server/routes/auth/gitlab.get.d.ts +55 -0
- package/dist/module/runtime/server/routes/auth/gitlab.get.js +157 -0
- package/dist/module/runtime/server/routes/auth/session.delete.js +2 -1
- package/dist/module/runtime/server/routes/auth/session.get.js +4 -1
- package/dist/module/runtime/server/routes/dev/content/[...path].js +0 -11
- package/dist/module/runtime/server/routes/dev/public/[...path].d.ts +1 -0
- package/dist/module/runtime/server/routes/dev/public/[...path].js +2 -0
- package/dist/module/runtime/types/content.d.ts +6 -0
- package/dist/module/runtime/types/content.js +7 -0
- package/dist/module/runtime/utils/activation.js +16 -5
- package/dist/module/runtime/utils/collection.d.ts +10 -17
- package/dist/module/runtime/utils/collection.js +32 -92
- package/dist/module/runtime/utils/document.d.ts +15 -0
- package/dist/module/runtime/utils/document.js +288 -0
- package/dist/module/runtime/utils/media.d.ts +1 -0
- package/dist/module/runtime/utils/media.js +5 -0
- package/dist/module/runtime/utils/object.d.ts +4 -0
- package/dist/module/runtime/utils/object.js +27 -0
- package/dist/module/runtime/utils/source.d.ts +11 -0
- package/dist/module/runtime/utils/source.js +36 -0
- package/license.md +9 -0
- package/package.json +7 -6
- package/dist/app/shared-R5zYJ3Dl.js +0 -25803
- package/dist/app/utils-DI6F-ifc.js +0 -25774
- package/dist/app/utils.d.ts +0 -22
- package/dist/app/utils.js +0 -6
|
@@ -19,6 +19,31 @@ const IMAGE_EXTENSIONS = [
|
|
|
19
19
|
'gif',
|
|
20
20
|
]
|
|
21
21
|
|
|
22
|
+
function extractImagePath(url) {
|
|
23
|
+
const pathname = url.pathname;
|
|
24
|
+
if (pathname.startsWith('/_ipx/_/')) {
|
|
25
|
+
return pathname.replace('/_ipx/_', '')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (pathname.startsWith('/_vercel/image')) {
|
|
29
|
+
return url.searchParams.get('url') || null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (IMAGE_EXTENSIONS.includes(pathname.split('.').pop())) {
|
|
33
|
+
return pathname
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
self.addEventListener('install', event => {
|
|
40
|
+
self.skipWaiting()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
self.addEventListener('activate', event => {
|
|
44
|
+
event.waitUntil(self.clients.claim())
|
|
45
|
+
})
|
|
46
|
+
|
|
22
47
|
self.addEventListener('fetch', event => {
|
|
23
48
|
const url = new URL(event.request.url);
|
|
24
49
|
const isSameDomain = url.origin === self.location.origin;
|
|
@@ -27,19 +52,18 @@ self.addEventListener('fetch', event => {
|
|
|
27
52
|
return event.respondWith(fetch(event.request));
|
|
28
53
|
}
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
const imageUrl = extractImagePath(url);
|
|
56
|
+
if (imageUrl) {
|
|
57
|
+
return event.respondWith(fetchFromIndexedDB(event, imageUrl));
|
|
32
58
|
}
|
|
33
59
|
|
|
34
60
|
event.respondWith(fetch(event.request))
|
|
35
61
|
})
|
|
36
62
|
|
|
37
63
|
function fetchFromIndexedDB(event, url) {
|
|
38
|
-
|
|
39
|
-
const dbKey = ['public-assets:', url.pathname.replace(/^\\/+(_ipx\\/_\\/)?/, '').replace('/', ':')].join('')
|
|
64
|
+
const dbKey = url.replace(/^\\//g, '').replace(/\\//g, ':')
|
|
40
65
|
return getData(dbKey).then(data => {
|
|
41
66
|
if (!data) {
|
|
42
|
-
console.log('No data found in IndexedDB:', url.pathname, dbKey);
|
|
43
67
|
return fetch(event.request);
|
|
44
68
|
}
|
|
45
69
|
|