@lwc/babel-plugin-component 8.12.7-alpha.0 → 8.12.7

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,3 +1,4 @@
1
1
  import type { Visitor } from '@babel/core';
2
2
  import type { BabelAPI, LwcBabelPluginPass } from './types';
3
3
  export default function compilerVersionNumber({ types: t }: BabelAPI): Visitor<LwcBabelPluginPass>;
4
+ //# sourceMappingURL=compiler-version-number.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { Visitor } from '@babel/core';
2
2
  import type { BabelAPI, LwcBabelPluginPass } from './types';
3
3
  export default function ({ types: t }: BabelAPI): Visitor<LwcBabelPluginPass>;
4
+ //# sourceMappingURL=component.d.ts.map
@@ -26,3 +26,4 @@ declare const COMPONENT_NAME_KEY = "sel";
26
26
  declare const API_VERSION_KEY = "apiVersion";
27
27
  declare const COMPONENT_CLASS_ID = "__lwc_component_class_internal";
28
28
  export { AMBIGUOUS_PROP_SET, DECORATOR_TYPES, DISALLOWED_PROP_SET, LWC_PACKAGE_ALIAS, LWC_PACKAGE_EXPORTS, LWC_COMPONENT_PROPERTIES, REGISTER_COMPONENT_ID, REGISTER_DECORATORS_ID, TEMPLATE_KEY, COMPONENT_NAME_KEY, API_VERSION_KEY, COMPONENT_CLASS_ID, };
29
+ //# sourceMappingURL=constants.d.ts.map
@@ -6,3 +6,4 @@ declare const _default: {
6
6
  transform: typeof transform;
7
7
  };
8
8
  export default _default;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { DecoratorMeta } from '../index';
2
2
  declare function isApiDecorator(decorator: DecoratorMeta): boolean;
3
3
  export { isApiDecorator };
4
+ //# sourceMappingURL=shared.d.ts.map
@@ -3,3 +3,4 @@ import type { DecoratorMeta } from '../index';
3
3
  import type { BabelTypes } from '../../types';
4
4
  import type { ClassBodyItem } from '../types';
5
5
  export default function transform(t: BabelTypes, decoratorMetas: DecoratorMeta[], classBodyItems: NodePath<ClassBodyItem>[]): types.ObjectProperty[];
6
+ //# sourceMappingURL=transform.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { LwcBabelPluginPass } from '../../types';
2
2
  import type { DecoratorMeta } from '../index';
3
3
  export default function validate(decorators: DecoratorMeta[], state: LwcBabelPluginPass): void;
4
+ //# sourceMappingURL=validate.d.ts.map
@@ -21,3 +21,4 @@ declare function removeImportedDecoratorSpecifiers(engineImportSpecifiers: {
21
21
  }[]): void;
22
22
  declare function decorators({ types: t }: BabelAPI): Visitor<LwcBabelPluginPass>;
23
23
  export { decorators, removeImportedDecoratorSpecifiers, validateImportedLwcDecoratorUsage };
24
+ //# sourceMappingURL=index.d.ts.map
@@ -8,3 +8,4 @@ declare const _default: {
8
8
  validate: typeof validate;
9
9
  };
10
10
  export default _default;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -16,3 +16,4 @@ export type BindingOptions = {
16
16
  };
17
17
  export type ClassBodyItem = types.ClassMethod | types.ClassPrivateMethod | types.ClassProperty | types.ClassPrivateProperty | types.ClassAccessorProperty | types.StaticBlock;
18
18
  export type LwcDecoratorName = 'api' | 'track' | 'wire';
19
+ //# sourceMappingURL=types.d.ts.map
@@ -6,3 +6,4 @@ declare const _default: {
6
6
  transform: typeof transform;
7
7
  };
8
8
  export default _default;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { DecoratorMeta } from '../index';
2
2
  declare function isWireDecorator(decorator: DecoratorMeta): boolean;
3
3
  export { isWireDecorator };
4
+ //# sourceMappingURL=shared.d.ts.map
@@ -2,3 +2,4 @@ import type { types } from '@babel/core';
2
2
  import type { DecoratorMeta } from '../index';
3
3
  import type { BabelTypes } from '../../types';
4
4
  export default function transform(t: BabelTypes, decoratorMetas: DecoratorMeta[]): types.ObjectProperty[];
5
+ //# sourceMappingURL=transform.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { LwcBabelPluginPass } from '../../types';
2
2
  import type { DecoratorMeta } from '../index';
3
3
  export default function validate(decorators: DecoratorMeta[], state: LwcBabelPluginPass): void;
4
+ //# sourceMappingURL=validate.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { types, NodePath } from '@babel/core';
2
2
  import type { BabelAPI } from './types';
3
3
  export default function ({ types: t }: BabelAPI): (path: NodePath<types.Program>) => void;
