@typespec/html-program-viewer 0.70.0-dev.0 → 0.70.0-dev.1
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/dist/react/index.js
CHANGED
|
@@ -28794,6 +28794,14 @@ defineKit({
|
|
|
28794
28794
|
},
|
|
28795
28795
|
});
|
|
28796
28796
|
|
|
28797
|
+
defineKit({
|
|
28798
|
+
entity: {
|
|
28799
|
+
isAssignableTo: createDiagnosable(function (source, target, diagnosticTarget) {
|
|
28800
|
+
return this.program.checker.isTypeAssignableTo(source, target, diagnosticTarget ?? source);
|
|
28801
|
+
}),
|
|
28802
|
+
},
|
|
28803
|
+
});
|
|
28804
|
+
|
|
28797
28805
|
/**
|
|
28798
28806
|
* Creates a shallow copy of a rekeyable map.
|
|
28799
28807
|
*
|
|
@@ -31165,6 +31173,26 @@ defineKit({
|
|
|
31165
31173
|
},
|
|
31166
31174
|
});
|
|
31167
31175
|
|
|
31176
|
+
defineKit({
|
|
31177
|
+
intrinsic: {
|
|
31178
|
+
get any() {
|
|
31179
|
+
return this.program.checker.anyType;
|
|
31180
|
+
},
|
|
31181
|
+
get error() {
|
|
31182
|
+
return this.program.checker.errorType;
|
|
31183
|
+
},
|
|
31184
|
+
get never() {
|
|
31185
|
+
return this.program.checker.neverType;
|
|
31186
|
+
},
|
|
31187
|
+
get null() {
|
|
31188
|
+
return this.program.checker.nullType;
|
|
31189
|
+
},
|
|
31190
|
+
get void() {
|
|
31191
|
+
return this.program.checker.voidType;
|
|
31192
|
+
},
|
|
31193
|
+
},
|
|
31194
|
+
});
|
|
31195
|
+
|
|
31168
31196
|
class InvalidNumericError extends Error {
|
|
31169
31197
|
code = "InvalidNumeric";
|
|
31170
31198
|
}
|
|
@@ -31571,6 +31599,13 @@ defineKit({
|
|
|
31571
31599
|
},
|
|
31572
31600
|
});
|
|
31573
31601
|
|
|
31602
|
+
defineKit({
|
|
31603
|
+
resolve: createDiagnosable(function (reference) {
|
|
31604
|
+
// Directly use the program's resolveTypeReference method
|
|
31605
|
+
return this.program.resolveTypeReference(reference);
|
|
31606
|
+
}),
|
|
31607
|
+
});
|
|
31608
|
+
|
|
31574
31609
|
defineKit({
|
|
31575
31610
|
scalar: {
|
|
31576
31611
|
is(type) {
|
|
@@ -31828,6 +31863,39 @@ defineKit({
|
|
|
31828
31863
|
isUserDefined(type) {
|
|
31829
31864
|
return getLocationContext(this.program, type).type === "project";
|
|
31830
31865
|
},
|
|
31866
|
+
inNamespace(type, namespace) {
|
|
31867
|
+
// A namespace is always in itself
|
|
31868
|
+
if (type === namespace) {
|
|
31869
|
+
return true;
|
|
31870
|
+
}
|
|
31871
|
+
// Handle types with known containers
|
|
31872
|
+
switch (type.kind) {
|
|
31873
|
+
case "ModelProperty":
|
|
31874
|
+
if (type.model) {
|
|
31875
|
+
return this.type.inNamespace(type.model, namespace);
|
|
31876
|
+
}
|
|
31877
|
+
break;
|
|
31878
|
+
case "EnumMember":
|
|
31879
|
+
return this.type.inNamespace(type.enum, namespace);
|
|
31880
|
+
case "UnionVariant":
|
|
31881
|
+
return this.type.inNamespace(type.union, namespace);
|
|
31882
|
+
case "Operation":
|
|
31883
|
+
if (type.interface) {
|
|
31884
|
+
return this.type.inNamespace(type.interface, namespace);
|
|
31885
|
+
}
|
|
31886
|
+
// Operations that belong to a namespace directly will be handled in the generic case
|
|
31887
|
+
break;
|
|
31888
|
+
}
|
|
31889
|
+
// Generic case handles all other types
|
|
31890
|
+
if ("namespace" in type && type.namespace) {
|
|
31891
|
+
return this.type.inNamespace(type.namespace, namespace);
|
|
31892
|
+
}
|
|
31893
|
+
// If we got this far, the type does not belong to the namespace
|
|
31894
|
+
return false;
|
|
31895
|
+
},
|
|
31896
|
+
isAssignableTo: createDiagnosable(function (source, target, diagnosticTarget) {
|
|
31897
|
+
return this.program.checker.isTypeAssignableTo(source, target, diagnosticTarget ?? source);
|
|
31898
|
+
}),
|
|
31831
31899
|
},
|
|
31832
31900
|
});
|
|
31833
31901
|
|
|
@@ -31856,25 +31924,43 @@ defineKit({
|
|
|
31856
31924
|
const variants = Array.from(union.variants.values()).filter(filterFn);
|
|
31857
31925
|
return this.union.create({ variants });
|
|
31858
31926
|
},
|
|
31859
|
-
create(
|
|
31927
|
+
create(descOrChildren) {
|
|
31928
|
+
let descriptor;
|
|
31929
|
+
if (Array.isArray(descOrChildren)) {
|
|
31930
|
+
// Build a descriptor from the children
|
|
31931
|
+
descriptor = {
|
|
31932
|
+
decorators: [],
|
|
31933
|
+
variants: descOrChildren.map((child) => {
|
|
31934
|
+
const memberDoc = getDoc(this.program, child);
|
|
31935
|
+
return this.unionVariant.create({
|
|
31936
|
+
type: child,
|
|
31937
|
+
decorators: memberDoc ? [[$doc, memberDoc]] : undefined,
|
|
31938
|
+
});
|
|
31939
|
+
}),
|
|
31940
|
+
};
|
|
31941
|
+
}
|
|
31942
|
+
else {
|
|
31943
|
+
// Already a descriptor
|
|
31944
|
+
descriptor = descOrChildren;
|
|
31945
|
+
}
|
|
31860
31946
|
const union = this.program.checker.createType({
|
|
31861
31947
|
kind: "Union",
|
|
31862
|
-
name:
|
|
31863
|
-
decorators: decoratorApplication(this,
|
|
31948
|
+
name: descriptor.name,
|
|
31949
|
+
decorators: decoratorApplication(this, descriptor.decorators),
|
|
31864
31950
|
variants: createRekeyableMap(),
|
|
31865
31951
|
get options() {
|
|
31866
31952
|
return Array.from(this.variants.values()).map((v) => v.type);
|
|
31867
31953
|
},
|
|
31868
|
-
expression:
|
|
31954
|
+
expression: descriptor.name === undefined,
|
|
31869
31955
|
});
|
|
31870
|
-
if (Array.isArray(
|
|
31871
|
-
for (const variant of
|
|
31956
|
+
if (Array.isArray(descriptor.variants)) {
|
|
31957
|
+
for (const variant of descriptor.variants) {
|
|
31872
31958
|
union.variants.set(variant.name, variant);
|
|
31873
31959
|
variant.union = union;
|
|
31874
31960
|
}
|
|
31875
31961
|
}
|
|
31876
|
-
else if (
|
|
31877
|
-
for (const [name, value] of Object.entries(
|
|
31962
|
+
else if (descriptor.variants) {
|
|
31963
|
+
for (const [name, value] of Object.entries(descriptor.variants)) {
|
|
31878
31964
|
union.variants.set(name, this.unionVariant.create({ name, type: this.literal.create(value) }));
|
|
31879
31965
|
}
|
|
31880
31966
|
}
|
|
@@ -32016,6 +32102,9 @@ defineKit({
|
|
|
32016
32102
|
isScalar(type) {
|
|
32017
32103
|
return type.valueKind === "ScalarValue";
|
|
32018
32104
|
},
|
|
32105
|
+
isAssignableTo: createDiagnosable(function (source, target, diagnosticTarget) {
|
|
32106
|
+
return this.program.checker.isTypeAssignableTo(source, target, diagnosticTarget ?? source);
|
|
32107
|
+
}),
|
|
32019
32108
|
},
|
|
32020
32109
|
});
|
|
32021
32110
|
|
|
@@ -32067,9 +32156,11 @@ function createTypekit(realm) {
|
|
|
32067
32156
|
}
|
|
32068
32157
|
return proxyWrapper;
|
|
32069
32158
|
}
|
|
32070
|
-
//
|
|
32071
|
-
if (typeof value === "object" &&
|
|
32072
|
-
|
|
32159
|
+
// Wrap objects to ensure their functions are bound correctly, avoid wrapping `get` accessors
|
|
32160
|
+
if (typeof value === "object" &&
|
|
32161
|
+
value !== null &&
|
|
32162
|
+
!Reflect.getOwnPropertyDescriptor(target, prop)?.get) {
|
|
32163
|
+
return new Proxy(value, handler);
|
|
32073
32164
|
}
|
|
32074
32165
|
return value;
|
|
32075
32166
|
},
|
|
@@ -32077,10 +32168,6 @@ function createTypekit(realm) {
|
|
|
32077
32168
|
const proxy = new Proxy(tk, handler);
|
|
32078
32169
|
return proxy;
|
|
32079
32170
|
}
|
|
32080
|
-
// Helper function to check if an object is a Typekit namespace
|
|
32081
|
-
function isTypekitNamespace(obj) {
|
|
32082
|
-
return obj && !!obj[TypekitNamespaceSymbol];
|
|
32083
|
-
}
|
|
32084
32171
|
// #region Default Typekit
|
|
32085
32172
|
const DEFAULT_REALM = Symbol.for("TypeSpec.Typekit.DEFAULT_TYPEKIT_REALM");
|
|
32086
32173
|
function _$(arg) {
|
|
@@ -32320,9 +32407,22 @@ class Realm {
|
|
|
32320
32407
|
get types() {
|
|
32321
32408
|
return this.#types;
|
|
32322
32409
|
}
|
|
32323
|
-
static realmForType = new WeakMap();
|
|
32410
|
+
static realmForType = singleton("Realm.realmForType", () => new WeakMap());
|
|
32324
32411
|
}
|
|
32325
32412
|
_a = Realm;
|
|
32413
|
+
/**
|
|
32414
|
+
* Create a singleton instance that is shared across the process.
|
|
32415
|
+
* This is to have a true singleton even if multiple instance of the compiler/library are loaded.
|
|
32416
|
+
* @param key - The key to use for the singleton.
|
|
32417
|
+
* @param init - The function to call to create the singleton.
|
|
32418
|
+
*/
|
|
32419
|
+
function singleton(key, init) {
|
|
32420
|
+
const sym = Symbol.for(key);
|
|
32421
|
+
if (!globalThis[sym]) {
|
|
32422
|
+
globalThis[sym] = init();
|
|
32423
|
+
}
|
|
32424
|
+
return globalThis[sym];
|
|
32425
|
+
}
|
|
32326
32426
|
|
|
32327
32427
|
/**
|
|
32328
32428
|
* The fixed set of options for each of the kinds of delimited lists in TypeSpec.
|
|
@@ -34000,7 +34100,7 @@ let manifest;
|
|
|
34000
34100
|
try {
|
|
34001
34101
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34002
34102
|
// @ts-ignore
|
|
34003
|
-
manifest = (await import('../manifest-
|
|
34103
|
+
manifest = (await import('../manifest-pNKFR26W.js')).default;
|
|
34004
34104
|
}
|
|
34005
34105
|
catch {
|
|
34006
34106
|
const name = "../dist/manifest.js";
|
package/package.json
CHANGED