nuxt-tiff-provider 0.2.0 → 0.3.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 +5 -1
- package/dist/module.d.mts +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -3
- package/dist/runtime/provider.js +7 -3
- package/dist/runtime/register.client.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ export default defineNuxtConfig({
|
|
|
33
33
|
scope: '/', // Service Worker scope
|
|
34
34
|
autoRegister: true, // false → call registerTiffServiceWorker() yourself
|
|
35
35
|
retryRacedImages: true, // re-fetch images that raced the SW on first load
|
|
36
|
+
paramPrefix: 'tp', // query-param namespace + interception marker
|
|
36
37
|
},
|
|
37
38
|
})
|
|
38
39
|
```
|
|
@@ -44,4 +45,7 @@ export default defineNuxtConfig({
|
|
|
44
45
|
automatically once it does (disable with `retryRacedImages: false`).
|
|
45
46
|
- Already run your own Service Worker? Set `autoRegister: false` and
|
|
46
47
|
`importScripts('/tiff-sw.js')` inside it (see `@tiff-provider/core`).
|
|
47
|
-
- Sources must be same-origin or CORS-readable.
|
|
48
|
+
- Sources must be same-origin or CORS-readable (cross-origin needs CORS headers).
|
|
49
|
+
- The SW intercepts by the `tp=1` marker the provider adds, not by file extension,
|
|
50
|
+
so extension-less sources (e.g. an S3 key served as TIFF via `Content-Type`)
|
|
51
|
+
work too. Building a URL by hand? Add the marker with `buildTiffUrl` or `?tp=1`.
|
package/dist/module.d.mts
CHANGED
|
@@ -13,6 +13,8 @@ interface ModuleOptions {
|
|
|
13
13
|
autoRegister: boolean;
|
|
14
14
|
/** Re-request TIFF images that raced the SW on a cold load. Default true. */
|
|
15
15
|
retryRacedImages: boolean;
|
|
16
|
+
/** Query-param namespace for modifiers and the interception marker. Default 'tp'. */
|
|
17
|
+
paramPrefix: string;
|
|
16
18
|
}
|
|
17
19
|
declare const module$1: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
18
20
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -16,7 +16,8 @@ const module$1 = defineNuxtModule({
|
|
|
16
16
|
quality: 0.8,
|
|
17
17
|
scope: "/",
|
|
18
18
|
autoRegister: true,
|
|
19
|
-
retryRacedImages: true
|
|
19
|
+
retryRacedImages: true,
|
|
20
|
+
paramPrefix: "tp"
|
|
20
21
|
},
|
|
21
22
|
async setup(options, nuxt) {
|
|
22
23
|
const resolver = createResolver(import.meta.url);
|
|
@@ -26,7 +27,8 @@ const module$1 = defineNuxtModule({
|
|
|
26
27
|
providers: {
|
|
27
28
|
[options.providerName]: {
|
|
28
29
|
name: options.providerName,
|
|
29
|
-
provider: resolver.resolve("./runtime/provider")
|
|
30
|
+
provider: resolver.resolve("./runtime/provider"),
|
|
31
|
+
options: { paramPrefix: options.paramPrefix }
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -60,7 +62,8 @@ const module$1 = defineNuxtModule({
|
|
|
60
62
|
cacheName: options.cacheName,
|
|
61
63
|
quality: options.quality,
|
|
62
64
|
scope: options.scope,
|
|
63
|
-
retryRacedImages: options.retryRacedImages
|
|
65
|
+
retryRacedImages: options.retryRacedImages,
|
|
66
|
+
paramPrefix: options.paramPrefix
|
|
64
67
|
}
|
|
65
68
|
);
|
|
66
69
|
if (options.autoRegister) {
|
package/dist/runtime/provider.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { buildTiffUrl } from "@tiff-provider/core/url";
|
|
2
|
-
export const getImage = (src,
|
|
3
|
-
const {
|
|
4
|
-
|
|
2
|
+
export const getImage = (src, options = {}) => {
|
|
3
|
+
const {
|
|
4
|
+
modifiers = {},
|
|
5
|
+
baseURL = "",
|
|
6
|
+
paramPrefix
|
|
7
|
+
} = options;
|
|
8
|
+
return { url: buildTiffUrl(src, modifiers, baseURL, { prefix: paramPrefix }) };
|
|
5
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-tiff-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Nuxt module: render TIFFs via @nuxt/image off the main thread in a Service Worker.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@nuxt/image": "^1.11.0",
|
|
32
32
|
"@nuxt/kit": "^3.13.0",
|
|
33
33
|
"defu": "^6.1.0",
|
|
34
|
-
"@tiff-provider/core": "0.
|
|
34
|
+
"@tiff-provider/core": "0.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@nuxt/module-builder": "^1.0.0",
|