@typescript-eslint/typescript-estree 8.65.1-alpha.9 → 8.66.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.
@@ -373,6 +373,20 @@ function checkSyntaxError(tsNode, parent, allowPattern) {
373
373
  }
374
374
  break;
375
375
  }
376
+ case SyntaxKind.MetaProperty: {
377
+ const metaObject = (0, node_utils_1.getTextForTokenKind)(node.keywordToken);
378
+ const metaPropertyName = node.name.text;
379
+ if (metaObject === 'import') {
380
+ if (metaPropertyName === 'defer' &&
381
+ node.parent.kind !== SyntaxKind.CallExpression) {
382
+ throw (0, node_utils_1.createError)(node, "'import.defer' is only valid when called. Use 'import.defer()' instead.");
383
+ }
384
+ if (metaPropertyName !== 'meta') {
385
+ throw (0, node_utils_1.createError)(node, `'${metaPropertyName}' is not a valid meta-property for keyword 'import'.`);
386
+ }
387
+ }
388
+ break;
389
+ }
376
390
  case SyntaxKind.ObjectLiteralExpression: {
377
391
  if (!allowPattern) {
378
392
  for (const property of node.properties) {
package/dist/convert.js CHANGED
@@ -1460,12 +1460,35 @@ class Converter {
1460
1460
  return this.convertChainExpression(result, node);
1461
1461
  }
1462
1462
  case SyntaxKind.CallExpression: {
1463
- if (node.expression.kind === SyntaxKind.ImportKeyword) {
1463
+ const importExpressionParams = (() => {
1464
+ // import(...);
1465
+ if (node.expression.kind === SyntaxKind.ImportKeyword) {
1466
+ return {
1467
+ phase: null,
1468
+ };
1469
+ }
1470
+ // import.defer(...);
1471
+ if (node.expression.kind === SyntaxKind.MetaProperty) {
1472
+ const metaPropertyNode = node.expression;
1473
+ const metaObject = (0, node_utils_1.getTextForTokenKind)(metaPropertyNode.keywordToken);
1474
+ if (metaObject === 'import') {
1475
+ const metaPropertyName = metaPropertyNode.name.text;
1476
+ if (metaPropertyName === 'defer') {
1477
+ return {
1478
+ phase: 'defer',
1479
+ };
1480
+ }
1481
+ }
1482
+ }
1483
+ return undefined;
1484
+ })();
1485
+ if (importExpressionParams != null) {
1464
1486
  return this.createNode(node, this.#withDeprecatedAliasGetter({
1465
1487
  type: ts_estree_1.AST_NODE_TYPES.ImportExpression,
1466
1488
  options: node.arguments[1]
1467
1489
  ? this.convertChild(node.arguments[1])
1468
1490
  : null,
1491
+ phase: importExpressionParams.phase,
1469
1492
  source: this.convertChild(node.arguments[0]),
1470
1493
  }, 'attributes', 'options', true));
1471
1494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/typescript-estree",
3
- "version": "8.65.1-alpha.9",
3
+ "version": "8.66.0",
4
4
  "description": "A parser that converts TypeScript source code into an ESTree compatible form",
5
5
  "files": [
6
6
  "dist",
@@ -47,10 +47,10 @@
47
47
  "semver": "^7.7.3",
48
48
  "tinyglobby": "^0.2.15",
49
49
  "ts-api-utils": "^2.5.0",
50
- "@typescript-eslint/tsconfig-utils": "8.65.1-alpha.9",
51
- "@typescript-eslint/project-service": "8.65.1-alpha.9",
52
- "@typescript-eslint/visitor-keys": "8.65.1-alpha.9",
53
- "@typescript-eslint/types": "8.65.1-alpha.9"
50
+ "@typescript-eslint/project-service": "8.66.0",
51
+ "@typescript-eslint/types": "8.66.0",
52
+ "@typescript-eslint/visitor-keys": "8.66.0",
53
+ "@typescript-eslint/tsconfig-utils": "8.66.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@typescript/native-preview": "7.0.0-dev.20260518.1",