@stylexjs/babel-plugin 0.14.0 → 0.14.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.
package/lib/index.js CHANGED
@@ -2135,13 +2135,17 @@ const shorthands$1 = {
2135
2135
  const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
2136
2136
  return [['marginTop', top], ['marginInlineEnd', right], ['marginBottom', bottom], ['marginInlineStart', left]];
2137
2137
  },
2138
- marginHorizontal: rawValue => [...shorthands$1.marginStart(rawValue), ...shorthands$1.marginEnd(rawValue)],
2138
+ marginHorizontal: rawValue => {
2139
+ const [start, end = start] = splitValue(rawValue);
2140
+ return [...shorthands$1.marginStart(start), ...shorthands$1.marginEnd(end)];
2141
+ },
2139
2142
  marginStart: rawValue => [['marginInlineStart', rawValue], ['marginLeft', null], ['marginRight', null]],
2140
2143
  marginEnd: rawValue => [['marginInlineEnd', rawValue], ['marginLeft', null], ['marginRight', null]],
2141
2144
  marginLeft: rawValue => [['marginLeft', rawValue], ['marginInlineStart', null], ['marginInlineEnd', null]],
2142
2145
  marginRight: rawValue => [['marginRight', rawValue], ['marginInlineStart', null], ['marginInlineEnd', null]],
2143
2146
  marginVertical: rawValue => {
2144
- return [['marginTop', rawValue], ['marginBottom', rawValue]];
2147
+ const [top, bottom = top] = splitValue(rawValue);
2148
+ return [['marginTop', top], ['marginBottom', bottom]];
2145
2149
  },
