@wix/origami-lint 1.34.12 → 1.34.13

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,4 +1,4 @@
1
- import { BREAKPOINT_AT_RULES, createCssFileReporter, describeAtRule, getCssChildren, getDashedId, getSegmentClass, getSelectorSegments, isCssIdentifier, isSafeCssIdentifier } from "../../rules-api/index.js";
1
+ import { BREAKPOINT_AT_RULES, createCssFileReporter, describeAtRule, getCssChildren, getDashedId, getMixinId, getSegmentClass, getSelectorSegments, isCssIdentifier, isSafeCssIdentifier } from "../../rules-api/index.js";
2
2
  import { defineRule } from "./define-rule.js";
3
3
  export default defineRule({
4
4
  name: 'global-styles',
@@ -150,11 +150,6 @@ function checkLinkOrValues(group, linkedParts, reportInFile) {
150
150
  reportInFile(first.node, `\`@mixin --${first.mixin}\` styles \`${part}\` but links no global style there: add \`& ${part} { @apply --<child> }\` and move the values to that child's @mixin (tracker CONV-styleParser.ts:698).`);
151
151
  }
152
152
  // ── reading a mixin ──
153
- /** The id a `@mixin` declares (`--btn` → 'btn'), or null when it isn't one dashed identifier. */
154
- function getMixinId(mixin) {
155
- const id = getDashedId(mixin.params);
156
- return id !== undefined && isSafeCssIdentifier(id) ? id : null;
157
- }
158
153
  /** The mixin's one `@result` with no params and a block, beside nothing; undefined otherwise. */
159
154
  function getResult(mixin) {
160
155
  if (mixin.nodes === undefined)
@@ -3,4 +3,4 @@ export { createRulesApi, getOrCreateRulesApi } from "./rules-api.js";
3
3
  export { createCssFileReporter, describeAtRule, reportCssProblem } from "./report.js";
4
4
  export { bare, getAttribute, getExpression, getKey, getName, getObject, getProperties, getCallbackKind, getParamReadKind, getProperty, isBound, isOneEditAway, isReservedAttribute, isStructure, ownerOf, } from "../shared/utils.js";
5
5
  export { BUILDERS, CALLBACK_PROP, DATA_KEY, EVENT_ATTRIBUTE, GLOBAL_SECTIONS, INSTANCE_PROPS, LAYER_ATTRIBUTES, RESERVED_ATTRIBUTES, RESERVED_ENTRY_KEYS, RUNTIME_ONLY_BUILDERS, RUNTIME_PACKAGE, SECTIONS, SHARED_COMP_ID, STRUCTURE, SYSTEM_PACKAGE, TRANSFORM_BUILDERS, TYPED_BUILDERS, WRAPPERS, } from "../shared/constants.js";
6
- export { BREAKPOINT_AT_RULES, CONTENT_TARGET, getCssChildren, getDashedId, getSegmentClass, getSelectorSegments, isCssIdentifier, isPresetProperty, isSafeCssIdentifier, ORIGAMI_TARGETS, OVERFLOW_TARGET, PREAMBLE_LAYER, readSegment } from "../shared/css.js";
6
+ export { BREAKPOINT_AT_RULES, CONTENT_TARGET, getCssChildren, getDashedId, getMixinId, getSegmentClass, getSelectorSegments, isCssIdentifier, isPresetProperty, isSafeCssIdentifier, ORIGAMI_TARGETS, OVERFLOW_TARGET, PREAMBLE_LAYER, readSegment } from "../shared/css.js";
@@ -49,6 +49,11 @@ export const getCssChildren = (node) => (node.nodes ?? []).filter((child) => chi
49
49
  export const isPresetProperty = (prop) => prop === '--preset' || prop.startsWith('--preset-');
50
50
  /** The id a `@mixin` or `@apply` names: '--btn' → 'btn' (spaces around aside); undefined when its params aren't `--` and one word. */
51
51
  export const getDashedId = (params) => DASHED_ID.exec(params.trim())?.[1];
52
+ /** The id a `@mixin` declares (`--btn` → 'btn'), or null when it isn't one dashed identifier. */
53
+ export function getMixinId(mixin) {
54
+ const id = getDashedId(mixin.params);
55
+ return id !== undefined && isSafeCssIdentifier(id) ? id : null;
56
+ }
52
57
  /** Whether the import reads this as an identifier (cssSelectors.ts `isCssIdentifier`): letters, digits, - and _, not starting with a digit. */
53
58
  export const isCssIdentifier = (id) => CSS_IDENT.test(id);
54
59
  /** Whether the import takes this as a name (a mixin id, a preset path's part; cssSelectors.ts `isSafeCssIdentifier`): an identifier, not a reserved name. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/origami-lint",
3
- "version": "1.34.12",
3
+ "version": "1.34.13",
4
4
  "description": "Offline lint for an exported Origami site: lints the pages that changed since the last passing run",
5
5
  "type": "module",
6
6
  "bin": {
@@ -52,5 +52,5 @@
52
52
  ]
53
53
  }
54
54
  },
55
- "falconPackageHash": "c50f6ccef419b969c9a223c3355e8bf3623b41236d615b837ffd5283"
55
+ "falconPackageHash": "70a9ee3d299565f2869a89a7c2269513b67bdf6101e989b4545ecc19"
56
56
  }