@lwc/babel-plugin-component 8.22.6 → 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.
- package/dist/constants.d.ts +3 -1
- package/dist/index.cjs.js +30 -8
- package/dist/index.js +30 -8
- package/dist/types.d.ts +2 -0
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -23,5 +23,7 @@ declare const TEMPLATE_KEY = "tmpl";
|
|
|
23
23
|
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
|
+
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, };
|
|
27
29
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/index.cjs.js
CHANGED
|
@@ -41,6 +41,8 @@ const TEMPLATE_KEY = 'tmpl';
|
|
|
41
41
|
const COMPONENT_NAME_KEY = 'sel';
|
|
42
42
|
const API_VERSION_KEY = 'apiVersion';
|
|
43
43
|
const COMPONENT_CLASS_ID = '__lwc_component_class_internal';
|
|
44
|
+
const SYNTHETIC_ELEMENT_INTERNALS_KEY = 'enableSyntheticElementInternals';
|
|
45
|
+
const COMPONENT_FEATURE_FLAG_KEY = 'componentFeatureFlag';
|
|
44
46
|
|
|
45
47
|
/*
|
|
46
48
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -74,6 +76,13 @@ function component ({ types: t }) {
|
|
|
74
76
|
function createRegisterComponent(declarationPath, state) {
|
|
75
77
|
const registerComponentId = helperModuleImports.addNamed(declarationPath, REGISTER_COMPONENT_ID, LWC_PACKAGE_ALIAS);
|
|
76
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
|
+
}
|
|
77
86
|
const statementPath = declarationPath.getStatementParent();
|
|
78
87
|
const componentRegisteredName = getComponentRegisteredName(t, state);
|
|
79
88
|
let node = declarationPath.node;
|
|
@@ -95,15 +104,28 @@ function component ({ types: t }) {
|
|
|
95
104
|
// sel: 'x-foo',
|
|
96
105
|
// apiVersion: '58'
|
|
97
106
|
// })
|
|
107
|
+
const properties = [
|
|
108
|
+
t.objectProperty(t.identifier(TEMPLATE_KEY), templateIdentifier),
|
|
109
|
+
t.objectProperty(t.identifier(COMPONENT_NAME_KEY), componentRegisteredName),
|
|
110
|
+
// It's important that, at this point, we have an APIVersion rather than just a number.
|
|
111
|
+
// The client needs to trust the server that it's providing an actual known API version
|
|
112
|
+
t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
|
|
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
|
+
}
|
|
122
|
+
// Only include enableSyntheticElementInternals if set to true
|
|
123
|
+
if (state.opts.enableSyntheticElementInternals === true) {
|
|
124
|
+
properties.push(t.objectProperty(t.identifier(SYNTHETIC_ELEMENT_INTERNALS_KEY), t.booleanLiteral(true)));
|
|
125
|
+
}
|
|
98
126
|
const registerComponentExpression = t.callExpression(registerComponentId, [
|
|
99
127
|
node,
|
|
100
|
-
t.objectExpression(
|
|
101
|
-
t.objectProperty(t.identifier(TEMPLATE_KEY), templateIdentifier),
|
|
102
|
-
t.objectProperty(t.identifier(COMPONENT_NAME_KEY), componentRegisteredName),
|
|
103
|
-
// It's important that, at this point, we have an APIVersion rather than just a number.
|
|
104
|
-
// The client needs to trust the server that it's providing an actual known API version
|
|
105
|
-
t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
|
|
106
|
-
]),
|
|
128
|
+
t.objectExpression(properties),
|
|
107
129
|
]);
|
|
108
130
|
// Example:
|
|
109
131
|
// const __lwc_component_class_internal = registerComponent(cmp, ...);
|
|
@@ -1267,5 +1289,5 @@ function LwcClassTransform(api) {
|
|
|
1267
1289
|
}
|
|
1268
1290
|
|
|
1269
1291
|
exports.default = LwcClassTransform;
|
|
1270
|
-
/** version: 8.
|
|
1292
|
+
/** version: 8.24.0 */
|
|
1271
1293
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,8 @@ const TEMPLATE_KEY = 'tmpl';
|
|
|
37
37
|
const COMPONENT_NAME_KEY = 'sel';
|
|
38
38
|
const API_VERSION_KEY = 'apiVersion';
|
|
39
39
|
const COMPONENT_CLASS_ID = '__lwc_component_class_internal';
|
|
40
|
+
const SYNTHETIC_ELEMENT_INTERNALS_KEY = 'enableSyntheticElementInternals';
|
|
41
|
+
const COMPONENT_FEATURE_FLAG_KEY = 'componentFeatureFlag';
|
|
40
42
|
|
|
41
43
|
/*
|
|
42
44
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -70,6 +72,13 @@ function component ({ types: t }) {
|
|
|
70
72
|
function createRegisterComponent(declarationPath, state) {
|
|
71
73
|
const registerComponentId = addNamed(declarationPath, REGISTER_COMPONENT_ID, LWC_PACKAGE_ALIAS);
|
|
72
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
|
+
}
|
|
73
82
|
const statementPath = declarationPath.getStatementParent();
|
|
74
83
|
const componentRegisteredName = getComponentRegisteredName(t, state);
|
|
75
84
|
let node = declarationPath.node;
|
|
@@ -91,15 +100,28 @@ function component ({ types: t }) {
|
|
|
91
100
|
// sel: 'x-foo',
|
|
92
101
|
// apiVersion: '58'
|
|
93
102
|
// })
|
|
103
|
+
const properties = [
|
|
104
|
+
t.objectProperty(t.identifier(TEMPLATE_KEY), templateIdentifier),
|
|
105
|
+
t.objectProperty(t.identifier(COMPONENT_NAME_KEY), componentRegisteredName),
|
|
106
|
+
// It's important that, at this point, we have an APIVersion rather than just a number.
|
|
107
|
+
// The client needs to trust the server that it's providing an actual known API version
|
|
108
|
+
t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
|
|
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
|
+
}
|
|
118
|
+
// Only include enableSyntheticElementInternals if set to true
|
|
119
|
+
if (state.opts.enableSyntheticElementInternals === true) {
|
|
120
|
+
properties.push(t.objectProperty(t.identifier(SYNTHETIC_ELEMENT_INTERNALS_KEY), t.booleanLiteral(true)));
|
|
121
|
+
}
|
|
94
122
|
const registerComponentExpression = t.callExpression(registerComponentId, [
|
|
95
123
|
node,
|
|
96
|
-
t.objectExpression(
|
|
97
|
-
t.objectProperty(t.identifier(TEMPLATE_KEY), templateIdentifier),
|
|
98
|
-
t.objectProperty(t.identifier(COMPONENT_NAME_KEY), componentRegisteredName),
|
|
99
|
-
// It's important that, at this point, we have an APIVersion rather than just a number.
|
|
100
|
-
// The client needs to trust the server that it's providing an actual known API version
|
|
101
|
-
t.objectProperty(t.identifier(API_VERSION_KEY), t.numericLiteral(apiVersion)),
|
|
102
|
-
]),
|
|
124
|
+
t.objectExpression(properties),
|
|
103
125
|
]);
|
|
104
126
|
// Example:
|
|
105
127
|
// const __lwc_component_class_internal = registerComponent(cmp, ...);
|
|
@@ -1263,5 +1285,5 @@ function LwcClassTransform(api) {
|
|
|
1263
1285
|
}
|
|
1264
1286
|
|
|
1265
1287
|
export { LwcClassTransform as default };
|
|
1266
|
-
/** version: 8.
|
|
1288
|
+
/** version: 8.24.0 */
|
|
1267
1289
|
//# sourceMappingURL=index.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface LwcBabelPluginOptions {
|
|
|
13
13
|
name: string;
|
|
14
14
|
instrumentation?: InstrumentationObject;
|
|
15
15
|
apiVersion?: number;
|
|
16
|
+
enableSyntheticElementInternals?: boolean;
|
|
17
|
+
componentFeatureFlagModulePath?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface LwcBabelPluginPass extends PluginPass {
|
|
18
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.
|
|
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.
|
|
51
|
-
"@lwc/shared": "8.
|
|
50
|
+
"@lwc/errors": "8.24.0",
|
|
51
|
+
"@lwc/shared": "8.24.0",
|
|
52
52
|
"line-column": "~1.0.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|