@lwc/babel-plugin-component 9.0.4-alpha.1 → 9.0.4-alpha.2

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/README.md CHANGED
@@ -21,8 +21,8 @@ This babel plugin does the following transform:
21
21
  ## Usage
22
22
 
23
23
  ```js
24
- import babel from '@babel/core';
25
- import lwcPlugin from '@lwc/babel-plugin-component';
24
+ const babel = require('@babel/core');
25
+ const lwcPlugin = require('@lwc/babel-plugin-component');
26
26
 
27
27
  const source = `
28
28
  import { LightningElement } from 'lwc';
@@ -0,0 +1,4 @@
1
+ import type { types, NodePath } from '@babel/core';
2
+ import type { BabelAPI } from './types';
3
+ export default function ({ types: t }: BabelAPI): (path: NodePath<types.Program>) => void;
4
+ //# sourceMappingURL=dedupe-imports.d.ts.map
@@ -5,7 +5,7 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
- var node_path = require('node:path');
8
+ var path = require('path');
9
9
  var helperModuleImports = require('@babel/helper-module-imports');
10
10
  var shared = require('@lwc/shared');
11
11
  var errors = require('@lwc/errors');
@@ -54,8 +54,8 @@ const COMPONENT_FEATURE_FLAG_KEY = 'componentFeatureFlag';
54
54
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
55
55
  */
56
56
  function getBaseName(classPath) {
57
- const ext = node_path.extname(classPath);
58
- return node_path.basename(classPath, ext);
57
+ const ext = path.extname(classPath);
58
+ return path.basename(classPath, ext);
59
59
  }
60
60
  function importDefaultTemplate(path, state) {
61
61
  const { filename } = state.file.opts;
@@ -1167,6 +1167,57 @@ function decorators({ types: t }) {
1167
1167
  };
1168
1168
  }
1169
1169
 
1170
+ /*
1171
+ * Copyright (c) 2023, salesforce.com, inc.
1172
+ * All rights reserved.
1173
+ * SPDX-License-Identifier: MIT
1174
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1175
+ */
1176
+ function defaultImport(t, specifiers) {
1177
+ const defaultImport = specifiers.find((s) => t.isImportDefaultSpecifier(s));
1178
+ return defaultImport && defaultImport.local.name;
1179
+ }
1180
+ function dedupeImports ({ types: t }) {
1181
+ return function (path) {
1182
+ const body = path.get('body');
1183
+ const importStatements = body.filter((s) => s.isImportDeclaration());
1184
+ const visited = new Map();
1185
+ importStatements.forEach((importPath) => {
1186
+ const sourceLiteral = importPath.node.source;
1187
+ // If the import is of the type import * as X, just ignore it since we can't dedupe
1188
+ if (importPath.node.specifiers.some((_) => t.isImportNamespaceSpecifier(_))) {
1189
+ return;
1190
+ }
1191
+ // If we have seen the same source, we will try to dedupe it
1192
+ if (visited.has(sourceLiteral.value)) {
1193
+ const visitedImport = visited.get(sourceLiteral.value);
1194
+ const visitedSpecifiers = visitedImport.node.specifiers;
1195
+ const visitedDefaultImport = defaultImport(t, visitedSpecifiers);
1196
+ // We merge all the named imports unless is a default with the same name
1197
+ let canImportBeRemoved = true;
1198
+ importPath.node.specifiers.forEach((s) => {
1199
+ if (visitedDefaultImport && t.isImportDefaultSpecifier(s)) {
1200
+ if (visitedDefaultImport !== s.local.name) {
1201
+ canImportBeRemoved = false;
1202
+ }
1203
+ }
1204
+ else {
1205
+ visitedSpecifiers.push(s);
1206
+ }
1207
+ });
1208
+ if (canImportBeRemoved) {
1209
+ importPath.remove();
1210
+ }
1211
+ // We need to sort the imports due to a bug in babel where default must be first
1212
+ visitedSpecifiers.sort((a) => (t.isImportDefaultSpecifier(a) ? -1 : 1));
1213
+ }
1214
+ else {
1215
+ visited.set(sourceLiteral.value, importPath);
1216
+ }
1217
+ });
1218
+ };
1219
+ }
1220
+
1170
1221
  /*
1171
1222
  * Copyright (c) 2023, salesforce.com, inc.
1172
1223
  * All rights reserved.
@@ -1290,84 +1341,76 @@ const METHOD_KIND = 'method';
1290
1341
  * private methods are converted to regular methods before decorator and class
1291
1342
  * property processing.
1292
1343
  *
1293
- * Uses Program > path.traverse() rather than a top-level ClassPrivateMethod visitor
1294
- * because the reverse transform has a ClassMethod visitor in the same Babel pass.
1295
- * A direct ClassPrivateMethod visitor would replace nodes that the reverse transform
1296
- * immediately converts back, creating an infinite loop. The manual traverse ensures
1297
- * all forward replacements complete before the reverse visitor sees any ClassMethod.
1344
+ * Uses the `pre` lifecycle hook to run all transformations in a single pass
1345
+ * before the visitor phase, guaranteeing the traversal executes exactly once.
1298
1346
  */