4
+ //# sourceMappingURL=dedupe-imports.d.ts.map
@@ -5,3 +5,4 @@ import type { LwcBabelPluginPass } from './types';
5
5
  * { dynamicImports: { loader: string, strictSpecifier: boolean } }
6
6
  */
7
7
  export default function (): Visitor<LwcBabelPluginPass>;
8
+ //# sourceMappingURL=dynamic-imports.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -474,38 +474,47 @@ function validateWireId(id, path, state) {
474
474
  errorInfo: errors.DecoratorErrors.ADAPTER_SHOULD_BE_FIRST_PARAMETER,
475
475
  }, state);
476
476
  }
477
- const isMemberExpression = id.isMemberExpression();
478
- if (!id.isIdentifier() && !isMemberExpression) {
479
- throw generateError(id, {
480
- errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
481
- }, state);
477
+ let adapter;
478
+ if (id.isIdentifier()) {
479
+ // @wire(adapter)
480
+ adapter = id;
482
481
  }
483
- if (id.isMemberExpression({ computed: true })) {
484
- throw generateError(id, {
485
- errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
486
- }, state);
482
+ else if (id.isMemberExpression()) {
483
+ if (id.node.computed) {
484
+ // @wire(adapter[computed])
485
+ throw generateError(id, {
486
+ errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
487
+ }, state);
488
+ }
489
+ const object = id.get('object');
490
+ if (object.isIdentifier()) {
491
+ // @wire(adapter.foo)
492
+ adapter = object;
493
+ }
494
+ else {
495
+ // @wire(adapter.foo.bar)
496
+ throw generateError(id, {
497
+ errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
498
+ }, state);
499
+ }
487
500
  }
488
- // TODO [#3444]: improve member expression computed typechecking
489
- // @ts-expect-error type narrowing incorrectly reduces id to `never`
490
- if (isMemberExpression && !id.get('object').isIdentifier()) {
501
+ else {
502
+ // @wire(1), @wire('adapter'), @wire(function adapter() {}), etc.
491
503
  throw generateError(id, {
492
- errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
504
+ errorInfo: errors.DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
493
505
  }, state);
494
506
  }
495
- // TODO [#3444]: improve member expression computed typechecking
496
507
  // Ensure wire adapter is imported (check for member expression or identifier)
497
- // @ts-expect-error type narrowing incorrectly reduces id to `never`
498
- const wireBinding = isMemberExpression ? id.node.object.name : id.node.name;
499
- if (!path.scope.getBinding(wireBinding)) {
508
+ const adapterBinding = path.scope.getBinding(adapter.node.name);
509
+ if (!adapterBinding) {
500
510
  throw generateError(id, {
501
511
  errorInfo: errors.DecoratorErrors.WIRE_ADAPTER_SHOULD_BE_IMPORTED,
502
- messageArgs: [id.node.name],
512
+ messageArgs: [adapter.node.name],
503
513
  }, state);
504
514
  }
505
515
  // ensure wire adapter is a first parameter
506
- if (wireBinding &&
507
- !path.scope.getBinding(wireBinding).path.isImportSpecifier() &&
508
- !path.scope.getBinding(wireBinding).path.isImportDefaultSpecifier()) {
516
+ if (!adapterBinding.path.isImportSpecifier() &&
517
+ !adapterBinding.path.isImportDefaultSpecifier()) {
509
518
  throw generateError(id, {
510
519
  errorInfo: errors.DecoratorErrors.IMPORTED_FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
511
520
  }, state);
@@ -1276,5 +1285,5 @@ function LwcClassTransform(api) {
1276
1285
  }
1277
1286
 
1278
1287
  exports.default = LwcClassTransform;
1279
- /** version: 8.12.2 */
1288
+ /** version: 8.12.7 */
1280
1289
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export type { LwcBabelPluginOptions } from './types';
8
8
  * @param api
9
9
  */
10
10
  export default function LwcClassTransform(api: BabelAPI): PluginObj<LwcBabelPluginPass>;
11
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -470,38 +470,47 @@ function validateWireId(id, path, state) {
470
470
  errorInfo: DecoratorErrors.ADAPTER_SHOULD_BE_FIRST_PARAMETER,
471
471
  }, state);
472
472
  }
473
- const isMemberExpression = id.isMemberExpression();
474
- if (!id.isIdentifier() && !isMemberExpression) {
475
- throw generateError(id, {
476
- errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
477
- }, state);
473
+ let adapter;
474
+ if (id.isIdentifier()) {
475
+ // @wire(adapter)
476
+ adapter = id;
478
477
  }
479
- if (id.isMemberExpression({ computed: true })) {
480
- throw generateError(id, {
481
- errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
482
- }, state);
478
+ else if (id.isMemberExpression()) {
479
+ if (id.node.computed) {
480
+ // @wire(adapter[computed])
481
+ throw generateError(id, {
482
+ errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
483
+ }, state);
484
+ }
485
+ const object = id.get('object');
486
+ if (object.isIdentifier()) {
487
+ // @wire(adapter.foo)
488
+ adapter = object;
489
+ }
490
+ else {
491
+ // @wire(adapter.foo.bar)
492
+ throw generateError(id, {
493
+ errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
494
+ }, state);
495
+ }
483
496
  }
484
- // TODO [#3444]: improve member expression computed typechecking
485
- // @ts-expect-error type narrowing incorrectly reduces id to `never`
486
- if (isMemberExpression && !id.get('object').isIdentifier()) {
497
+ else {
498
+ // @wire(1), @wire('adapter'), @wire(function adapter() {}), etc.
487
499
  throw generateError(id, {
488
- errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
500
+ errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
489
501
  }, state);
490
502
  }
491
- // TODO [#3444]: improve member expression computed typechecking
492
503
  // Ensure wire adapter is imported (check for member expression or identifier)
493
- // @ts-expect-error type narrowing incorrectly reduces id to `never`
494
- const wireBinding = isMemberExpression ? id.node.object.name : id.node.name;
495
- if (!path.scope.getBinding(wireBinding)) {
504
+ const adapterBinding = path.scope.getBinding(adapter.node.name);
505
+ if (!adapterBinding) {
496
506
  throw generateError(id, {
497
507
  errorInfo: DecoratorErrors.WIRE_ADAPTER_SHOULD_BE_IMPORTED,
498
- messageArgs: [id.node.name],
508
+ messageArgs: [adapter.node.name],
499
509
  }, state);
500
510
  }
501
511
  // ensure wire adapter is a first parameter
502
- if (wireBinding &&
503
- !path.scope.getBinding(wireBinding).path.isImportSpecifier() &&
504
- !path.scope.getBinding(wireBinding).path.isImportDefaultSpecifier()) {
512
+ if (!adapterBinding.path.isImportSpecifier() &&
513
+ !adapterBinding.path.isImportDefaultSpecifier()) {
505
514
  throw generateError(id, {
506
515
  errorInfo: DecoratorErrors.IMPORTED_FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
507
516
  }, state);
@@ -1272,5 +1281,5 @@ function LwcClassTransform(api) {
1272
1281
  }
1273
1282
 
1274
1283
  export { LwcClassTransform as default };
1275
- /** version: 8.12.2 */
1284
+ /** version: 8.12.7 */
1276
1285
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,4 @@
1
1
  import type { NodePath } from '@babel/core';
2
2
  import type { BabelAPI } from './types';
3
3
  export default function ({ types: t }: BabelAPI, path: NodePath): void;
4
+ //# sourceMappingURL=scope-css-imports.d.ts.map
package/dist/types.d.ts CHANGED
@@ -19,3 +19,4 @@ export interface LwcBabelPluginPass extends PluginPass {
19
19
  dynamicImports?: string[];
20
20
  loaderRef?: types.Identifier;
21
21
  }
22
+ //# sourceMappingURL=types.d.ts.map
package/dist/utils.d.ts CHANGED
@@ -11,13 +11,14 @@ declare function isGetterClassMethod(classMethod: NodePath<types.Node>, properti
11
11
  kind?: string;
12
12
  name?: string;
13
13
  static?: boolean;
14
- }): boolean;
14
+ }): classMethod is NodePath<types.ClassMethod>;
15
15
  declare function isSetterClassMethod(classMethod: NodePath<types.Node>, properties?: {
16
16
  kind?: string;
17
17
  name?: string;
18
18
  static?: boolean;
19
- }): boolean;
19
+ }): classMethod is NodePath<types.ClassMethod>;
20
20
  declare function getEngineImportSpecifiers(path: NodePath): ImportSpecifier[];
21
21
  declare function generateError(source: NodePath<types.Node>, { errorInfo, messageArgs }: DecoratorErrorOptions, state: LwcBabelPluginPass): Error;
22
22
  declare function incrementMetricCounter(metric: CompilerMetrics, state: LwcBabelPluginPass): void;
23
23
  export { isClassMethod, isGetterClassMethod, isSetterClassMethod, generateError, getEngineImportSpecifiers, incrementMetricCounter, };
24
+ //# sourceMappingURL=utils.d.ts.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/babel-plugin-component",
7
- "version": "8.12.7-alpha.0",
7
+ "version": "8.12.7",
8
8
  "description": "Babel plugin to transform a LWC module",
9
9
  "keywords": [
10
10
  "lwc"
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@babel/helper-module-imports": "7.25.9",
50
- "@lwc/errors": "8.12.7-alpha.0",
51
- "@lwc/shared": "8.12.7-alpha.0",
50
+ "@lwc/errors": "8.12.7",
51
+ "@lwc/shared": "8.12.7",
52
52
  "line-column": "~1.0.2"
53
53
  },
54
54
  "devDependencies": {
@@ -58,4 +58,4 @@
58
58
  "peerDependencies": {
59
59
  "@babel/core": "^7"
60
60
  }
61
- }
61
+ }