2146
2150
  overflow: rawValue => {
2147
2151
  const [x, y = x] = splitValue(rawValue);
@@ -2151,12 +2155,18 @@ const shorthands$1 = {
2151
2155
  const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
2152
2156
  return [['paddingTop', top], ['paddingInlineEnd', right], ['paddingBottom', bottom], ['paddingInlineStart', left]];
2153
2157
  },
2154
- paddingHorizontal: val => [...shorthands$1.paddingStart(val), ...shorthands$1.paddingEnd(val)],
2158
+ paddingHorizontal: val => {
2159
+ const [start, end = start] = splitValue(val);
2160
+ return [...shorthands$1.paddingStart(start), ...shorthands$1.paddingEnd(end)];
2161
+ },
2155
2162
  paddingStart: val => [['paddingInlineStart', val], ['paddingLeft', null], ['paddingRight', null]],
2156
2163
  paddingEnd: val => [['paddingInlineEnd', val], ['paddingLeft', null], ['paddingRight', null]],
2157
2164
  paddingLeft: val => [['paddingLeft', val], ['paddingStart', null], ['paddingEnd', null]],
2158
2165
  paddingRight: val => [['paddingRight', val], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
2159
- paddingVertical: val => [['paddingTop', val], ['paddingBottom', val]]
2166
+ paddingVertical: val => {
2167
+ const [top, bottom = top] = splitValue(val);
2168
+ return [['paddingTop', top], ['paddingBottom', bottom]];
2169
+ }
2160
2170
  };
2161
2171
  const aliases$1 = {
2162
2172
  insetBlockStart: val => [['top', val]],
@@ -2482,6 +2492,7 @@ const nonStaticValue = fn => `Only static values are allowed inside of a ${fn}()
2482
2492
  const nonStyleObject = fn => `${fn}() can only accept an object.`;
2483
2493
  const nonExportNamedDeclaration = fn => `The return value of ${fn}() must be bound to a named export.`;
2484
2494
  const unboundCallValue = fn => `${fn}() calls must be bound to a bare variable.`;
2495
+ const cannotGenerateHash = fn => `Unable to generate hash for ${fn}(). Check that the file has a valid extension and that unstable_moduleResolution is configured.`;
2485
2496
  const DUPLICATE_CONDITIONAL = 'The same pseudo selector or at-rule cannot be used more than once.';
2486
2497
  const ESCAPED_STYLEX_VALUE = 'Escaping a create() value is not allowed.';
2487
2498
  const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
@@ -2523,6 +2534,7 @@ var m = /*#__PURE__*/Object.freeze({
2523
2534
  POSITION_TRY_INVALID_PROPERTY: POSITION_TRY_INVALID_PROPERTY,
2524
2535
  UNKNOWN_PROP_KEY: UNKNOWN_PROP_KEY,
2525
2536
  VIEW_TRANSITION_CLASS_INVALID_PROPERTY: VIEW_TRANSITION_CLASS_INVALID_PROPERTY,
2537
+ cannotGenerateHash: cannotGenerateHash,
2526
2538
  illegalArgumentLength: illegalArgumentLength,
2527
2539
  nonExportNamedDeclaration: nonExportNamedDeclaration,
2528
2540
  nonStaticValue: nonStaticValue,
@@ -5953,7 +5965,7 @@ function transformStyleXDefineVars(callExpressionPath, state) {
5953
5965
  }
5954
5966
  const fileName = state.fileNameForHashing;
5955
5967
  if (fileName == null) {
5956
- throw new Error('No filename found for generating defineVars key name.');
5968
+ throw new Error(messages.cannotGenerateHash('defineVars'));
5957
5969
  }
5958
5970
  const exportName = varId.name;
5959
5971
  const [variablesObj, injectedStylesSansKeyframes] = defineVars(value, {
@@ -6016,7 +6028,7 @@ function transformStyleXDefineConsts(callExpressionPath, state) {
6016
6028
  }
6017
6029
  const fileName = state.fileNameForHashing;
6018
6030
  if (fileName == null) {
6019
- throw new Error('No filename found for generating defineConsts key name.');
6031
+ throw new Error(messages.cannotGenerateHash('defineConsts'));
6020
6032
  }
6021
6033
  const exportName = varId.name;
6022
6034
  const themeName = utils.genFileBasedIdentifier({
@@ -15,6 +15,7 @@ export declare const nonStaticValue: (fn: string) => string;
15
15
  export declare const nonStyleObject: (fn: string) => string;
16
16
  export declare const nonExportNamedDeclaration: (fn: string) => string;
17
17
  export declare const unboundCallValue: (fn: string) => string;
18
+ export declare const cannotGenerateHash: (fn: string) => string;
18
19
  export declare const DUPLICATE_CONDITIONAL: 'The same pseudo selector or at-rule cannot be used more than once.';
19
20
  export declare const ESCAPED_STYLEX_VALUE: 'Escaping a create() value is not allowed.';
20
21
  export declare const ILLEGAL_NESTED_PSEUDO: "Pseudo objects can't be nested more than one level deep.";
@@ -18,6 +18,7 @@ declare export const nonStaticValue: (fn: string) => string;
18
18
  declare export const nonStyleObject: (fn: string) => string;
19
19
  declare export const nonExportNamedDeclaration: (fn: string) => string;
20
20
  declare export const unboundCallValue: (fn: string) => string;
21
+ declare export const cannotGenerateHash: (fn: string) => string;
21
22
 
22
23
  declare export const DUPLICATE_CONDITIONAL: 'The same pseudo selector or at-rule cannot be used more than once.';
23
24
  declare export const ESCAPED_STYLEX_VALUE: 'Escaping a create() value is not allowed.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "@babel/traverse": "^7.26.8",
22
22
  "@babel/types": "^7.26.8",
23
23
  "@dual-bundle/import-meta-resolve": "^4.1.0",
24
- "@stylexjs/stylex": "0.14.0",
24
+ "@stylexjs/stylex": "0.14.1",
25
25
  "postcss-value-parser": "^4.1.0"
26
26
  },
27
27
  "devDependencies": {
@@ -33,7 +33,7 @@
33
33
  "@rollup/plugin-replace": "^6.0.1",
34
34
  "babel-plugin-syntax-hermes-parser": "^0.26.0",
35
35
  "rollup": "^4.24.0",
36
- "scripts": "0.14.0"
36
+ "scripts": "0.14.1"
37
37
  },
38
38
  "files": [
39
39
  "flow_modules/*",