@typespec/html-program-viewer 0.79.0-dev.2 → 0.79.0-dev.3

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.
@@ -1,6 +1,6 @@
1
1
  const manifest = {
2
2
  "version": "1.8.0",
3
- "commit": "9cb16e496b895a42af3bd26d98cb082410ed57af"
3
+ "commit": "f8fb3c36c3ec78d91c81f068fe23b7cf6a34a49d"
4
4
  };
5
5
 
6
6
  export { manifest as default };
@@ -51102,6 +51102,106 @@ var Related;
51102
51102
  })(Related || (Related = {}));
51103
51103
  // #endregion
51104
51104
 
51105
+ var CheckFlags;
51106
+ (function (CheckFlags) {
51107
+ /** No flags set. */
51108
+ CheckFlags[CheckFlags["None"] = 0] = "None";
51109
+ /** Currently checking within an uninstantiated template declaration. */
51110
+ CheckFlags[CheckFlags["InTemplateDeclaration"] = 1] = "InTemplateDeclaration";
51111
+ })(CheckFlags || (CheckFlags = {}));
51112
+ class CheckContext {
51113
+ /** The type mapper associated with this context, if any. */
51114
+ mapper;
51115
+ /** The flags enabled in this context. */
51116
+ flags;
51117
+ #templateParametersObserved;
51118
+ static from(contextOrMapper) {
51119
+ if (contextOrMapper instanceof CheckContext) {
51120
+ return contextOrMapper;
51121
+ }
51122
+ return new CheckContext(contextOrMapper, CheckFlags.None);
51123
+ }
51124
+ /**
51125
+ * The default CheckContext to use at API entrypoints.
51126
+ */
51127
+ static DEFAULT = new CheckContext(undefined, CheckFlags.None);
51128
+ constructor(mapper, flags, templateParametersObserved) {
51129
+ this.mapper = mapper;
51130
+ this.flags = flags;
51131
+ this.#templateParametersObserved = templateParametersObserved;
51132
+ Object.freeze(this);
51133
+ }
51134
+ /**
51135
+ * Returns a new context with the given flags _added_ to the existing flags.
51136
+ *
51137
+ * @param flags - the flags to enable
51138
+ * @returns a new CheckContext with the given flags enabled.
51139
+ */
51140
+ withFlags(flags) {
51141
+ return new CheckContext(this.mapper, this.flags | flags, this.#templateParametersObserved);
51142
+ }
51143
+ /**
51144
+ * Returns a new context with the given flags disabled.
51145
+ *
51146
+ * @param flags - the flags to disable
51147
+ * @returns a new CheckContext with the given flags disabled.
51148
+ */
51149
+ maskFlags(flags) {
51150
+ return new CheckContext(this.mapper, this.flags & ~flags, this.#templateParametersObserved);
51151
+ }
51152
+ /**
51153
+ * Returns true if ALL of the given flags are enabled in this context.
51154
+ */
51155
+ hasFlags(flags) {
51156
+ return (this.flags & flags) === flags;
51157
+ }
51158
+ /**
51159
+ * Returns a new context with the given mapper.
51160
+ *
51161
+ * @param mapper - the new type mapper, or undefined to clear the mapper
51162
+ * @returns a new CheckContext with the given mapper.
51163
+ */
51164
+ withMapper(mapper) {
51165
+ return new CheckContext(mapper, this.flags, this.#templateParametersObserved);
51166
+ }
51167
+ /**
51168
+ * Observes a template parameter within the current observation scope, if any.
51169
+ *
51170
+ * @param param - the TemplateParameter type instance to observe
51171
+ */
51172
+ observeTemplateParameter(param) {
51173
+ this.#templateParametersObserved?.add(param);
51174
+ }
51175
+ /**
51176
+ * Returns a new CheckContext with a new (empty) template parameter observation scope.
51177
+ *
51178
+ * Call this when you need to observe template parameters used within a specific context.
51179
+ *
51180
+ * @returns a new CheckContext with an empty template parameter observation scope.
51181
+ */
51182
+ enterTemplateObserverScope() {
51183
+ return new CheckContext(this.mapper, this.flags, new Set());
51184
+ }
51185
+ /**
51186
+ * Creates a new CheckContext with no template parameter observation enabled.
51187
+ *
51188
+ * Call this when the checker is moving from one declaration to another, where usage of template parameters
51189
+ * from the next scope should not impact the usage from the previous scope.
51190
+ *
51191
+ * @returns a new CheckContext with no template parameter observation.
51192
+ */
51193
+ exitTemplateObserverScope() {
51194
+ return new CheckContext(this.mapper, this.flags, undefined);
51195
+ }
51196
+ /**
51197
+ * @returns true if the observer scope in this context has seen any template parameter usage.
51198
+ */
51199
+ hasObservedTemplateParameters() {
51200
+ return this.#templateParametersObserved !== undefined
51201
+ ? this.#templateParametersObserved.size > 0
51202
+ : false;
51203
+ }
51204
+ }
51105
51205
  /**
51106
51206
  * Find all named models that could have been the source of the given
51107
51207
  * property. This includes the named parents of all property sources in a
@@ -51340,7 +51440,7 @@ let manifest;
51340
51440
  try {
51341
51441
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
51342
51442
  // @ts-ignore
51343
- manifest = (await import('../manifest-DKDRH_XL.js')).default;
51443
+ manifest = (await import('../manifest-BweYd_vW.js')).default;
51344
51444
  }
51345
51445
  catch {
51346
51446
  const name = "../dist/manifest.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/html-program-viewer",
3
- "version": "0.79.0-dev.2",
3
+ "version": "0.79.0-dev.3",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting an html view of the program.",
6
6
  "homepage": "https://typespec.io",