1299
1347
  function privateMethodTransform({ types: t, }) {
1300
1348
  return {
1301
- visitor: {
1302
- Program(path, state) {
1303
- const transformedNames = new Set();
1304
- // Phase 1: Collect base names of all private methods (kind: 'method')
1305
- // so that Phase 2 can transform invocations even for forward references
1306
- // (call site visited before the method definition).
1307
- const privateMethodBaseNames = new Set();
1308
- path.traverse({
1309
- ClassPrivateMethod(methodPath) {
1310
- const key = methodPath.get('key');
1311
- if (key.isPrivateName() && methodPath.node.kind === METHOD_KIND) {
1312
- privateMethodBaseNames.add(key.node.id.name);
1313
- }
1314
- },
1315
- });
1316
- // Phase 2: Transform definitions and invocations
1317
- path.traverse({
1318
- ClassPrivateMethod(methodPath, methodState) {
1319
- const key = methodPath.get('key');
1320
- if (!key.isPrivateName()) {
1321
- return;
1322
- }
1323
- if (methodPath.node.kind !== METHOD_KIND) {
1324
- handleError(methodPath, {
1325
- errorInfo: errors.DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1326
- messageArgs: ['accessor methods'],
1327
- }, methodState);
1328
- return;
1329
- }
1330
- const node = methodPath.node;
1331
- // Reject private methods with decorators (e.g. @api, @track, @wire)
1332
- if (node.decorators && node.decorators.length > 0) {
1333
- handleError(methodPath, {
1334
- errorInfo: errors.DecoratorErrors.DECORATOR_ON_PRIVATE_METHOD,
1335
- }, methodState);
1336
- return;
1337
- }
1338
- const privateName = key.node.id.name;
1339
- const transformedName = `${PRIVATE_METHOD_PREFIX}${privateName}`;
1340
- const keyReplacement = t.identifier(transformedName);
1341
- // Create a new ClassMethod node to replace the ClassPrivateMethod
1342
- // https://babeljs.io/docs/babel-types#classmethod
1343
- const classMethod = t.classMethod(METHOD_KIND, keyReplacement, node.params, node.body, node.computed, node.static, node.generator, node.async);
1344
- copyMethodMetadata(node, classMethod);
1345
- // Replace the entire ClassPrivateMethod node with the new ClassMethod node
1346
- // (we can't just replace the key of type PrivateName with type Identifier)
1347
- methodPath.replaceWith(classMethod);
1348
- transformedNames.add(transformedName);
1349
- },
1350
- MemberExpression(memberPath) {
1351
- const property = memberPath.node.property;
1352
- if (t.isPrivateName(property)) {
1353
- const baseName = property.id.name;
1354
- if (privateMethodBaseNames.has(baseName)) {
1355
- const prefixedName = `${PRIVATE_METHOD_PREFIX}${baseName}`;
1356
- memberPath
1357
- .get('property')
1358
- .replaceWith(t.identifier(prefixedName));
1359
- }
1360
- }
1361
- },
1362
- ClassPrivateProperty(propPath, propState) {
1363
- handleError(propPath, {
1349
+ visitor: {},
1350
+ pre() {
1351
+ const state = this;
1352
+ const programPath = state.file.path;
1353
+ const transformedNames = new Set();
1354
+ // Phase 1: Collect base names of all private methods (kind: 'method')
1355
+ // so that Phase 2 can transform invocations even for forward references
1356
+ // (call site visited before the method definition).
1357
+ const privateMethodBaseNames = new Set();
1358
+ programPath.traverse({
1359
+ ClassPrivateMethod(methodPath) {
1360
+ const key = methodPath.get('key');
1361
+ if (key.isPrivateName() && methodPath.node.kind === METHOD_KIND) {
1362
+ privateMethodBaseNames.add(key.node.id.name);
1363
+ }
1364
+ },
1365
+ });
1366
+ // Phase 2: Transform definitions and invocations
1367
+ programPath.traverse({
1368
+ ClassPrivateMethod(methodPath, methodState) {
1369
+ const key = methodPath.get('key');
1370
+ if (!key.isPrivateName()) {
1371
+ return;
1372
+ }
1373
+ if (methodPath.node.kind !== METHOD_KIND) {
1374
+ handleError(methodPath, {
1364
1375
  errorInfo: errors.DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1365
- messageArgs: ['fields'],
1366
- }, propState);
1367
- },
1368
- }, state);
1369
- state.file.metadata[PRIVATE_METHOD_METADATA_KEY] = transformedNames;
1370
- },
1376
+ messageArgs: ['accessor methods'],
1377
+ }, methodState);
1378
+ return;
1379
+ }
1380
+ const node = methodPath.node;
1381
+ if (node.decorators && node.decorators.length > 0) {
1382
+ handleError(methodPath, {
1383
+ errorInfo: errors.DecoratorErrors.DECORATOR_ON_PRIVATE_METHOD,
1384
+ }, methodState);
1385
+ return;
1386
+ }
1387
+ const privateName = key.node.id.name;
1388
+ const transformedName = `${PRIVATE_METHOD_PREFIX}${privateName}`;
1389
+ const keyReplacement = t.identifier(transformedName);
1390
+ const classMethod = t.classMethod(METHOD_KIND, keyReplacement, node.params, node.body, node.computed, node.static, node.generator, node.async);
1391
+ copyMethodMetadata(node, classMethod);
1392
+ methodPath.replaceWith(classMethod);
1393
+ transformedNames.add(transformedName);
1394
+ },
1395
+ PrivateName(privatePath) {
1396
+ const baseName = privatePath.node.id.name;
1397
+ if (!privateMethodBaseNames.has(baseName)) {
1398
+ return;
1399
+ }
1400
+ const parentPath = privatePath.parentPath;
1401
+ if (parentPath.isMemberExpression()) {
1402
+ const prefixedName = `${PRIVATE_METHOD_PREFIX}${baseName}`;
1403
+ privatePath.replaceWith(t.identifier(prefixedName));
1404
+ }
1405
+ },
1406
+ ClassPrivateProperty(propPath, propState) {
1407
+ handleError(propPath, {
1408
+ errorInfo: errors.DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1409
+ messageArgs: ['fields'],
1410
+ }, propState);
1411
+ },
1412
+ }, state);
1413
+ state.file.metadata[PRIVATE_METHOD_METADATA_KEY] = transformedNames;
1371
1414
  },
1372
1415
  };
1373
1416
  }
@@ -1503,6 +1546,8 @@ function LwcClassTransform(api) {
1503
1546
  exit(path) {
1504
1547
  const engineImportSpecifiers = getEngineImportSpecifiers(path);
1505
1548
  removeImportedDecoratorSpecifiers(engineImportSpecifiers);
1549
+ // Will eventually be removed to eliminate unnecessary complexity. Rollup already does this for us.
1550
+ dedupeImports(api)(path);
1506
1551
  },
1507
1552
  },
1508
1553
  Import: transformDynamicImports,
@@ -1516,5 +1561,5 @@ function LwcClassTransform(api) {
1516
1561
  exports.LwcPrivateMethodTransform = privateMethodTransform;
1517
1562
  exports.LwcReversePrivateMethodTransform = reversePrivateMethodTransform;
1518
1563
  exports.default = LwcClassTransform;
1519
- /** version: 9.0.4-alpha.1 */
1520
- //# sourceMappingURL=index.cjs.map
1564
+ /** version: 9.0.4-alpha.2 */
1565
+ //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2026 Salesforce, Inc.
3
3
  */
4
- import { extname, basename } from 'node:path';
4
+ import { extname, basename } from 'path';
5
5
  import { addNamed, addDefault } from '@babel/helper-module-imports';
6
6
  import { getAPIVersionFromNumber, generateCustomElementTagName, DISALLOWED_PROP_SET, AMBIGUOUS_PROP_SET, isAPIFeatureEnabled, LWC_VERSION_COMMENT } from '@lwc/shared';
7
7
  import { generateCompilerDiagnostic, DiagnosticLevel, generateErrorMessage, DecoratorErrors, CompilerMetrics, LWCClassErrors } from '@lwc/errors';
@@ -1163,6 +1163,57 @@ function decorators({ types: t }) {
1163
1163
  };
1164
1164
  }
1165
1165
 
1166
+ /*
1167
+ * Copyright (c) 2023, salesforce.com, inc.
1168
+ * All rights reserved.
1169
+ * SPDX-License-Identifier: MIT
1170
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1171
+ */
1172
+ function defaultImport(t, specifiers) {
1173
+ const defaultImport = specifiers.find((s) => t.isImportDefaultSpecifier(s));
1174
+ return defaultImport && defaultImport.local.name;
1175
+ }
1176
+ function dedupeImports ({ types: t }) {
1177
+ return function (path) {
1178
+ const body = path.get('body');
1179
+ const importStatements = body.filter((s) => s.isImportDeclaration());
1180
+ const visited = new Map();
1181
+ importStatements.forEach((importPath) => {
1182
+ const sourceLiteral = importPath.node.source;
1183
+ // If the import is of the type import * as X, just ignore it since we can't dedupe
1184
+ if (importPath.node.specifiers.some((_) => t.isImportNamespaceSpecifier(_))) {
1185
+ return;
1186
+ }
1187
+ // If we have seen the same source, we will try to dedupe it
1188
+ if (visited.has(sourceLiteral.value)) {
1189
+ const visitedImport = visited.get(sourceLiteral.value);
1190
+ const visitedSpecifiers = visitedImport.node.specifiers;
1191
+ const visitedDefaultImport = defaultImport(t, visitedSpecifiers);
1192
+ // We merge all the named imports unless is a default with the same name
1193
+ let canImportBeRemoved = true;
1194
+ importPath.node.specifiers.forEach((s) => {
1195
+ if (visitedDefaultImport && t.isImportDefaultSpecifier(s)) {
1196
+ if (visitedDefaultImport !== s.local.name) {
1197
+ canImportBeRemoved = false;
1198
+ }
1199
+ }
1200
+ else {
1201
+ visitedSpecifiers.push(s);
1202
+ }
1203
+ });
1204
+ if (canImportBeRemoved) {
1205
+ importPath.remove();
1206
+ }
1207
+ // We need to sort the imports due to a bug in babel where default must be first
1208
+ visitedSpecifiers.sort((a) => (t.isImportDefaultSpecifier(a) ? -1 : 1));
1209
+ }
1210
+ else {
1211
+ visited.set(sourceLiteral.value, importPath);
1212
+ }
1213
+ });
1214
+ };
1215
+ }
1216
+
1166
1217
  /*
1167
1218
  * Copyright (c) 2023, salesforce.com, inc.
1168
1219
  * All rights reserved.
@@ -1286,84 +1337,76 @@ const METHOD_KIND = 'method';
1286
1337
  * private methods are converted to regular methods before decorator and class
1287
1338
  * property processing.
1288
1339
  *
1289
- * Uses Program > path.traverse() rather than a top-level ClassPrivateMethod visitor
1290
- * because the reverse transform has a ClassMethod visitor in the same Babel pass.
1291
- * A direct ClassPrivateMethod visitor would replace nodes that the reverse transform
1292
- * immediately converts back, creating an infinite loop. The manual traverse ensures
1293
- * all forward replacements complete before the reverse visitor sees any ClassMethod.
1340
+ * Uses the `pre` lifecycle hook to run all transformations in a single pass
1341
+ * before the visitor phase, guaranteeing the traversal executes exactly once.
1294
1342
  */
1295
1343
  function privateMethodTransform({ types: t, }) {
1296
1344
  return {
1297
- visitor: {
1298
- Program(path, state) {
1299
- const transformedNames = new Set();
1300
- // Phase 1: Collect base names of all private methods (kind: 'method')
1301
- // so that Phase 2 can transform invocations even for forward references
1302
- // (call site visited before the method definition).
1303
- const privateMethodBaseNames = new Set();
1304
- path.traverse({
1305
- ClassPrivateMethod(methodPath) {
1306
- const key = methodPath.get('key');
1307
- if (key.isPrivateName() && methodPath.node.kind === METHOD_KIND) {
1308
- privateMethodBaseNames.add(key.node.id.name);
1309
- }
1310
- },
1311
- });
1312
- // Phase 2: Transform definitions and invocations
1313
- path.traverse({
1314
- ClassPrivateMethod(methodPath, methodState) {
1315
- const key = methodPath.get('key');
1316
- if (!key.isPrivateName()) {
1317
- return;
1318
- }
1319
- if (methodPath.node.kind !== METHOD_KIND) {
1320
- handleError(methodPath, {
1321
- errorInfo: DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1322
- messageArgs: ['accessor methods'],
1323
- }, methodState);
1324
- return;
1325
- }
1326
- const node = methodPath.node;
1327
- // Reject private methods with decorators (e.g. @api, @track, @wire)
1328
- if (node.decorators && node.decorators.length > 0) {
1329
- handleError(methodPath, {
1330
- errorInfo: DecoratorErrors.DECORATOR_ON_PRIVATE_METHOD,
1331
- }, methodState);
1332
- return;
1333
- }
1334
- const privateName = key.node.id.name;
1335
- const transformedName = `${PRIVATE_METHOD_PREFIX}${privateName}`;
1336
- const keyReplacement = t.identifier(transformedName);
1337
- // Create a new ClassMethod node to replace the ClassPrivateMethod
1338
- // https://babeljs.io/docs/babel-types#classmethod
1339
- const classMethod = t.classMethod(METHOD_KIND, keyReplacement, node.params, node.body, node.computed, node.static, node.generator, node.async);
1340
- copyMethodMetadata(node, classMethod);
1341
- // Replace the entire ClassPrivateMethod node with the new ClassMethod node
1342
- // (we can't just replace the key of type PrivateName with type Identifier)
1343
- methodPath.replaceWith(classMethod);
1344
- transformedNames.add(transformedName);
1345
- },
1346
- MemberExpression(memberPath) {
1347
- const property = memberPath.node.property;
1348
- if (t.isPrivateName(property)) {
1349
- const baseName = property.id.name;
1350
- if (privateMethodBaseNames.has(baseName)) {
1351
- const prefixedName = `${PRIVATE_METHOD_PREFIX}${baseName}`;
1352
- memberPath
1353
- .get('property')
1354
- .replaceWith(t.identifier(prefixedName));
1355
- }
1356
- }
1357
- },
1358
- ClassPrivateProperty(propPath, propState) {
1359
- handleError(propPath, {
1345
+ visitor: {},
1346
+ pre() {
1347
+ const state = this;
1348
+ const programPath = state.file.path;
1349
+ const transformedNames = new Set();
1350
+ // Phase 1: Collect base names of all private methods (kind: 'method')
1351
+ // so that Phase 2 can transform invocations even for forward references
1352
+ // (call site visited before the method definition).
1353
+ const privateMethodBaseNames = new Set();
1354
+ programPath.traverse({
1355
+ ClassPrivateMethod(methodPath) {
1356
+ const key = methodPath.get('key');
1357
+ if (key.isPrivateName() && methodPath.node.kind === METHOD_KIND) {
1358
+ privateMethodBaseNames.add(key.node.id.name);
1359
+ }
1360
+ },
1361
+ });
1362
+ // Phase 2: Transform definitions and invocations
1363
+ programPath.traverse({
1364
+ ClassPrivateMethod(methodPath, methodState) {
1365
+ const key = methodPath.get('key');
1366
+ if (!key.isPrivateName()) {
1367
+ return;
1368
+ }
1369
+ if (methodPath.node.kind !== METHOD_KIND) {
1370
+ handleError(methodPath, {
1360
1371
  errorInfo: DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1361
- messageArgs: ['fields'],
1362
- }, propState);
1363
- },
1364
- }, state);
1365
- state.file.metadata[PRIVATE_METHOD_METADATA_KEY] = transformedNames;
1366
- },
1372
+ messageArgs: ['accessor methods'],
1373
+ }, methodState);
1374
+ return;
1375
+ }
1376
+ const node = methodPath.node;
1377
+ if (node.decorators && node.decorators.length > 0) {
1378
+ handleError(methodPath, {
1379
+ errorInfo: DecoratorErrors.DECORATOR_ON_PRIVATE_METHOD,
1380
+ }, methodState);
1381
+ return;
1382
+ }
1383
+ const privateName = key.node.id.name;
1384
+ const transformedName = `${PRIVATE_METHOD_PREFIX}${privateName}`;
1385
+ const keyReplacement = t.identifier(transformedName);
1386
+ const classMethod = t.classMethod(METHOD_KIND, keyReplacement, node.params, node.body, node.computed, node.static, node.generator, node.async);
1387
+ copyMethodMetadata(node, classMethod);
1388
+ methodPath.replaceWith(classMethod);
1389
+ transformedNames.add(transformedName);
1390
+ },
1391
+ PrivateName(privatePath) {
1392
+ const baseName = privatePath.node.id.name;
1393
+ if (!privateMethodBaseNames.has(baseName)) {
1394
+ return;
1395
+ }
1396
+ const parentPath = privatePath.parentPath;
1397
+ if (parentPath.isMemberExpression()) {
1398
+ const prefixedName = `${PRIVATE_METHOD_PREFIX}${baseName}`;
1399
+ privatePath.replaceWith(t.identifier(prefixedName));
1400
+ }
1401
+ },
1402
+ ClassPrivateProperty(propPath, propState) {
1403
+ handleError(propPath, {
1404
+ errorInfo: DecoratorErrors.UNSUPPORTED_PRIVATE_MEMBER,
1405
+ messageArgs: ['fields'],
1406
+ }, propState);
1407
+ },
1408
+ }, state);
1409
+ state.file.metadata[PRIVATE_METHOD_METADATA_KEY] = transformedNames;
1367
1410
  },
1368
1411
  };
1369
1412
  }
@@ -1499,6 +1542,8 @@ function LwcClassTransform(api) {
1499
1542
  exit(path) {
1500
1543
  const engineImportSpecifiers = getEngineImportSpecifiers(path);
1501
1544
  removeImportedDecoratorSpecifiers(engineImportSpecifiers);
1545
+ // Will eventually be removed to eliminate unnecessary complexity. Rollup already does this for us.
1546
+ dedupeImports(api)(path);
1502
1547
  },
1503
1548
  },
1504
1549
  Import: transformDynamicImports,
@@ -1510,5 +1555,5 @@ function LwcClassTransform(api) {
1510
1555
  }
1511
1556
 
1512
1557
  export { privateMethodTransform as LwcPrivateMethodTransform, reversePrivateMethodTransform as LwcReversePrivateMethodTransform, LwcClassTransform as default };
1513
- /** version: 9.0.4-alpha.1 */
1558
+ /** version: 9.0.4-alpha.2 */
1514
1559
  //# sourceMappingURL=index.js.map
@@ -8,11 +8,8 @@ import type { PluginObj } from '@babel/core';
8
8
  * private methods are converted to regular methods before decorator and class
9
9
  * property processing.
10
10
  *
11
- * Uses Program > path.traverse() rather than a top-level ClassPrivateMethod visitor
12
- * because the reverse transform has a ClassMethod visitor in the same Babel pass.
13
- * A direct ClassPrivateMethod visitor would replace nodes that the reverse transform
14
- * immediately converts back, creating an infinite loop. The manual traverse ensures
15
- * all forward replacements complete before the reverse visitor sees any ClassMethod.
11
+ * Uses the `pre` lifecycle hook to run all transformations in a single pass
12
+ * before the visitor phase, guaranteeing the traversal executes exactly once.
16
13
  */
17
14
  export default function privateMethodTransform({ types: t, }: BabelAPI): PluginObj<LwcBabelPluginPass>;
18
15
  //# sourceMappingURL=private-method-transform.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": "9.0.4-alpha.1",
7
+ "version": "9.0.4-alpha.2",
8
8
  "description": "Babel plugin to transform a LWC module",
9
9
  "keywords": [
10
10
  "lwc"
@@ -19,22 +19,17 @@
19
19
  "url": "https://github.com/salesforce/lwc/issues"
20
20
  },
21
21
  "license": "MIT",
22
- "type": "module",
23
22
  "publishConfig": {
24
23
  "access": "public"
25
24
  },
26
- "engines": {
27
- "node": ">=16.6.0"
28
- },
29
25
  "volta": {
30
26
  "extends": "../../../package.json"
31
27
  },
32
- "main": "dist/index.js",
28
+ "main": "dist/index.cjs.js",
33
29
  "module": "dist/index.js",
34
30
  "types": "dist/index.d.ts",
35
31
  "files": [
36
32
  "dist/**/*.js",
37
- "dist/**/*.cjs",
38
33
  "dist/**/*.d.ts"
39
34
  ],
40
35
  "scripts": {
@@ -52,8 +47,8 @@
52
47
  },
53
48
  "dependencies": {
54
49
  "@babel/helper-module-imports": "7.28.6",
55
- "@lwc/errors": "9.0.4-alpha.1",
56
- "@lwc/shared": "9.0.4-alpha.1",
50
+ "@lwc/errors": "9.0.4-alpha.2",
51
+ "@lwc/shared": "9.0.4-alpha.2",
57
52
  "line-column": "~1.0.2"
58
53
  },
59
54
  "devDependencies": {