@lwc/babel-plugin-component 8.23.0 → 8.24.0

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.
@@ -24,5 +24,6 @@ declare const COMPONENT_NAME_KEY = "sel";
24
24
  declare const API_VERSION_KEY = "apiVersion";
25
25
  declare const COMPONENT_CLASS_ID = "__lwc_component_class_internal";
26
26
  declare const SYNTHETIC_ELEMENT_INTERNALS_KEY = "enableSyntheticElementInternals";
27
- export { DECORATOR_TYPES, 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, SYNTHETIC_ELEMENT_INTERNALS_KEY, };
27
+ declare const COMPONENT_FEATURE_FLAG_KEY = "componentFeatureFlag";
28
+ export { DECORATOR_TYPES, 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, SYNTHETIC_ELEMENT_INTERNALS_KEY, COMPONENT_FEATURE_FLAG_KEY, };
28
29
  //# sourceMappingURL=constants.d.ts.map
package/dist/index.cjs.js CHANGED
@@ -42,6 +42,7 @@ const COMPONENT_NAME_KEY = 'sel';
42
42
  const API_VERSION_KEY = 'apiVersion';
43
43
  const COMPONENT_CLASS_ID = '__lwc_component_class_internal';
44
44
  const SYNTHETIC_ELEMENT_INTERNALS_KEY = 'enableSyntheticElementInternals';
45
+ const COMPONENT_FEATURE_FLAG_KEY = 'componentFeatureFlag';
45
46
 
46
47
  /*
47
48
  * Copyright (c) 2023, salesforce.com, inc.
@@ -75,6 +76,13 @@ function component ({ types: t }) {
75
76
  function createRegisterComponent(declarationPath, state) {
76
77
  const registerComponentId = helperModuleImports.addNamed(declarationPath, REGISTER_COMPONENT_ID, LWC_PACKAGE_ALIAS);
77
78
  const templateIdentifier = importDefaultTemplate(declarationPath, state);
79
+ // Optionally import feature flag module if provided via compiler options
80
+ let componentFeatureFlagIdentifier;
81
+ if (state.opts.componentFeatureFlagModulePath) {
82
+ componentFeatureFlagIdentifier = helperModuleImports.addDefault(declarationPath, state.opts.componentFeatureFlagModulePath, {
83
+ nameHint: COMPONENT_FEATURE_FLAG_KEY,
84
+ });
85
+ }
78
86
  const statementPath = declarationPath.getStatementParent();
79
87
  const componentRegisteredName = getComponentRegisteredName(t, state);
80
88
  let node = declarationPath.node;
@@ -103,6 +111,14 @@ function component ({ types: t }) {
103
111
  // The client needs to trust the server that it's providing an actual known API version
104
112
  t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
105
113
  ];
114
+ if (componentFeatureFlagIdentifier) {
115
+ properties.push(t.objectProperty(t.identifier(COMPONENT_FEATURE_FLAG_KEY), t.objectExpression([
116
+ t.objectProperty(t.identifier('value'), t.callExpression(t.identifier('Boolean'), [
117
+ componentFeatureFlagIdentifier,
118
+ ])),
119
+ t.objectProperty(t.identifier('path'), t.stringLiteral(state.opts.componentFeatureFlagModulePath)),
120
+ ])));
121
+ }
106
122
  // Only include enableSyntheticElementInternals if set to true
107
123
  if (state.opts.enableSyntheticElementInternals === true) {
108
124
  properties.push(t.objectProperty(t.identifier(SYNTHETIC_ELEMENT_INTERNALS_KEY), t.booleanLiteral(true)));
@@ -1273,5 +1289,5 @@ function LwcClassTransform(api) {
1273
1289
  }
1274
1290
 
1275
1291
  exports.default = LwcClassTransform;
1276
- /** version: 8.23.0 */
1292
+ /** version: 8.24.0 */
1277
1293
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ const COMPONENT_NAME_KEY = 'sel';
38
38
  const API_VERSION_KEY = 'apiVersion';
39
39
  const COMPONENT_CLASS_ID = '__lwc_component_class_internal';
40
40
  const SYNTHETIC_ELEMENT_INTERNALS_KEY = 'enableSyntheticElementInternals';
41
+ const COMPONENT_FEATURE_FLAG_KEY = 'componentFeatureFlag';
41
42
 
42
43
  /*
43
44
  * Copyright (c) 2023, salesforce.com, inc.
@@ -71,6 +72,13 @@ function component ({ types: t }) {
71
72
  function createRegisterComponent(declarationPath, state) {
72
73
  const registerComponentId = addNamed(declarationPath, REGISTER_COMPONENT_ID, LWC_PACKAGE_ALIAS);
73
74
  const templateIdentifier = importDefaultTemplate(declarationPath, state);
75
+ // Optionally import feature flag module if provided via compiler options
76
+ let componentFeatureFlagIdentifier;
77
+ if (state.opts.componentFeatureFlagModulePath) {
78
+ componentFeatureFlagIdentifier = addDefault(declarationPath, state.opts.componentFeatureFlagModulePath, {
79
+ nameHint: COMPONENT_FEATURE_FLAG_KEY,
80
+ });
81
+ }
74
82
  const statementPath = declarationPath.getStatementParent();
75
83
  const componentRegisteredName = getComponentRegisteredName(t, state);
76
84
  let node = declarationPath.node;
@@ -99,6 +107,14 @@ function component ({ types: t }) {
99
107
  // The client needs to trust the server that it's providing an actual known API version
100
108
  t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
101
109
  ];
110
+ if (componentFeatureFlagIdentifier) {
111
+ properties.push(t.objectProperty(t.identifier(COMPONENT_FEATURE_FLAG_KEY), t.objectExpression([
112
+ t.objectProperty(t.identifier('value'), t.callExpression(t.identifier('Boolean'), [
113
+ componentFeatureFlagIdentifier,
114
+ ])),
115
+ t.objectProperty(t.identifier('path'), t.stringLiteral(state.opts.componentFeatureFlagModulePath)),
116
+ ])));
117
+ }
102
118
  // Only include enableSyntheticElementInternals if set to true
103
119
  if (state.opts.enableSyntheticElementInternals === true) {
104
120
  properties.push(t.objectProperty(t.identifier(SYNTHETIC_ELEMENT_INTERNALS_KEY), t.booleanLiteral(true)));
@@ -1269,5 +1285,5 @@ function LwcClassTransform(api) {
1269
1285
  }
1270
1286
 
1271
1287
  export { LwcClassTransform as default };
1272
- /** version: 8.23.0 */
1288
+ /** version: 8.24.0 */
1273
1289
  //# sourceMappingURL=index.js.map
package/dist/types.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface LwcBabelPluginOptions {
14
14
  instrumentation?: InstrumentationObject;
15
15
  apiVersion?: number;
16
16
  enableSyntheticElementInternals?: boolean;
17
+ componentFeatureFlagModulePath?: string;
17
18
  }
18
19
  export interface LwcBabelPluginPass extends PluginPass {
19
20
  opts: LwcBabelPluginOptions;
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.23.0",
7
+ "version": "8.24.0",
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.27.1",
50
- "@lwc/errors": "8.23.0",
51
- "@lwc/shared": "8.23.0",
50
+ "@lwc/errors": "8.24.0",
51
+ "@lwc/shared": "8.24.0",
52
52
  "line-column": "~1.0.2"
53
53
  },
54
54
  "devDependencies": {