@solidnative-dev/images 0.0.0-stage → 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +47 -2
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +219 -0
- package/dist/index.js.map +1 -0
- package/dist/react-native-adapter.d.ts +19 -0
- package/dist/react-native-adapter.d.ts.map +1 -0
- package/dist/react-native-adapter.js +79 -0
- package/dist/react-native-adapter.js.map +1 -0
- package/dist/react-native.d.ts +6 -0
- package/dist/react-native.d.ts.map +1 -0
- package/dist/react-native.js +30 -0
- package/dist/react-native.js.map +1 -0
- package/dist/solid.d.ts +14 -0
- package/dist/solid.d.ts.map +1 -0
- package/dist/solid.js +128 -0
- package/dist/solid.js.map +1 -0
- package/package.json +51 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Solid Native contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@solidnative-dev/images`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Validated image metadata, prefetch, and cache inspection for Solid Native. The
|
|
4
|
+
React Native adapter resolves the pinned 0.87 `ImageLoader` TurboModule directly
|
|
5
|
+
without evaluating React Native's platform Image facade or generated JavaScript
|
|
6
|
+
specs.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { createReactNativeImageService } from "@solidnative-dev/images/react-native";
|
|
10
|
+
import { createImageController } from "@solidnative-dev/images/solid";
|
|
11
|
+
|
|
12
|
+
const images = createImageController(createReactNativeImageService());
|
|
13
|
+
const dimensions = await images.getDimensions({
|
|
14
|
+
uri: "https://images.example/hero.png",
|
|
15
|
+
headers: { Authorization: "Bearer …" },
|
|
16
|
+
});
|
|
17
|
+
await images.prefetch("https://images.example/hero.png");
|
|
18
|
+
const cache = await images.queryCache(["https://images.example/hero.png"]);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The public service normalizes React Native's incompatible native ABIs: Android
|
|
22
|
+
returns an object from `getSize` and requires a signed 32-bit prefetch request
|
|
23
|
+
identifier, while iOS returns a width/height tuple and accepts no identifier.
|
|
24
|
+
Prefetch handles cancel native work on Android. React Native 0.87 has no iOS
|
|
25
|
+
cancellation primitive, so iOS cancellation rejects immediately and ignores the
|
|
26
|
+
late native settlement.
|
|
27
|
+
|
|
28
|
+
URIs, header names and values, query cardinality, native dimensions, prefetch
|
|
29
|
+
results, and cache states are bounded and validated. Cache queries preserve
|
|
30
|
+
caller order and duplicates while deduplicating native work, and every URI gets
|
|
31
|
+
an explicit `memory`, `disk`, `disk/memory`, or `none` result. The Solid
|
|
32
|
+
controller rejects pending work on owner disposal and causally traces successful
|
|
33
|
+
settlements without recording URIs or request headers.
|
|
34
|
+
|
|
35
|
+
Run the physical Android Release gate on one attached, unlocked device with:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
pnpm --filter @solidnative-dev/native-e2e android:images:test
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The gate proves an authenticated dimension request at its local HTTP server,
|
|
42
|
+
an initially absent URI becoming natively cached after prefetch, ordered cache
|
|
43
|
+
results that do not trigger network work, explicit transport cancellation, and
|
|
44
|
+
transport cancellation caused by Solid owner disposal. Dimension, prefetch,
|
|
45
|
+
and cache-query settlements must retain their privacy-safe causal Solid commit.
|
|
46
|
+
Success is withheld until the Fabric surface stops and the process, APKs, and
|
|
47
|
+
temporary `adb reverse` tunnel are gone. iOS remains Release-compiled and
|
|
48
|
+
awaits equivalent physical metadata and cache coverage.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const IMAGE_MAX_URI_LENGTH = 8192;
|
|
2
|
+
export declare const IMAGE_MAX_HEADER_COUNT = 128;
|
|
3
|
+
export declare const IMAGE_MAX_HEADER_NAME_LENGTH = 256;
|
|
4
|
+
export declare const IMAGE_MAX_HEADER_VALUE_LENGTH = 8192;
|
|
5
|
+
export declare const IMAGE_MAX_HEADER_CHARACTERS = 65536;
|
|
6
|
+
export declare const IMAGE_MAX_CACHE_QUERY_URIS = 256;
|
|
7
|
+
export declare const IMAGE_MAX_DIMENSION = 1000000;
|
|
8
|
+
export type ImagePlatform = "android" | "ios";
|
|
9
|
+
export type ImageCacheLocation = "memory" | "disk" | "disk/memory";
|
|
10
|
+
export interface ImageRequest {
|
|
11
|
+
readonly uri: string;
|
|
12
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
13
|
+
}
|
|
14
|
+
export interface NormalizedImageRequest {
|
|
15
|
+
readonly uri: string;
|
|
16
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
export interface ImageDimensions {
|
|
19
|
+
readonly width: number;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ImageCacheEntry {
|
|
23
|
+
readonly uri: string;
|
|
24
|
+
readonly location: ImageCacheLocation | "none";
|
|
25
|
+
}
|
|
26
|
+
export interface ImageAdapter {
|
|
27
|
+
readonly platform: ImagePlatform;
|
|
28
|
+
getDimensions(request: NormalizedImageRequest): Promise<unknown>;
|
|
29
|
+
prefetchImage(uri: string, requestId: number): Promise<unknown>;
|
|
30
|
+
cancelPrefetch(requestId: number): void;
|
|
31
|
+
queryCache(uris: readonly string[]): Promise<unknown>;
|
|
32
|
+
}
|
|
33
|
+
export interface ImagePrefetchHandle {
|
|
34
|
+
readonly result: Promise<void>;
|
|
35
|
+
cancel(): void;
|
|
36
|
+
}
|
|
37
|
+
export interface ImageService {
|
|
38
|
+
readonly platform: ImagePlatform;
|
|
39
|
+
getDimensions(request: string | ImageRequest): Promise<ImageDimensions>;
|
|
40
|
+
prefetch(uri: string): ImagePrefetchHandle;
|
|
41
|
+
queryCache(uris: readonly string[]): Promise<readonly ImageCacheEntry[]>;
|
|
42
|
+
}
|
|
43
|
+
export declare class ImagePrefetchCancelledError extends Error {
|
|
44
|
+
constructor();
|
|
45
|
+
}
|
|
46
|
+
/** Validates requests and every untrusted native asynchronous settlement. */
|
|
47
|
+
export declare function createImageService(adapterValue: ImageAdapter): ImageService;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,e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OAAO,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACxE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;IAC3C,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;CAC1E;AAED,qBAAa,2BAA4B,SAAQ,KAAK;;CAKrD;AAyJD,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CAgH3E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
export const IMAGE_MAX_URI_LENGTH = 8_192;
|
|
2
|
+
export const IMAGE_MAX_HEADER_COUNT = 128;
|
|
3
|
+
export const IMAGE_MAX_HEADER_NAME_LENGTH = 256;
|
|
4
|
+
export const IMAGE_MAX_HEADER_VALUE_LENGTH = 8_192;
|
|
5
|
+
export const IMAGE_MAX_HEADER_CHARACTERS = 65_536;
|
|
6
|
+
export const IMAGE_MAX_CACHE_QUERY_URIS = 256;
|
|
7
|
+
export const IMAGE_MAX_DIMENSION = 1_000_000;
|
|
8
|
+
export class ImagePrefetchCancelledError extends Error {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("The image prefetch was cancelled.");
|
|
11
|
+
this.name = "ImagePrefetchCancelledError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function plainRecord(value, path) {
|
|
15
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
16
|
+
throw new TypeError(`${path} must be a plain object.`);
|
|
17
|
+
}
|
|
18
|
+
const prototype = Object.getPrototypeOf(value);
|
|
19
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
20
|
+
throw new TypeError(`${path} must be a plain object.`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
function imageURI(value, path) {
|
|
25
|
+
if (typeof value !== "string" ||
|
|
26
|
+
value.length === 0 ||
|
|
27
|
+
value.length > IMAGE_MAX_URI_LENGTH ||
|
|
28
|
+
/[\u0000-\u001f\u007f]/u.test(value) ||
|
|
29
|
+
!/^[A-Za-z][A-Za-z\d+.-]*:/u.test(value)) {
|
|
30
|
+
throw new TypeError(`${path} must be a 1-${IMAGE_MAX_URI_LENGTH} character absolute URI without ASCII control characters.`);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
function normalizeHeaders(value) {
|
|
35
|
+
if (value === undefined)
|
|
36
|
+
return undefined;
|
|
37
|
+
const source = plainRecord(value, "Image headers");
|
|
38
|
+
const entries = Object.entries(source);
|
|
39
|
+
if (entries.length > IMAGE_MAX_HEADER_COUNT) {
|
|
40
|
+
throw new RangeError(`Image headers must contain at most ${IMAGE_MAX_HEADER_COUNT} entries.`);
|
|
41
|
+
}
|
|
42
|
+
let totalLength = 0;
|
|
43
|
+
const headers = {};
|
|
44
|
+
for (const [name, rawValue] of entries) {
|
|
45
|
+
if (name.length === 0 ||
|
|
46
|
+
name.length > IMAGE_MAX_HEADER_NAME_LENGTH ||
|
|
47
|
+
!/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u.test(name)) {
|
|
48
|
+
throw new TypeError(`Image header names must be 1-${IMAGE_MAX_HEADER_NAME_LENGTH} character HTTP tokens.`);
|
|
49
|
+
}
|
|
50
|
+
if (typeof rawValue !== "string" ||
|
|
51
|
+
rawValue.length > IMAGE_MAX_HEADER_VALUE_LENGTH ||
|
|
52
|
+
/[\u0000\r\n]/u.test(rawValue)) {
|
|
53
|
+
throw new TypeError(`Image header ${name} must be a string of at most ${IMAGE_MAX_HEADER_VALUE_LENGTH} characters without null bytes or line breaks.`);
|
|
54
|
+
}
|
|
55
|
+
totalLength += name.length + rawValue.length;
|
|
56
|
+
Object.defineProperty(headers, name, {
|
|
57
|
+
configurable: false,
|
|
58
|
+
enumerable: true,
|
|
59
|
+
value: rawValue,
|
|
60
|
+
writable: false,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (totalLength > IMAGE_MAX_HEADER_CHARACTERS) {
|
|
64
|
+
throw new RangeError(`Image headers must contain at most ${IMAGE_MAX_HEADER_CHARACTERS} total characters.`);
|
|
65
|
+
}
|
|
66
|
+
return Object.freeze(headers);
|
|
67
|
+
}
|
|
68
|
+
function normalizeRequest(value) {
|
|
69
|
+
if (typeof value === "string") {
|
|
70
|
+
return Object.freeze({ uri: imageURI(value, "Image URI") });
|
|
71
|
+
}
|
|
72
|
+
const request = plainRecord(value, "Image request");
|
|
73
|
+
const uri = imageURI(request.uri, "Image request URI");
|
|
74
|
+
const headers = normalizeHeaders(request.headers);
|
|
75
|
+
return Object.freeze({
|
|
76
|
+
uri,
|
|
77
|
+
...(headers === undefined ? {} : { headers }),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function dimensions(value) {
|
|
81
|
+
const candidate = plainRecord(value, "Native image dimensions");
|
|
82
|
+
for (const key of ["width", "height"]) {
|
|
83
|
+
const dimension = candidate[key];
|
|
84
|
+
if (typeof dimension !== "number" ||
|
|
85
|
+
!Number.isFinite(dimension) ||
|
|
86
|
+
dimension <= 0 ||
|
|
87
|
+
dimension > IMAGE_MAX_DIMENSION) {
|
|
88
|
+
throw new TypeError(`Native image ${key} must be a finite number greater than 0 and at most ${IMAGE_MAX_DIMENSION}.`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return Object.freeze({
|
|
92
|
+
width: candidate.width,
|
|
93
|
+
height: candidate.height,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function cacheLocation(value, uri) {
|
|
97
|
+
if (value === "memory" || value === "disk" || value === "disk/memory") {
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
throw new TypeError(`Native image cache returned an invalid state for ${uri}.`);
|
|
101
|
+
}
|
|
102
|
+
function normalizeCacheURIs(value) {
|
|
103
|
+
if (!Array.isArray(value) || value.length > IMAGE_MAX_CACHE_QUERY_URIS) {
|
|
104
|
+
throw new TypeError(`Image cache queries must be arrays containing at most ${IMAGE_MAX_CACHE_QUERY_URIS} URIs.`);
|
|
105
|
+
}
|
|
106
|
+
return Object.freeze(value.map((uri, index) => imageURI(uri, `Image cache URI ${index}`)));
|
|
107
|
+
}
|
|
108
|
+
function validateAdapter(value) {
|
|
109
|
+
const candidate = plainRecord(value, "Image adapter");
|
|
110
|
+
if (candidate.platform !== "android" && candidate.platform !== "ios") {
|
|
111
|
+
throw new TypeError("Image adapter platform must be android or ios.");
|
|
112
|
+
}
|
|
113
|
+
if (typeof candidate.getDimensions !== "function" ||
|
|
114
|
+
typeof candidate.prefetchImage !== "function" ||
|
|
115
|
+
typeof candidate.cancelPrefetch !== "function" ||
|
|
116
|
+
typeof candidate.queryCache !== "function") {
|
|
117
|
+
throw new TypeError("Image adapter must provide getDimensions(), prefetchImage(), cancelPrefetch(), and queryCache().");
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
/** Validates requests and every untrusted native asynchronous settlement. */
|
|
122
|
+
export function createImageService(adapterValue) {
|
|
123
|
+
const adapter = validateAdapter(adapterValue);
|
|
124
|
+
const activeRequestIds = new Set();
|
|
125
|
+
let nextRequestId = 1;
|
|
126
|
+
const allocateRequestId = () => {
|
|
127
|
+
for (let attempts = 0; attempts < 2_147_483_647; attempts++) {
|
|
128
|
+
const candidate = nextRequestId;
|
|
129
|
+
nextRequestId = candidate === 2_147_483_647 ? 1 : candidate + 1;
|
|
130
|
+
if (!activeRequestIds.has(candidate)) {
|
|
131
|
+
activeRequestIds.add(candidate);
|
|
132
|
+
return candidate;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
throw new Error("No image prefetch request identifiers are available.");
|
|
136
|
+
};
|
|
137
|
+
return Object.freeze({
|
|
138
|
+
platform: adapter.platform,
|
|
139
|
+
async getDimensions(request) {
|
|
140
|
+
return dimensions(await adapter.getDimensions(normalizeRequest(request)));
|
|
141
|
+
},
|
|
142
|
+
prefetch(rawURI) {
|
|
143
|
+
const uri = imageURI(rawURI, "Image prefetch URI");
|
|
144
|
+
const requestId = allocateRequestId();
|
|
145
|
+
let active = true;
|
|
146
|
+
let nativeStarted = false;
|
|
147
|
+
let resolveResult;
|
|
148
|
+
let rejectResult;
|
|
149
|
+
const result = new Promise((resolve, reject) => {
|
|
150
|
+
resolveResult = resolve;
|
|
151
|
+
rejectResult = reject;
|
|
152
|
+
});
|
|
153
|
+
const finish = () => {
|
|
154
|
+
if (!active)
|
|
155
|
+
return false;
|
|
156
|
+
active = false;
|
|
157
|
+
activeRequestIds.delete(requestId);
|
|
158
|
+
return true;
|
|
159
|
+
};
|
|
160
|
+
void Promise.resolve()
|
|
161
|
+
.then(() => {
|
|
162
|
+
if (!active)
|
|
163
|
+
return undefined;
|
|
164
|
+
nativeStarted = true;
|
|
165
|
+
return adapter.prefetchImage(uri, requestId);
|
|
166
|
+
})
|
|
167
|
+
.then((prefetched) => {
|
|
168
|
+
if (!finish())
|
|
169
|
+
return;
|
|
170
|
+
if (prefetched !== true) {
|
|
171
|
+
rejectResult(new TypeError("Native image prefetch must settle with boolean true."));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
resolveResult();
|
|
175
|
+
}, (error) => {
|
|
176
|
+
if (finish())
|
|
177
|
+
rejectResult(error);
|
|
178
|
+
});
|
|
179
|
+
return Object.freeze({
|
|
180
|
+
result,
|
|
181
|
+
cancel() {
|
|
182
|
+
if (!finish())
|
|
183
|
+
return;
|
|
184
|
+
if (!nativeStarted) {
|
|
185
|
+
rejectResult(new ImagePrefetchCancelledError());
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
adapter.cancelPrefetch(requestId);
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
rejectResult(error);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
rejectResult(new ImagePrefetchCancelledError());
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
async queryCache(rawURIs) {
|
|
200
|
+
const uris = normalizeCacheURIs(rawURIs);
|
|
201
|
+
const uniqueURIs = Object.freeze([...new Set(uris)]);
|
|
202
|
+
const rawResult = plainRecord(await adapter.queryCache(uniqueURIs), "Native image cache result");
|
|
203
|
+
const requested = new Set(uniqueURIs);
|
|
204
|
+
for (const [uri, location] of Object.entries(rawResult)) {
|
|
205
|
+
if (!requested.has(uri)) {
|
|
206
|
+
throw new TypeError("Native image cache returned an unrequested URI.");
|
|
207
|
+
}
|
|
208
|
+
cacheLocation(location, uri);
|
|
209
|
+
}
|
|
210
|
+
return Object.freeze(uris.map((uri) => Object.freeze({
|
|
211
|
+
uri,
|
|
212
|
+
location: Object.prototype.hasOwnProperty.call(rawResult, uri)
|
|
213
|
+
? cacheLocation(rawResult[uri], uri)
|
|
214
|
+
: "none",
|
|
215
|
+
})));
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AACnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC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0 +1,19 @@
|
|
|
1
|
+
import { type ImageAdapter } from "./index.js";
|
|
2
|
+
export interface AndroidImageLoaderModule {
|
|
3
|
+
getSize(uri: string): Promise<unknown>;
|
|
4
|
+
getSizeWithHeaders(uri: string, headers: Readonly<Record<string, string>>): Promise<unknown>;
|
|
5
|
+
prefetchImage(uri: string, requestId: number): Promise<unknown>;
|
|
6
|
+
abortRequest(requestId: number): void;
|
|
7
|
+
queryCache(uris: readonly string[]): Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface IOSImageLoaderModule {
|
|
10
|
+
getSize(uri: string): Promise<unknown>;
|
|
11
|
+
getSizeWithHeaders(uri: string, headers: Readonly<Record<string, string>>): Promise<unknown>;
|
|
12
|
+
prefetchImage(uri: string): Promise<unknown>;
|
|
13
|
+
queryCache(uris: readonly string[]): Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
/** @internal Translates React Native's Android-specific ImageLoader ABI. */
|
|
16
|
+
export declare function createAndroidImageAdapter(value: AndroidImageLoaderModule): ImageAdapter;
|
|
17
|
+
/** @internal Translates React Native's iOS-specific ImageLoader ABI. */
|
|
18
|
+
export declare function createIOSImageAdapter(value: IOSImageLoaderModule): ImageAdapter;
|
|
19
|
+
//# sourceMappingURL=react-native-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-adapter.d.ts","sourceRoot":"","sources":["../src/react-native-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAA+B,MAAM,YAAY,CAAC;AAE5E,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,kBAAkB,CAChB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACxC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,kBAAkB,CAChB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACxC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD;AAkCD,4EAA4E;AAC5E,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CA0Bd;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,GAC1B,YAAY,CA2Bd"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {} from "./index.js";
|
|
2
|
+
function record(value, path) {
|
|
3
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
4
|
+
throw new TypeError(`${path} must be an object.`);
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function requireFunctions(value, path, names) {
|
|
9
|
+
const candidate = record(value, path);
|
|
10
|
+
for (const name of names) {
|
|
11
|
+
if (typeof candidate[name] !== "function") {
|
|
12
|
+
throw new TypeError(`${path} must provide ${name}().`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function normalizedIOSDimensions(value) {
|
|
17
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
18
|
+
throw new TypeError("The iOS ImageLoader getSize result must contain width and height.");
|
|
19
|
+
}
|
|
20
|
+
return { width: value[0], height: value[1] };
|
|
21
|
+
}
|
|
22
|
+
/** @internal Translates React Native's Android-specific ImageLoader ABI. */
|
|
23
|
+
export function createAndroidImageAdapter(value) {
|
|
24
|
+
requireFunctions(value, "Android ImageLoader", [
|
|
25
|
+
"getSize",
|
|
26
|
+
"getSizeWithHeaders",
|
|
27
|
+
"prefetchImage",
|
|
28
|
+
"abortRequest",
|
|
29
|
+
"queryCache",
|
|
30
|
+
]);
|
|
31
|
+
const module = value;
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
platform: "android",
|
|
34
|
+
getDimensions(request) {
|
|
35
|
+
return request.headers === undefined
|
|
36
|
+
? module.getSize(request.uri)
|
|
37
|
+
: module.getSizeWithHeaders(request.uri, request.headers);
|
|
38
|
+
},
|
|
39
|
+
prefetchImage(uri, requestId) {
|
|
40
|
+
return module.prefetchImage(uri, requestId);
|
|
41
|
+
},
|
|
42
|
+
cancelPrefetch(requestId) {
|
|
43
|
+
module.abortRequest(requestId);
|
|
44
|
+
},
|
|
45
|
+
queryCache(uris) {
|
|
46
|
+
return module.queryCache(uris);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** @internal Translates React Native's iOS-specific ImageLoader ABI. */
|
|
51
|
+
export function createIOSImageAdapter(value) {
|
|
52
|
+
requireFunctions(value, "iOS ImageLoader", [
|
|
53
|
+
"getSize",
|
|
54
|
+
"getSizeWithHeaders",
|
|
55
|
+
"prefetchImage",
|
|
56
|
+
"queryCache",
|
|
57
|
+
]);
|
|
58
|
+
const module = value;
|
|
59
|
+
return Object.freeze({
|
|
60
|
+
platform: "ios",
|
|
61
|
+
async getDimensions(request) {
|
|
62
|
+
if (request.headers !== undefined) {
|
|
63
|
+
return module.getSizeWithHeaders(request.uri, request.headers);
|
|
64
|
+
}
|
|
65
|
+
return normalizedIOSDimensions(await module.getSize(request.uri));
|
|
66
|
+
},
|
|
67
|
+
prefetchImage(uri) {
|
|
68
|
+
return module.prefetchImage(uri);
|
|
69
|
+
},
|
|
70
|
+
cancelPrefetch() {
|
|
71
|
+
// React Native 0.87 exposes no cancellation primitive on iOS. The public
|
|
72
|
+
// operation still settles as cancelled and ignores the late native result.
|
|
73
|
+
},
|
|
74
|
+
queryCache(uris) {
|
|
75
|
+
return module.queryCache(uris);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=react-native-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-adapter.js","sourceRoot":"","sources":["../src/react-native-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,YAAY,CAAC;AAuB5E,SAAS,MAAM,CACb,KAAc,EACd,IAAY;IAEZ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAA0C,CAAC;AACpD,CAAC;AAED,SAAS,gBAAgB,CACvB,KAAc,EACd,IAAY,EACZ,KAAwB;IAExB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;YAC1C,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,iBAAiB,IAAI,KAAK,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IA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AAC,CAAC;IACH,MAAM,MAAM,GAAG,KAAK,CAAC;IACrB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAc;QACxB,KAAK,CAAC,aAAa,CAAC,OAA+B;YACjD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAClC,OAAO,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,uBAAuB,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,aAAa,CAAC,GAAW;YACvB,OAAO,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,cAAc;YACZ,yEAAyE;YACzE,2EAA2E;QAC7E,CAAC;QACD,UAAU,CAAC,IAAuB;YAChC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ImageService } from "./index.js";
|
|
2
|
+
/** Resolves the pinned ImageLoader without evaluating either Image facade. */
|
|
3
|
+
export declare function createReactNativeImageService(): ImageService;
|
|
4
|
+
export { ImagePrefetchCancelledError } from "./index.js";
|
|
5
|
+
export type { ImageCacheEntry, ImageCacheLocation, ImageDimensions, ImagePrefetchHandle, ImageRequest, ImageService, } from "./index.js";
|
|
6
|
+
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAsBnE,8EAA8E;AAC9E,wBAAgB,6BAA6B,IAAI,YAAY,CAiB5D;AAED,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { get, getEnforcing, } from "react-native/Libraries/TurboModule/TurboModuleRegistry";
|
|
2
|
+
import { assertVerifiedReactNativePlatform } from "@solidnative-dev/react-native-compat";
|
|
3
|
+
import { createImageService } from "./index.js";
|
|
4
|
+
import { createAndroidImageAdapter, createIOSImageAdapter, } from "./react-native-adapter.js";
|
|
5
|
+
let service;
|
|
6
|
+
function platform() {
|
|
7
|
+
return assertVerifiedReactNativePlatform(getEnforcing("PlatformConstants").getConstants(), "Images").platform;
|
|
8
|
+
}
|
|
9
|
+
/** Resolves the pinned ImageLoader without evaluating either Image facade. */
|
|
10
|
+
export function createReactNativeImageService() {
|
|
11
|
+
if (service !== undefined)
|
|
12
|
+
return service;
|
|
13
|
+
const nativePlatform = platform();
|
|
14
|
+
if (nativePlatform === "android") {
|
|
15
|
+
const module = get("ImageLoader");
|
|
16
|
+
if (module === null) {
|
|
17
|
+
throw new Error("The Android ImageLoader TurboModule is unavailable.");
|
|
18
|
+
}
|
|
19
|
+
service = createImageService(createAndroidImageAdapter(module));
|
|
20
|
+
return service;
|
|
21
|
+
}
|
|
22
|
+
const module = get("ImageLoader");
|
|
23
|
+
if (module === null) {
|
|
24
|
+
throw new Error("The iOS ImageLoader TurboModule is unavailable.");
|
|
25
|
+
}
|
|
26
|
+
service = createImageService(createIOSImageAdapter(module));
|
|
27
|
+
return service;
|
|
28
|
+
}
|
|
29
|
+
export { ImagePrefetchCancelledError } from "./index.js";
|
|
30
|
+
//# sourceMappingURL=react-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../src/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,YAAY,GACb,MAAM,wDA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ImageService } from "./index.js";
|
|
2
|
+
export declare class ImageOwnerDisposedError extends Error {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
export interface SolidImageController {
|
|
6
|
+
getDimensions(request: string | ImageRequest): Promise<ImageDimensions>;
|
|
7
|
+
prefetch(uri: string): Promise<void>;
|
|
8
|
+
queryCache(uris: readonly string[]): Promise<readonly ImageCacheEntry[]>;
|
|
9
|
+
}
|
|
10
|
+
/** Owns image work and traces settlements without recording URIs or headers. */
|
|
11
|
+
export declare function createImageController(service: ImageService): SolidImageController;
|
|
12
|
+
export { ImagePrefetchCancelledError };
|
|
13
|
+
export type { ImageCacheEntry, ImageCacheLocation, ImageDimensions, ImageRequest, ImageService, } from "./index.js";
|
|
14
|
+
//# sourceMappingURL=solid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solid.d.ts","sourceRoot":"","sources":["../src/solid.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,qBAAa,uBAAwB,SAAQ,KAAK;;CAKjD;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACxE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;CAC1E;AA4BD,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,GACpB,oBAAoB,CAoHtB;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC;AAEvC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/solid.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createCausalPlatformEventHandler, retainCausalPlatformEvent, } from "@solidnative-dev/core";
|
|
2
|
+
import { getOwner, onCleanup } from "solid-js";
|
|
3
|
+
import { ImagePrefetchCancelledError, } from "./index.js";
|
|
4
|
+
export class ImageOwnerDisposedError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super("The Solid owner was disposed before its image operation settled.");
|
|
7
|
+
this.name = "ImageOwnerDisposedError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function settlePromiseInsideEvent(settlement, value) {
|
|
11
|
+
return retainCausalPlatformEvent(undefined, (event) => {
|
|
12
|
+
settlement.resolve(value);
|
|
13
|
+
void Promise.resolve().then(() => finishPromiseSettlement(event));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function finishPromiseSettlement(event) {
|
|
17
|
+
if (event.state !== "active")
|
|
18
|
+
return;
|
|
19
|
+
try {
|
|
20
|
+
event.run(() => undefined);
|
|
21
|
+
event.finish();
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
event.fail(error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Owns image work and traces settlements without recording URIs or headers. */
|
|
28
|
+
export function createImageController(service) {
|
|
29
|
+
if (typeof service !== "object" ||
|
|
30
|
+
service === null ||
|
|
31
|
+
typeof service.getDimensions !== "function" ||
|
|
32
|
+
typeof service.prefetch !== "function" ||
|
|
33
|
+
typeof service.queryCache !== "function") {
|
|
34
|
+
throw new TypeError("A Solid image controller requires an ImageService.");
|
|
35
|
+
}
|
|
36
|
+
if (getOwner() === null) {
|
|
37
|
+
throw new Error("createImageController requires an active Solid owner.");
|
|
38
|
+
}
|
|
39
|
+
let active = true;
|
|
40
|
+
const pending = new Set();
|
|
41
|
+
const settleDimensions = createCausalPlatformEventHandler("platform.image.dimensions", (settlePromiseInsideEvent), { priority: "default" });
|
|
42
|
+
const settlePrefetch = createCausalPlatformEventHandler("platform.image.prefetch", (settlePromiseInsideEvent), { priority: "default" });
|
|
43
|
+
const settleCacheQuery = createCausalPlatformEventHandler("platform.image.cache-query", (settlePromiseInsideEvent), { priority: "default" });
|
|
44
|
+
const owned = (operation, settle, cancel) => {
|
|
45
|
+
if (!active) {
|
|
46
|
+
cancel?.();
|
|
47
|
+
return Promise.reject(new ImageOwnerDisposedError());
|
|
48
|
+
}
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const settlement = {
|
|
51
|
+
reject,
|
|
52
|
+
resolve,
|
|
53
|
+
...(cancel === undefined ? {} : { cancel }),
|
|
54
|
+
};
|
|
55
|
+
pending.add(settlement);
|
|
56
|
+
void Promise.resolve(operation).then((value) => {
|
|
57
|
+
if (!pending.delete(settlement))
|
|
58
|
+
return;
|
|
59
|
+
settle(settlement, value);
|
|
60
|
+
}, (error) => {
|
|
61
|
+
if (pending.delete(settlement))
|
|
62
|
+
reject(error);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
onCleanup(() => {
|
|
67
|
+
if (!active)
|
|
68
|
+
return;
|
|
69
|
+
active = false;
|
|
70
|
+
const error = new ImageOwnerDisposedError();
|
|
71
|
+
for (const operation of pending) {
|
|
72
|
+
try {
|
|
73
|
+
operation.cancel?.();
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Owner disposal remains the observable settlement for every operation.
|
|
77
|
+
}
|
|
78
|
+
operation.reject(error);
|
|
79
|
+
}
|
|
80
|
+
pending.clear();
|
|
81
|
+
});
|
|
82
|
+
return Object.freeze({
|
|
83
|
+
getDimensions(request) {
|
|
84
|
+
if (!active)
|
|
85
|
+
return Promise.reject(new ImageOwnerDisposedError());
|
|
86
|
+
let operation;
|
|
87
|
+
try {
|
|
88
|
+
operation = service.getDimensions(request);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
return Promise.reject(error);
|
|
92
|
+
}
|
|
93
|
+
return owned(operation, settleDimensions);
|
|
94
|
+
},
|
|
95
|
+
prefetch(uri) {
|
|
96
|
+
if (!active)
|
|
97
|
+
return Promise.reject(new ImageOwnerDisposedError());
|
|
98
|
+
let handle;
|
|
99
|
+
try {
|
|
100
|
+
handle = service.prefetch(uri);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return Promise.reject(error);
|
|
104
|
+
}
|
|
105
|
+
if (typeof handle !== "object" ||
|
|
106
|
+
handle === null ||
|
|
107
|
+
!(handle.result instanceof Promise) ||
|
|
108
|
+
typeof handle.cancel !== "function") {
|
|
109
|
+
return Promise.reject(new TypeError("ImageService returned an invalid prefetch handle."));
|
|
110
|
+
}
|
|
111
|
+
return owned(handle.result, settlePrefetch, () => handle.cancel());
|
|
112
|
+
},
|
|
113
|
+
queryCache(uris) {
|
|
114
|
+
if (!active)
|
|
115
|
+
return Promise.reject(new ImageOwnerDisposedError());
|
|
116
|
+
let operation;
|
|
117
|
+
try {
|
|
118
|
+
operation = service.queryCache(uris);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return Promise.reject(error);
|
|
122
|
+
}
|
|
123
|
+
return owned(operation, settleCacheQuery);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export { ImagePrefetchCancelledError };
|
|
128
|
+
//# sourceMappingURL=solid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solid.js","sourceRoot":"","sources":["../src/solid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAE1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,2BAA2B,GAM5B,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CAAC,kEA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,IACE,OAAO,MAAM,KAAK,QAAQ;gBAC1B,MAAM,KAAK,IAAI;gBACf,CAAC,CAAC,MAAM,CAAC,MAAM,YAAY,OAAO,CAAC;gBACnC,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,EACnC,CAAC;gBACD,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,SAAS,CAAC,mDAAmD,CAAC,CACnE,CAAC;YACJ,CAAC;YACD,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,UAAU,CAAC,IAAuB;YAChC,IAAI,CAAC,MAAM;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;YAClE,IAAI,SAA8C,CAAC;YACnD,IAAI,CAAC;gBACH,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,KAAK,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidnative-dev/images",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Validated image metadata, prefetch, and cache access with Solid-owned asynchronous work.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://solidnative.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/solid-native/solid-native.git",
|
|
11
|
+
"directory": "packages/images"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": "^22.13.0 || ^24.3.0 || >=26.0.0"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./react-native": {
|
|
25
|
+
"types": "./dist/react-native.d.ts",
|
|
26
|
+
"default": "./dist/react-native.js"
|
|
27
|
+
},
|
|
28
|
+
"./solid": {
|
|
29
|
+
"types": "./dist/solid.d.ts",
|
|
30
|
+
"default": "./dist/solid.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist/index.*",
|
|
35
|
+
"dist/react-native-adapter.*",
|
|
36
|
+
"dist/react-native.*",
|
|
37
|
+
"dist/solid.*"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@solidnative-dev/core": "0.1.0-alpha.0",
|
|
41
|
+
"@solidnative-dev/react-native-compat": "0.1.0-alpha.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"solid-js": "2.0.4"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"solid-js": "2.0.4"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -p tsconfig.json",
|
|
51
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"test": "pnpm build && node --conditions=browser --test test/*.test.mjs"
|
|
53
|
+
}
|
|
6
54
|
}
|