@barefootjs/test 0.18.2 → 0.18.4

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 +121 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -188929,6 +188929,93 @@ var BOOLEAN_ATTRS = new Set([
188929
188929
  "novalidate",
188930
188930
  "formnovalidate"
188931
188931
  ]);
188932
+ var SVG_CAMEL_TO_KEBAB = {
188933
+ strokeWidth: "stroke-width",
188934
+ strokeLinecap: "stroke-linecap",
188935
+ strokeLinejoin: "stroke-linejoin",
188936
+ strokeDasharray: "stroke-dasharray",
188937
+ strokeDashoffset: "stroke-dashoffset",
188938
+ strokeMiterlimit: "stroke-miterlimit",
188939
+ strokeOpacity: "stroke-opacity",
188940
+ fillOpacity: "fill-opacity",
188941
+ fillRule: "fill-rule",
188942
+ stopColor: "stop-color",
188943
+ stopOpacity: "stop-opacity",
188944
+ textAnchor: "text-anchor",
188945
+ dominantBaseline: "dominant-baseline",
188946
+ alignmentBaseline: "alignment-baseline",
188947
+ fontFamily: "font-family",
188948
+ fontSize: "font-size",
188949
+ fontWeight: "font-weight",
188950
+ fontStyle: "font-style",
188951
+ letterSpacing: "letter-spacing",
188952
+ wordSpacing: "word-spacing",
188953
+ pointerEvents: "pointer-events",
188954
+ vectorEffect: "vector-effect",
188955
+ colorInterpolation: "color-interpolation",
188956
+ clipPath: "clip-path",
188957
+ clipRule: "clip-rule",
188958
+ markerStart: "marker-start",
188959
+ markerMid: "marker-mid",
188960
+ markerEnd: "marker-end"
188961
+ };
188962
+ var HTML_CAMEL_ALIASES = {
188963
+ acceptCharset: "accept-charset",
188964
+ accessKey: "accesskey",
188965
+ allowFullScreen: "allowfullscreen",
188966
+ autoCapitalize: "autocapitalize",
188967
+ autoComplete: "autocomplete",
188968
+ autoCorrect: "autocorrect",
188969
+ autoFocus: "autofocus",
188970
+ autoPlay: "autoplay",
188971
+ cellPadding: "cellpadding",
188972
+ cellSpacing: "cellspacing",
188973
+ charSet: "charset",
188974
+ colSpan: "colspan",
188975
+ contentEditable: "contenteditable",
188976
+ controlsList: "controlslist",
188977
+ crossOrigin: "crossorigin",
188978
+ dateTime: "datetime",
188979
+ dirName: "dirname",
188980
+ encType: "enctype",
188981
+ enterKeyHint: "enterkeyhint",
188982
+ fetchPriority: "fetchpriority",
188983
+ formAction: "formaction",
188984
+ formEncType: "formenctype",
188985
+ formMethod: "formmethod",
188986
+ formNoValidate: "formnovalidate",
188987
+ formTarget: "formtarget",
188988
+ frameBorder: "frameborder",
188989
+ hrefLang: "hreflang",
188990
+ httpEquiv: "http-equiv",
188991
+ imageSizes: "imagesizes",
188992
+ imageSrcSet: "imagesrcset",
188993
+ inputMode: "inputmode",
188994
+ itemID: "itemid",
188995
+ itemProp: "itemprop",
188996
+ itemRef: "itemref",
188997
+ itemScope: "itemscope",
188998
+ itemType: "itemtype",
188999
+ marginHeight: "marginheight",
189000
+ marginWidth: "marginwidth",
189001
+ maxLength: "maxlength",
189002
+ minLength: "minlength",
189003
+ noModule: "nomodule",
189004
+ noValidate: "novalidate",
189005
+ playsInline: "playsinline",
189006
+ popoverTarget: "popovertarget",
189007
+ popoverTargetAction: "popovertargetaction",
189008
+ radioGroup: "radiogroup",
189009
+ readOnly: "readonly",
189010
+ referrerPolicy: "referrerpolicy",
189011
+ rowSpan: "rowspan",
189012
+ spellCheck: "spellcheck",
189013
+ srcDoc: "srcdoc",
189014
+ srcLang: "srclang",
189015
+ srcSet: "srcset",
189016
+ tabIndex: "tabindex",
189017
+ useMap: "usemap"
189018
+ };
188932
189019
  var SVG_XML_CAMEL_ATTRS = new Set([
188933
189020
  "allowReorder",
188934
189021
  "attributeName",
@@ -188995,6 +189082,19 @@ var SVG_XML_CAMEL_ATTRS = new Set([
188995
189082
  "yChannelSelector",
188996
189083
  "zoomAndPan"
188997
189084
  ]);
189085
+ function toHTMLAttrName(key) {
189086
+ if (key === "className")
189087
+ return "class";
189088
+ if (key === "htmlFor")
189089
+ return "for";
189090
+ const htmlAlias = HTML_CAMEL_ALIASES[key];
189091
+ if (htmlAlias !== undefined)
189092
+ return htmlAlias;
189093
+ const svgKebab = SVG_CAMEL_TO_KEBAB[key];
189094
+ if (svgKebab !== undefined)
189095
+ return svgKebab;
189096
+ return key;
189097
+ }
188998
189098
  // ../jsx/src/ir-to-client-js/utils.ts
188999
189099
  var PROPS_PARAM = "_p";
189000
189100
  // ../jsx/src/ir-to-client-js/component-scope.ts
@@ -192445,6 +192545,9 @@ function resolveFreeRefsInternal(node, env, visited) {
192445
192545
  }
192446
192546
  return out;
192447
192547
  }
192548
+ function isNameBound(name, env) {
192549
+ return buildBindingMap(env).has(name);
192550
+ }
192448
192551
  function resolveFreeRefs(node, env) {
192449
192552
  return resolveFreeRefsInternal(node, env, new Set);
192450
192553
  }
@@ -192887,7 +192990,7 @@ function clientBuiltinTags(ctx) {
192887
192990
  ctx._clientBuiltinTags = map;
192888
192991
  return map;
192889
192992
  }
192890
- function isNameBound(ctx, name) {
192993
+ function isNameBound2(ctx, name) {
192891
192994
  const a = ctx.analyzer;
192892
192995
  if (a.ambientGlobals.has(name))
192893
192996
  return true;
@@ -192922,7 +193025,7 @@ function dispatchClientBuiltin(tagName, ctx, diagNode, transformAsync, transform
192922
193025
  return transformAsync();
192923
193026
  if (builtin === "Region")
192924
193027
  return transformRegion();
192925
- if (isClientBuiltinName(tagName) && !isNameBound(ctx, tagName)) {
193028
+ if (isClientBuiltinName(tagName) && !isNameBound2(ctx, tagName)) {
192926
193029
  reportBuiltinNotImported(ctx, diagNode, tagName);
192927
193030
  }
192928
193031
  return null;
@@ -193237,6 +193340,13 @@ function transformChildren(children, ctx) {
193237
193340
  }
193238
193341
  return result;
193239
193342
  }
193343
+ function isRenderNothingLiteral(expr, ctx) {
193344
+ let e = expr;
193345
+ while (import_typescript11.default.isParenthesizedExpression(e) || import_typescript11.default.isAsExpression(e) || import_typescript11.default.isSatisfiesExpression(e) || import_typescript11.default.isNonNullExpression(e)) {
193346
+ e = e.expression;
193347
+ }
193348
+ return e.kind === import_typescript11.default.SyntaxKind.NullKeyword || e.kind === import_typescript11.default.SyntaxKind.TrueKeyword || e.kind === import_typescript11.default.SyntaxKind.FalseKeyword || import_typescript11.default.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx));
193349
+ }
193240
193350
  function transformText(node, ctx) {
193241
193351
  const text = node.text.replace(/\s+/g, " ");
193242
193352
  if (text.trim() === "") {
@@ -193257,6 +193367,9 @@ function transformExpression(node, ctx) {
193257
193367
  }
193258
193368
  function transformExpressionInner(expr, ctx, node, isClientOnly) {
193259
193369
  expr = tryDesugarInterleaveTaggedTemplate(expr, ctx);
193370
+ if (isRenderNothingLiteral(expr, ctx)) {
193371
+ return null;
193372
+ }
193260
193373
  checkBareSignalOrMemoIdentifier(expr, ctx);
193261
193374
  if (import_typescript11.default.isIdentifier(expr)) {
193262
193375
  const jsxNode = ctx.analyzer.jsxConstants.get(expr.text);
@@ -194716,27 +194829,28 @@ function processAttributes(attributes, ctx) {
194716
194829
  }
194717
194830
  if (!import_typescript11.default.isJsxAttribute(attr))
194718
194831
  continue;
194719
- const name = attr.name.getText(ctx.sourceFile);
194720
- if (name === "ref") {
194832
+ const rawName = attr.name.getText(ctx.sourceFile);
194833
+ if (rawName === "ref") {
194721
194834
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
194722
194835
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
194723
194836
  ref = ctx.getJS(attr.initializer.expression);
194724
194837
  }
194725
194838
  continue;
194726
194839
  }
194727
- if (/^on[A-Z]/.test(name)) {
194840
+ if (/^on[A-Z]/.test(rawName)) {
194728
194841
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
194729
- const eventName = name.slice(2).toLowerCase();
194842
+ const eventName = rawName.slice(2).toLowerCase();
194730
194843
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
194731
194844
  events.push({
194732
194845
  name: eventName,
194733
- originalAttr: name,
194846
+ originalAttr: rawName,
194734
194847
  handler: ctx.getJS(attr.initializer.expression),
194735
194848
  loc: getSourceLocation(attr, ctx.sourceFile, ctx.filePath)
194736
194849
  });
194737
194850
  }
194738
194851
  continue;
194739
194852
  }
194853
+ const name = toHTMLAttrName(rawName);
194740
194854
  let value = getAttributeValue(attr, ctx);
194741
194855
  let clientOnly;
194742
194856
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/test",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
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.2"
42
+ "@barefootjs/jsx": "0.18.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "typescript": "^5.0.0"