@xaendar/vscode-client 0.10.1 → 0.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/vscode-client",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "",
5
5
  "author": "Kaitenjo",
6
6
  "license": "MIT",
package/server/server.cjs CHANGED
@@ -227952,6 +227952,11 @@ var CompilerContext = class _CompilerContext {
227952
227952
  * Parent context representing the enclosing scope.
227953
227953
  */
227954
227954
  parent;
227955
+ /**
227956
+ * A set containting all the signals declared in the class (and subclasses)
227957
+ * associated to the template
227958
+ */
227959
+ _componentSignalsFields = /* @__PURE__ */ new Set();
227955
227960
  /**
227956
227961
  * Identifiers declared directly in this scope, mapped to whether they
227957
227962
  * hold a plain value or a signal (e.g. `@for` implicit variables like
@@ -228002,6 +228007,18 @@ var CompilerContext = class _CompilerContext {
228002
228007
  }
228003
228008
  this._unresolvableIdentifiers.set(name, kind);
228004
228009
  }
228010
+ /**
228011
+ * Registers a new signal field name in this scope.
228012
+ *
228013
+ * @param name - The identifier name to register.
228014
+ * @throws When an identifier with the same name is already declared in this scope.
228015
+ */
228016
+ addSignalClassField(name) {
228017
+ if (this._componentSignalsFields.has(name)) {
228018
+ throw new Error(`Signal field "${name}" is already declared in this scope.`);
228019
+ }
228020
+ this._componentSignalsFields.add(name);
228021
+ }
228005
228022
  /**
228006
228023
  * Removes a previously registered identifier from this scope, if present.
228007
228024
  * Does nothing if no identifier with the given name is declared in this scope.
@@ -228032,6 +228049,26 @@ var CompilerContext = class _CompilerContext {
228032
228049
  hasIdentifier(name) {
228033
228050
  return this._identifiers.has(name) || (this.parent?.hasIdentifier(name) ?? false);
228034
228051
  }
228052
+ /**
228053
+ * Returns `true` if an identifier with the given name is declared in this
228054
+ * scope or any of its ancestor scopes.
228055
+ *
228056
+ * @param name - The identifier name to look up.
228057
+ * @returns `true` if the identifier exists in the scope chain, `false` otherwise.
228058
+ */
228059
+ hasUnresolvableIdentifier(name) {
228060
+ return this._unresolvableIdentifiers.has(name) || (this.parent?.hasUnresolvableIdentifier(name) ?? false);
228061
+ }
228062
+ /**
228063
+ * Returns `true` if a signal field with the given name is declared in this
228064
+ * scope or any of its ancestor scopes.
228065
+ *
228066
+ * @param name - The signal field name to look up.
228067
+ * @returns `true` if the ignal field exists in the scope chain, `false` otherwise.
228068
+ */
228069
+ hasSignalField(name) {
228070
+ return this._componentSignalsFields.has(name) || (this.parent?.hasSignalField(name) ?? false);
228071
+ }
228035
228072
  /**
228036
228073
  * Resolves the kind (`'value'` or `'signal'`) of a declared identifier,
228037
228074
  * walking up the scope chain if not found in this scope.
@@ -228043,16 +228080,6 @@ var CompilerContext = class _CompilerContext {
228043
228080
  getIdentifierKind(name) {
228044
228081
  return this._identifiers.get(name) ?? this.parent?.getIdentifierKind(name);
228045
228082
  }
228046
- /**
228047
- * Returns `true` if an identifier with the given name is declared in this
228048
- * scope or any of its ancestor scopes.
228049
- *
228050
- * @param name - The identifier name to look up.
228051
- * @returns `true` if the identifier exists in the scope chain, `false` otherwise.
228052
- */
228053
- hasUnresolvableIdentifier(name) {
228054
- return this._unresolvableIdentifiers.has(name) || (this.parent?.hasUnresolvableIdentifier(name) ?? false);
228055
- }
228056
228083
  /**
228057
228084
  * Resolves the kind (`'value'` or `'signal'`) of a unresolvable declared identifier,
228058
228085
  * walking up the scope chain if not found in this scope.
@@ -228274,6 +228301,9 @@ function emitNode(node, parent, compilerContext, options) {
228274
228301
  if (options.skipResolution) {
228275
228302
  return { expression: text };
228276
228303
  }
228304
+ if (compilerContext.hasSignalField(text)) {
228305
+ return { expression: `this.${text}`, reactive: true };
228306
+ }
228277
228307
  if (compilerContext.hasUnresolvableIdentifier(text)) {
228278
228308
  return { expression: text, reactive: compilerContext.getUnresolvableIdentifierKind(text) === "signal" };
228279
228309
  }
@@ -228626,7 +228656,7 @@ var Generator = class {
228626
228656
  this._nodeToProcess.clear();
228627
228657
  const compilerContext = new CompilerContext();
228628
228658
  for (let i2 = 0; i2 < signals.length; i2++) {
228629
- compilerContext.addUnresolvableIdentifier(`this.${signals[i2]}`, "signal");
228659
+ compilerContext.addSignalClassField(signals[i2]);
228630
228660
  }
228631
228661
  const generatedCode = [
228632
228662
  "_render() {",