image-exporter 1.1.1 → 1.2.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 -81
- package/dist/capture/capture-element.d.ts +8 -0
- package/dist/capture/capture-element.d.ts.map +1 -0
- package/dist/capture/determine-total-elements.d.ts +9 -0
- package/dist/capture/determine-total-elements.d.ts.map +1 -0
- package/dist/capture/download-images.d.ts +10 -0
- package/dist/capture/download-images.d.ts.map +1 -0
- package/dist/capture/get-image-options.d.ts +15 -0
- package/dist/capture/get-image-options.d.ts.map +1 -0
- package/dist/capture/handle-filenames.d.ts +11 -0
- package/dist/capture/handle-filenames.d.ts.map +1 -0
- package/dist/capture/index.d.ts +10 -0
- package/dist/capture/index.d.ts.map +1 -0
- package/dist/capture/remove-hidden-elements.d.ts +2 -0
- package/dist/capture/remove-hidden-elements.d.ts.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/cors-proxy/cleanup.d.ts +7 -0
- package/dist/cors-proxy/cleanup.d.ts.map +1 -0
- package/dist/cors-proxy/index.d.ts +7 -0
- package/dist/cors-proxy/index.d.ts.map +1 -0
- package/dist/cors-proxy/is-valid-url.d.ts +7 -0
- package/dist/cors-proxy/is-valid-url.d.ts.map +1 -0
- package/dist/cors-proxy/proxy-css.d.ts +9 -0
- package/dist/cors-proxy/proxy-css.d.ts.map +1 -0
- package/dist/cors-proxy/proxy-images.d.ts +9 -0
- package/dist/cors-proxy/proxy-images.d.ts.map +1 -0
- package/dist/cors-proxy/run.d.ts +9 -0
- package/dist/cors-proxy/run.d.ts.map +1 -0
- package/dist/index.browser.js +40 -0
- package/dist/index.browser.js.map +84 -0
- package/dist/index.cjs +14878 -0
- package/dist/index.cjs.map +84 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14869 -0
- package/dist/index.js.map +83 -0
- package/dist/logger.d.ts +26 -0
- package/dist/logger.d.ts.map +1 -0
- package/package.json +19 -14
- package/.gitattributes +0 -2
- package/.prettierrc +0 -5
- package/bun.lockb +0 -0
- package/dist/image-exporter.es.js +0 -4532
- package/dist/image-exporter.umd.js +0 -4538
- package/src/capture/capture-element.ts +0 -79
- package/src/capture/determine-total-elements.ts +0 -40
- package/src/capture/download-images.ts +0 -115
- package/src/capture/get-image-options.ts +0 -207
- package/src/capture/handle-filenames.ts +0 -54
- package/src/capture/index.ts +0 -102
- package/src/capture/remove-hidden-elements.ts +0 -19
- package/src/config.ts +0 -19
- package/src/cors-proxy/cleanup.ts +0 -43
- package/src/cors-proxy/index.ts +0 -7
- package/src/cors-proxy/is-valid-url.ts +0 -22
- package/src/cors-proxy/proxy-css.ts +0 -48
- package/src/cors-proxy/proxy-images.ts +0 -34
- package/src/cors-proxy/run.ts +0 -26
- package/src/index.ts +0 -16
- package/src/logger.ts +0 -71
- package/src/types.d.ts +0 -51
- package/vite.config.js +0 -35
package/README.md
CHANGED
|
@@ -1,66 +1,122 @@
|
|
|
1
|
-
# image-exporter
|
|
1
|
+
# image-exporter
|
|
2
2
|
|
|
3
|
-
image-exporter
|
|
3
|
+
[](https://www.npmjs.com/package/image-exporter)
|
|
4
|
+
[](https://github.com/briantuckerdesign/image-exporter/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A client-side JavaScript tool that downloads DOM elements as images. It can be imported using your favorite package manager or attached directly to the window.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i image-exporter
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { capture } from "image-exporter";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
6
19
|
|
|
7
20
|
### Package
|
|
8
21
|
|
|
9
|
-
```
|
|
10
|
-
import
|
|
22
|
+
```typescript
|
|
23
|
+
import { capture } from "image-exporter";
|
|
11
24
|
|
|
12
|
-
const
|
|
25
|
+
const artboards = document.querySelectorAll(".artboard");
|
|
13
26
|
|
|
14
|
-
//
|
|
15
|
-
const images = capture(artboards, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
27
|
+
// Returns Image[] with { dataURL, fileName } for each image
|
|
28
|
+
const images = await capture(artboards, {
|
|
29
|
+
format: "png",
|
|
30
|
+
downloadImages: false,
|
|
31
|
+
});
|
|
19
32
|
```
|
|
20
33
|
|
|
21
34
|
### Browser
|
|
22
35
|
|
|
23
|
-
```
|
|
36
|
+
```html
|
|
24
37
|
<script src="your-path/image-exporter.umd.js" type="text/javascript"></script>
|
|
25
38
|
|
|
26
39
|
<div class="artboard">I will be downloaded.</div>
|
|
27
40
|
|
|
28
41
|
<script>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
const capture = window.imageExporter;
|
|
43
|
+
const artboards = document.querySelectorAll(".artboard");
|
|
44
|
+
|
|
45
|
+
// capture() is async and returns a Promise
|
|
46
|
+
capture(artboards).then((images) => {
|
|
47
|
+
console.log("Captured:", images);
|
|
48
|
+
});
|
|
32
49
|
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### `capture(elements, config?)`
|
|
55
|
+
|
|
56
|
+
Captures images from HTML elements.
|
|
33
57
|
|
|
58
|
+
**Parameters:**
|
|
59
|
+
|
|
60
|
+
- `elements` - `HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>` - Element(s) to capture
|
|
61
|
+
- `config` - `Partial<Config>` - Optional configuration object
|
|
62
|
+
|
|
63
|
+
**Returns:** `Promise<Image[] | null>` - Array of captured images, or `null` on error
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
interface Image {
|
|
67
|
+
dataURL: string;
|
|
68
|
+
fileName: string;
|
|
69
|
+
}
|
|
34
70
|
```
|
|
35
71
|
|
|
36
|
-
|
|
72
|
+
### `downloadImages(images, config?)`
|
|
73
|
+
|
|
74
|
+
Downloads previously captured images. Useful when `downloadImages: false` is set during capture.
|
|
37
75
|
|
|
38
|
-
|
|
76
|
+
```typescript
|
|
77
|
+
import { capture, downloadImages } from "image-exporter";
|
|
39
78
|
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
const images = await capture(elements, { downloadImages: false });
|
|
80
|
+
// ... do something with images ...
|
|
81
|
+
await downloadImages(images);
|
|
42
82
|
```
|
|
43
83
|
|
|
84
|
+
In the browser, this is available as `window.imageExporterDownload`.
|
|
85
|
+
|
|
44
86
|
## Config
|
|
45
87
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
88
|
+
Config options are passed to the `capture` function. Image options (label, format, scale, quality, includeScaleInLabel) can also be set at the config level as defaults.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface Config {
|
|
92
|
+
/** Download images as files upon capture. Default: true */
|
|
93
|
+
downloadImages: boolean;
|
|
94
|
+
/** Default label for images. Does not include file extension or scale. Default: "image" */
|
|
95
|
+
defaultImageLabel: string;
|
|
96
|
+
/** Label for zip file. Does not include file extension or scale. Default: "images" */
|
|
97
|
+
zipLabel: string;
|
|
98
|
+
/** Base URL for CORS proxy used when fetching external images. Default: "" */
|
|
99
|
+
corsProxyBaseUrl: string;
|
|
100
|
+
/** Enable window logging for use by external scripts. Default: true */
|
|
101
|
+
enableWindowLogging: boolean;
|
|
102
|
+
/** Logging level for debugging. Default: "none" */
|
|
103
|
+
loggingLevel: "none" | "info" | "error" | "verbose";
|
|
104
|
+
|
|
105
|
+
// Default image options (can be overridden per-element)
|
|
106
|
+
/** Default: "image" */
|
|
107
|
+
label: string;
|
|
108
|
+
/** Default: "jpg" */
|
|
109
|
+
format: "jpg" | "png" | "svg" | "webp";
|
|
110
|
+
/** Default: 1 */
|
|
111
|
+
scale: number | number[];
|
|
112
|
+
/** Default: 1 */
|
|
113
|
+
quality: number;
|
|
114
|
+
/** Default: false */
|
|
115
|
+
includeScaleInLabel: boolean;
|
|
60
116
|
}
|
|
61
117
|
```
|
|
62
118
|
|
|
63
|
-
### CORS
|
|
119
|
+
### CORS Proxy
|
|
64
120
|
|
|
65
121
|
If your capture elements have externally hosted images or CSS inside them, you will likely hit a [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) error.
|
|
66
122
|
|
|
@@ -70,69 +126,65 @@ I recommend [cors-proxy-worker](https://github.com/briantuckerdesign/cors-proxy-
|
|
|
70
126
|
|
|
71
127
|
Example: `https://example-cors-proxy.com/` -> `https://example-cors-proxy.com/https%3A%2F%2FmyEncodedUrl.com`
|
|
72
128
|
|
|
73
|
-
## Image
|
|
74
|
-
|
|
75
|
-
Image options can
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
129
|
+
## Image Options
|
|
130
|
+
|
|
131
|
+
Image options can be set per-element using data attributes, or as defaults in the config.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface ImageOptions {
|
|
135
|
+
/** Label for image. Does not include file extension or scale. */
|
|
136
|
+
label: string;
|
|
137
|
+
/** File format. */
|
|
138
|
+
format: "jpg" | "png" | "svg" | "webp";
|
|
139
|
+
/** Scale of image. Can be a number or an array of numbers. */
|
|
140
|
+
scale: number | number[];
|
|
141
|
+
/** Quality of image. 0.0 to 1.0, only applies to jpg. */
|
|
142
|
+
quality: number;
|
|
143
|
+
/** Include scale in label. Automatically true if scale is an array. */
|
|
144
|
+
includeScaleInLabel: boolean;
|
|
89
145
|
}
|
|
90
146
|
```
|
|
91
147
|
|
|
92
|
-
###
|
|
93
|
-
|
|
94
|
-
Image options are set on the element itself using data attributes.
|
|
148
|
+
### Data Attributes
|
|
95
149
|
|
|
96
|
-
|
|
150
|
+
Set image options on elements using these data attributes:
|
|
97
151
|
|
|
98
|
-
|
|
99
|
-
data-
|
|
100
|
-
data-
|
|
101
|
-
data-
|
|
102
|
-
data-
|
|
103
|
-
data-include-scale-in-label
|
|
104
|
-
```
|
|
152
|
+
- `data-label`
|
|
153
|
+
- `data-format`
|
|
154
|
+
- `data-scale`
|
|
155
|
+
- `data-quality`
|
|
156
|
+
- `data-include-scale-in-label`
|
|
105
157
|
|
|
106
158
|
#### Example
|
|
107
159
|
|
|
108
|
-
```
|
|
160
|
+
```html
|
|
109
161
|
<div
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
162
|
+
data-label="My custom label"
|
|
163
|
+
data-format="jpg"
|
|
164
|
+
data-scale="1,2"
|
|
165
|
+
data-quality="0.8"
|
|
166
|
+
data-include-scale-in-label="true"
|
|
167
|
+
>
|
|
168
|
+
I will be downloaded at @1x and @2x with a custom label, quality of 0.8, as a JPG, with
|
|
169
|
+
scale in the filename.
|
|
116
170
|
</div>
|
|
117
171
|
```
|
|
118
172
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Config options are set in the `config` object passed to the `capture` function.
|
|
122
|
-
|
|
123
|
-
#### Example
|
|
124
|
-
|
|
125
|
-
```HTML
|
|
173
|
+
```html
|
|
126
174
|
<div class="artboard" data-scale="1,2">I will be downloaded at @1x and @2x.</div>
|
|
127
|
-
<div class="artboard" data-format="jpg" data-quality="0.8">
|
|
175
|
+
<div class="artboard" data-format="jpg" data-quality="0.8">
|
|
176
|
+
I will be a compressed JPG.
|
|
177
|
+
</div>
|
|
128
178
|
```
|
|
129
179
|
|
|
130
|
-
## Built
|
|
131
|
-
|
|
132
|
-
- [`modern-screenshot`](https://github.com/qq15725/modern-screenshot/tree/main)
|
|
180
|
+
## Built Using
|
|
133
181
|
|
|
182
|
+
- [`modern-screenshot`](https://github.com/qq15725/modern-screenshot)
|
|
134
183
|
- [`jszip`](https://github.com/Stuk/jszip)
|
|
135
|
-
|
|
136
184
|
- [`downloadjs`](https://github.com/rndme/download)
|
|
137
185
|
|
|
138
|
-
Bundled
|
|
186
|
+
Bundled with Vite and written in TypeScript.
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
ISC License - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Image, ParsedImageOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* captureElement
|
|
4
|
+
*
|
|
5
|
+
* Captures an image from an HTML element and returns it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function captureElement(element: HTMLElement, imageOptions: ParsedImageOptions, filenames: string[]): Promise<Image>;
|
|
8
|
+
//# sourceMappingURL=capture-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-element.d.ts","sourceRoot":"","sources":["../../src/capture/capture-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIrD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,kBAAkB,EAChC,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,KAAK,CAAC,CAwDhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* determineTotalElements
|
|
3
|
+
*
|
|
4
|
+
* Just used for progress logging to show progress of all element captures.
|
|
5
|
+
*
|
|
6
|
+
* This emcompasses multi-scale captures unlike elements.length.
|
|
7
|
+
*/
|
|
8
|
+
export declare function determineTotalElements(elements: HTMLElement[] | NodeListOf<HTMLElement>): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=determine-total-elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-total-elements.d.ts","sourceRoot":"","sources":["../../src/capture/determine-total-elements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Config, Image } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* downloadImages
|
|
4
|
+
*
|
|
5
|
+
* If one image is provided, it will be downloaded as a file.
|
|
6
|
+
*
|
|
7
|
+
* If multiple images are provided, they will be zipped and downloaded as a file.
|
|
8
|
+
*/
|
|
9
|
+
export declare function downloadImages(images: Image[], userConfig?: Config): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=download-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-images.d.ts","sourceRoot":"","sources":["../../src/capture/download-images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAS,MAAM,UAAU,CAAC;AAKhD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,KAAK,EAAE,EACf,UAAU,GAAE,MAAsB,iBAcnC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Config, ImageOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the image options for the given element or configuration.
|
|
4
|
+
*
|
|
5
|
+
* Data attributes:
|
|
6
|
+
* - data-label: string
|
|
7
|
+
* - data-format: "jpg" | "png" | "svg"
|
|
8
|
+
* - data-scale: number | number[]
|
|
9
|
+
* - data-quality: number
|
|
10
|
+
* - data-include-scale-in-label: boolean
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<ImageOptions>} - The parsed image options.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getImageOptions(element: HTMLElement, config: Config): Promise<ImageOptions>;
|
|
15
|
+
//# sourceMappingURL=get-image-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-image-options.d.ts","sourceRoot":"","sources":["../../src/capture/get-image-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAEN,YAAY,EAGb,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CAqLvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageOptions, Label } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Handles the generation of unique filenames based on a proposed filename and an array of existing filenames.
|
|
4
|
+
*
|
|
5
|
+
* If the proposed filename is unique, it is added to the filenames array and returned as-is.
|
|
6
|
+
* If the proposed filename is not unique, the function will check if it already ends with a "-n" pattern.
|
|
7
|
+
* If it does, the function will increment the number until a unique filename is found.
|
|
8
|
+
* If it doesn't, the function will start with "-2" and increment the number until a unique filename is found.
|
|
9
|
+
*/
|
|
10
|
+
export declare function handleFileNames(imageOptions: ImageOptions, filenames: string[]): Label;
|
|
11
|
+
//# sourceMappingURL=handle-filenames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-filenames.d.ts","sourceRoot":"","sources":["../../src/capture/handle-filenames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CA2CtF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Config, Image } from "../types";
|
|
2
|
+
export declare let windowLogging: boolean;
|
|
3
|
+
export declare let loggingLevel: string;
|
|
4
|
+
/**
|
|
5
|
+
* capture
|
|
6
|
+
*
|
|
7
|
+
* Captures images from HTML elements and returns them or downloads them.
|
|
8
|
+
*/
|
|
9
|
+
export declare function capture(elements: HTMLElement[] | NodeListOf<HTMLElement> | HTMLElement, userConfig?: Partial<Config>): Promise<Image[] | null>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capture/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAsB,MAAM,UAAU,CAAC;AAO7D,eAAO,IAAI,aAAa,SAAO,CAAC;AAChC,eAAO,IAAI,YAAY,QAAS,CAAC;AAEjC;;;;GAIG;AACH,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW,EAC/D,UAAU,GAAE,OAAO,CAAC,MAAM,CAAiB,GAC1C,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAgFzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-hidden-elements.d.ts","sourceRoot":"","sources":["../../src/capture/remove-hidden-elements.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,GAChD,WAAW,EAAE,CAGf"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,mBAAmB,EAAE,YAMjC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAQ3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/cleanup.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,wBAAsB,gBAAgB,kBAGrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,eAAO,MAAM,SAAS;;;CAGrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-valid-url.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/is-valid-url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAgBlD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* proxyCSS
|
|
4
|
+
*
|
|
5
|
+
* Proxies all linked CSS files and the absolute URLs inside them, including fonts and images.
|
|
6
|
+
* Upon completion of capture, the links will be restored and the style elements removed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function proxyCSS(config: Config): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=proxy-css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-css.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/proxy-css.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,iBAqC5C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* proxyImages
|
|
4
|
+
*
|
|
5
|
+
* Proxies all images inside capture elements.
|
|
6
|
+
* The original src is stored for later restoration.
|
|
7
|
+
*/
|
|
8
|
+
export declare function proxyImages(config: Config, elements: HTMLElement[] | NodeListOf<HTMLElement>): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=proxy-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-images.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/proxy-images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,iBAqBlD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* runCorsProxy
|
|
4
|
+
*
|
|
5
|
+
* Proxies all images inside capture elements, as well as all linked CSS files and the absolute URLs inside them.
|
|
6
|
+
* Upon completion of capture, these will be reverted to their original state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runCorsProxy(config: Config, elements: HTMLElement[] | NodeListOf<HTMLElement>): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cors-proxy/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,GAChD,OAAO,CAAC,IAAI,CAAC,CAUf"}
|