@barefootjs/test 0.18.7 → 0.19.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.
Files changed (2) hide show
  1. package/dist/index.js +17 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -190420,11 +190420,19 @@ function collectSignal(node, ctx) {
190420
190420
  }
190421
190421
  const envReader = resolveEnvSignalKey(callExpr, ctx) ?? undefined;
190422
190422
  const envFactory = envReader ? callExpr.expression.getText(ctx.sourceFile) : undefined;
190423
+ let templateInitialValue;
190424
+ if (!ctx.propsObjectName && callExpr.arguments[0]) {
190425
+ const propNames = new Set(ctx.propsParams.map((p) => p.name));
190426
+ if (propNames.size > 0) {
190427
+ templateInitialValue = rewriteBarePropRefs(initialValue, callExpr.arguments[0], propNames);
190428
+ }
190429
+ }
190423
190430
  ctx.signals.push({
190424
190431
  getter,
190425
190432
  setter,
190426
190433
  initialValue,
190427
190434
  typedInitialValue: typedInitialValue !== initialValue ? typedInitialValue : undefined,
190435
+ templateInitialValue,
190428
190436
  type: type2,
190429
190437
  loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath),
190430
190438
  initialFreeIdentifiers: callExpr.arguments[0] ? extractFreeIdentifiersFromNode(callExpr.arguments[0]) : new Set,
@@ -191565,12 +191573,13 @@ function extractProps(param, ctx) {
191565
191573
  continue;
191566
191574
  }
191567
191575
  const sourcePropName = element.propertyName && import_typescript8.default.isIdentifier(element.propertyName) ? element.propertyName.text : localName;
191568
- const resolvedType = memberTypes?.get(sourcePropName) ?? { kind: "unknown", raw: "unknown" };
191576
+ const member = memberTypes?.get(sourcePropName);
191577
+ const resolvedType = member?.type ?? { kind: "unknown", raw: "unknown" };
191569
191578
  const defaultContainsArrow = element.initializer ? nodeContainsArrow(element.initializer) : false;
191570
191579
  ctx.propsParams.push({
191571
191580
  name: localName,
191572
191581
  type: resolvedType,
191573
- optional: !!element.initializer,
191582
+ optional: !!member?.optional || !!element.initializer,
191574
191583
  defaultValue,
191575
191584
  defaultContainsArrow: defaultContainsArrow || undefined
191576
191585
  });
@@ -191635,11 +191644,12 @@ function collectMemberTypes(typeNode, ctx) {
191635
191644
  const fromMembers = (members) => {
191636
191645
  const map = new Map;
191637
191646
  for (const member of members) {
191638
- if (import_typescript8.default.isPropertySignature(member) && member.name && member.type && !member.questionToken) {
191639
- const info = typeNodeToTypeInfo(member.type, ctx.sourceFile);
191640
- if (info && isResolvablePrimitive(info)) {
191641
- map.set(member.name.getText(ctx.sourceFile), info);
191642
- }
191647
+ if (import_typescript8.default.isPropertySignature(member) && member.name) {
191648
+ const info = member.type ? typeNodeToTypeInfo(member.type, ctx.sourceFile) : null;
191649
+ map.set(member.name.getText(ctx.sourceFile), {
191650
+ type: info && isResolvablePrimitive(info) ? info : null,
191651
+ optional: !!member.questionToken
191652
+ });
191643
191653
  }
191644
191654
  }
191645
191655
  return map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/test",
3
- "version": "0.18.7",
3
+ "version": "0.19.1",
4
4
  "description": "Test utilities for BarefootJS - IR-based component testing without a browser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "directory": "packages/test"
40
40
  },
41
41
  "dependencies": {
42
- "@barefootjs/jsx": "0.18.7"
42
+ "@barefootjs/jsx": "0.19.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "typescript": "^5.0.0"