Skip to content

Commit c172a19

Browse files
Add override for import.meta.resolve() (#1740)
Co-authored-by: saschanaz <[email protected]>
1 parent dee6675 commit c172a19

6 files changed

+54
-30
lines changed

baselines/dom.generated.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,6 @@ interface ImageEncodeOptions {
667667
type?: string;
668668
}
669669

670-
interface ImportMeta {
671-
url: string;
672-
}
673-
674670
interface InputEventInit extends UIEventInit {
675671
data?: string | null;
676672
dataTransfer?: DataTransfer | null;
@@ -14559,6 +14555,11 @@ declare var ImageData: {
1455914555
new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
1456014556
};
1456114557

14558+
interface ImportMeta {
14559+
url: string;
14560+
resolve(specifier: string): string;
14561+
}
14562+
1456214563
/**
1456314564
* Available only in secure contexts.
1456414565
*

baselines/serviceworker.generated.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ interface ImageEncodeOptions {
303303
type?: string;
304304
}
305305

306-
interface ImportMeta {
307-
url: string;
308-
}
309-
310306
interface JsonWebKey {
311307
alg?: string;
312308
crv?: string;
@@ -3588,6 +3584,11 @@ declare var ImageData: {
35883584
new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
35893585
};
35903586

3587+
interface ImportMeta {
3588+
url: string;
3589+
resolve(specifier: string): string;
3590+
}
3591+
35913592
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KHR_parallel_shader_compile) */
35923593
interface KHR_parallel_shader_compile {
35933594
readonly COMPLETION_STATUS_KHR: 0x91B1;

baselines/sharedworker.generated.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,6 @@ interface ImageEncodeOptions {
278278
type?: string;
279279
}
280280

281-
interface ImportMeta {
282-
url: string;
283-
}
284-
285281
interface JsonWebKey {
286282
alg?: string;
287283
crv?: string;
@@ -3477,6 +3473,11 @@ declare var ImageData: {
34773473
new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
34783474
};
34793475

3476+
interface ImportMeta {
3477+
url: string;
3478+
resolve(specifier: string): string;
3479+
}
3480+
34803481
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KHR_parallel_shader_compile) */
34813482
interface KHR_parallel_shader_compile {
34823483
readonly COMPLETION_STATUS_KHR: 0x91B1;

baselines/webworker.generated.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,6 @@ interface ImageEncodeOptions {
322322
type?: string;
323323
}
324324

325-
interface ImportMeta {
326-
url: string;
327-
}
328-
329325
interface JsonWebKey {
330326
alg?: string;
331327
crv?: string;
@@ -3850,6 +3846,11 @@ declare var ImageData: {
38503846
new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
38513847
};
38523848

3849+
interface ImportMeta {
3850+
url: string;
3851+
resolve(specifier: string): string;
3852+
}
3853+
38533854
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KHR_parallel_shader_compile) */
38543855
interface KHR_parallel_shader_compile {
38553856
readonly COMPLETION_STATUS_KHR: 0x91B1;

inputfiles/addedTypes.jsonc

+34-12
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,40 @@
449449
},
450450
"interfaces": {
451451
"interface": {
452+
// ImportMeta is not a true DOM interface, but we are forced to declare it as one in order to emit method definitions.
453+
// We cannot define methods as dictionary properties with function types,
454+
// as this would cause conflicts with ImportMeta method overrides in places like @types/node.
455+
"ImportMeta": {
456+
"name": "ImportMeta",
457+
"exposed": "Window Worker",
458+
"noInterfaceObject": true,
459+
"properties": {
460+
"property": {
461+
"url": {
462+
"name": "url",
463+
"type": "DOMString"
464+
}
465+
}
466+
},
467+
"methods": {
468+
"method": {
469+
"resolve": {
470+
"name": "resolve",
471+
"signature": [
472+
{
473+
"param": [
474+
{
475+
"name": "specifier",
476+
"type": "DOMString"
477+
}
478+
],
479+
"type": "DOMString"
480+
}
481+
]
482+
}
483+
}
484+
}
485+
},
452486
"AudioWorkletProcessorImpl": {
453487
"name": "AudioWorkletProcessorImpl",
454488
"extends": "AudioWorkletProcessor",
@@ -1253,18 +1287,6 @@
12531287
},
12541288
"dictionaries": {
12551289
"dictionary": {
1256-
"ImportMeta": {
1257-
"name": "ImportMeta",
1258-
"members": {
1259-
"member": {
1260-
"url": {
1261-
"name": "url",
1262-
"type": "DOMString",
1263-
"required": true
1264-
}
1265-
}
1266-
}
1267-
},
12681290
"KeyboardEventInit": {
12691291
"members": {
12701292
"member": {

inputfiles/knownTypes.json

-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"HmacKeyAlgorithm",
3535
"HmacKeyGenParams",
3636
"ImageBitmapRenderingContextSettings",
37-
"ImportMeta",
3837
"Keyframe",
3938
"MutationRecordType",
4039
"NamedCurve",
@@ -84,7 +83,6 @@
8483
"HmacImportParams",
8584
"HmacKeyGenParams",
8685
"ImageBitmapRenderingContextSettings",
87-
"ImportMeta",
8886
"NamedCurve",
8987
"Pbkdf2Params",
9088
"RsaHashedImportParams",

0 commit comments

Comments
 (0)