@nx/eslint 23.0.0-beta.18 → 23.0.0-beta.19
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.
|
@@ -145,19 +145,34 @@ function collectCallExpressionRewrites(sourceFile, changes) {
|
|
|
145
145
|
// internal entry.
|
|
146
146
|
replaceSpecifier(sourceFile, node.arguments[0], TO_INTERNAL, changes);
|
|
147
147
|
}
|
|
148
|
+
else if (ts.isImportTypeNode(node)) {
|
|
149
|
+
// `typeof import('...')` parses as an `ImportTypeNode`, not a
|
|
150
|
+
// CallExpression — its argument is `LiteralTypeNode<StringLiteral>`.
|
|
151
|
+
// The whole module is referenced, so it can't be symbol-split.
|
|
152
|
+
const literal = getImportTypeStringLiteral(node);
|
|
153
|
+
if (literal && literal.text.startsWith(FROM_PREFIX)) {
|
|
154
|
+
replaceSpecifier(sourceFile, literal, TO_INTERNAL, changes);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
148
157
|
ts.forEachChild(node, visit);
|
|
149
158
|
};
|
|
150
159
|
visit(sourceFile);
|
|
151
160
|
}
|
|
161
|
+
function getImportTypeStringLiteral(node) {
|
|
162
|
+
const arg = node.argument;
|
|
163
|
+
if (arg && ts.isLiteralTypeNode(arg) && ts.isStringLiteral(arg.literal)) {
|
|
164
|
+
return arg.literal;
|
|
165
|
+
}
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
152
168
|
function shouldRewriteCallExpression(call) {
|
|
153
169
|
const callee = call.expression;
|
|
154
170
|
// `require('...')`
|
|
155
171
|
if (ts.isIdentifier(callee) && callee.text === 'require')
|
|
156
172
|
return true;
|
|
157
173
|
// dynamic `import('...')` (runtime form parses as a CallExpression whose
|
|
158
|
-
// callee is the `import` keyword). The type-position
|
|
159
|
-
//
|
|
160
|
-
// we don't touch it.
|
|
174
|
+
// callee is the `import` keyword). The `typeof import('...')` type-position
|
|
175
|
+
// form is an `ImportTypeNode` (handled in `collectCallExpressionRewrites`).
|
|
161
176
|
if (callee.kind === ts.SyntaxKind.ImportKeyword)
|
|
162
177
|
return true;
|
|
163
178
|
// `jest.mock(...)` / `vi.mock(...)` and friends.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@zkochan/js-yaml": "0.0.7",
|
|
75
75
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
76
|
-
"@nx/jest": "23.0.0-beta.
|
|
76
|
+
"@nx/jest": "23.0.0-beta.19"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"semver": "^7.6.3",
|
|
80
80
|
"tslib": "^2.3.0",
|
|
81
81
|
"typescript": "~5.9.2",
|
|
82
|
-
"@nx/
|
|
83
|
-
"@nx/
|
|
82
|
+
"@nx/js": "23.0.0-beta.19",
|
|
83
|
+
"@nx/devkit": "23.0.0-beta.19"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"nx": "23.0.0-beta.
|
|
86
|
+
"nx": "23.0.0-beta.19"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@nx/jest": {
|