@atlaskit/eslint-plugin-platform 2.8.0 → 2.9.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/CHANGELOG.md +9 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/rules/ensure-use-sync-external-store-server-snapshot/index.js +41 -0
- package/dist/cjs/rules/import/no-barrel-entry-imports/index.js +475 -67
- package/dist/cjs/rules/import/no-barrel-entry-jest-mock/index.js +387 -112
- package/dist/cjs/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/cjs/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/cjs/rules/import/shared/jest-utils.js +62 -9
- package/dist/cjs/rules/import/shared/package-resolution.js +156 -23
- package/dist/cjs/rules/visit-example-type-import-required/index.js +409 -0
- package/dist/es2019/index.js +6 -1
- package/dist/es2019/rules/ensure-use-sync-external-store-server-snapshot/index.js +43 -0
- package/dist/es2019/rules/import/no-barrel-entry-imports/index.js +372 -15
- package/dist/es2019/rules/import/no-barrel-entry-jest-mock/index.js +245 -17
- package/dist/es2019/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/es2019/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/es2019/rules/import/shared/jest-utils.js +44 -0
- package/dist/es2019/rules/import/shared/package-resolution.js +97 -5
- package/dist/es2019/rules/visit-example-type-import-required/index.js +375 -0
- package/dist/esm/index.js +6 -1
- package/dist/esm/rules/ensure-use-sync-external-store-server-snapshot/index.js +35 -0
- package/dist/esm/rules/import/no-barrel-entry-imports/index.js +475 -67
- package/dist/esm/rules/import/no-barrel-entry-jest-mock/index.js +388 -113
- package/dist/esm/rules/import/no-jest-mock-barrel-files/index.js +3 -2
- package/dist/esm/rules/import/no-relative-barrel-file-imports/index.js +7 -3
- package/dist/esm/rules/import/shared/jest-utils.js +61 -9
- package/dist/esm/rules/import/shared/package-resolution.js +156 -25
- package/dist/esm/rules/visit-example-type-import-required/index.js +402 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
- package/dist/types/rules/import/shared/jest-utils.d.ts +8 -0
- package/dist/types/rules/import/shared/package-resolution.d.ts +22 -2
- package/dist/types/rules/visit-example-type-import-required/index.d.ts +4 -0
- package/dist/types-ts4.5/index.d.ts +12 -0
- package/dist/types-ts4.5/rules/ensure-use-sync-external-store-server-snapshot/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/import/shared/jest-utils.d.ts +8 -0
- package/dist/types-ts4.5/rules/import/shared/package-resolution.d.ts +22 -2
- package/dist/types-ts4.5/rules/visit-example-type-import-required/index.d.ts +4 -0
- package/package.json +3 -1
|
@@ -222,6 +222,7 @@ function getImportPathForSourceFile(_ref) {
|
|
|
222
222
|
fs = _ref.fs;
|
|
223
223
|
var crossPackageName = exportInfo === null || exportInfo === void 0 || (_exportInfo$crossPack = exportInfo.crossPackageSource) === null || _exportInfo$crossPack === void 0 ? void 0 : _exportInfo$crossPack.packageName;
|
|
224
224
|
if (crossPackageName) {
|
|
225
|
+
var _findExportForSourceF;
|
|
225
226
|
var sourcePackageExportsMaps = getSourcePackageExportsMaps(fs);
|
|
226
227
|
var exportsMap = sourcePackageExportsMaps.get(crossPackageName);
|
|
227
228
|
if (!exportsMap) {
|
|
@@ -238,10 +239,10 @@ function getImportPathForSourceFile(_ref) {
|
|
|
238
239
|
sourcePackageExportsMaps.set(crossPackageName, exportsMap);
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
var targetExportPath = exportsMap ? findExportForSourceFile({
|
|
242
|
+
var targetExportPath = exportsMap ? (_findExportForSourceF = findExportForSourceFile({
|
|
242
243
|
sourceFilePath: sourceFilePath,
|
|
243
244
|
exportsMap: exportsMap
|
|
244
|
-
}) : null;
|
|
245
|
+
})) === null || _findExportForSourceF === void 0 ? void 0 : _findExportForSourceF.exportPath : null;
|
|
245
246
|
return targetExportPath ? crossPackageName + targetExportPath.slice(1) : crossPackageName;
|
|
246
247
|
}
|
|
247
248
|
return getRelativeImportPath({
|
|
@@ -61,6 +61,7 @@ function getImportPathForSourceFile(_ref) {
|
|
|
61
61
|
fs = _ref.fs;
|
|
62
62
|
var crossPackageName = exportInfo === null || exportInfo === void 0 || (_exportInfo$crossPack = exportInfo.crossPackageSource) === null || _exportInfo$crossPack === void 0 ? void 0 : _exportInfo$crossPack.packageName;
|
|
63
63
|
if (crossPackageName) {
|
|
64
|
+
var _findExportForSourceF;
|
|
64
65
|
var sourcePackageExportsMaps = getSourcePackageExportsMaps(fs);
|
|
65
66
|
var exportsMap = sourcePackageExportsMaps.get(crossPackageName);
|
|
66
67
|
if (!exportsMap) {
|
|
@@ -77,10 +78,10 @@ function getImportPathForSourceFile(_ref) {
|
|
|
77
78
|
sourcePackageExportsMaps.set(crossPackageName, exportsMap);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
var targetExportPath = exportsMap ? findExportForSourceFile({
|
|
81
|
+
var targetExportPath = exportsMap ? (_findExportForSourceF = findExportForSourceFile({
|
|
81
82
|
sourceFilePath: sourceFilePath,
|
|
82
83
|
exportsMap: exportsMap
|
|
83
|
-
}) : null;
|
|
84
|
+
})) === null || _findExportForSourceF === void 0 ? void 0 : _findExportForSourceF.exportPath : null;
|
|
84
85
|
return targetExportPath ? crossPackageName + targetExportPath.slice(1) : crossPackageName;
|
|
85
86
|
}
|
|
86
87
|
return getRelativeImportPath({
|
|
@@ -459,10 +460,13 @@ function transformExportSpecifiers(_ref1) {
|
|
|
459
460
|
var specsWithOriginal = _ref1.specsWithOriginal;
|
|
460
461
|
return specsWithOriginal.map(function (_ref10) {
|
|
461
462
|
var originalName = _ref10.originalName,
|
|
463
|
+
nameInSource = _ref10.nameInSource,
|
|
462
464
|
nameInLocal = _ref10.nameInLocal,
|
|
463
465
|
kind = _ref10.kind;
|
|
464
466
|
return {
|
|
465
|
-
|
|
467
|
+
// Use originalName if available (means there was an alias in the barrel),
|
|
468
|
+
// otherwise use nameInSource (the direct export name from the barrel)
|
|
469
|
+
nameInSource: originalName !== null && originalName !== void 0 ? originalName : nameInSource,
|
|
466
470
|
nameInLocal: nameInLocal,
|
|
467
471
|
kind: kind
|
|
468
472
|
};
|
|
@@ -124,6 +124,58 @@ export function findJestRequireMockCalls(_ref) {
|
|
|
124
124
|
return results;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Find all jest.requireActual() calls in the AST whose import path matches a given target.
|
|
129
|
+
* Works identically to findJestRequireMockCalls but for requireActual.
|
|
130
|
+
*/
|
|
131
|
+
export function findJestRequireActualCalls(_ref2) {
|
|
132
|
+
var ast = _ref2.ast,
|
|
133
|
+
matchPath = _ref2.matchPath;
|
|
134
|
+
var results = [];
|
|
135
|
+
var visited = new WeakSet();
|
|
136
|
+
var skipKeys = new Set(['parent', 'loc', 'range', 'tokens', 'comments']);
|
|
137
|
+
function visit(node) {
|
|
138
|
+
if (visited.has(node)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
visited.add(node);
|
|
142
|
+
if (node.type === 'CallExpression' && isJestRequireActual(node)) {
|
|
143
|
+
var path = extractImportPath(node);
|
|
144
|
+
if (path && matchPath(path)) {
|
|
145
|
+
results.push(node);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
for (var key in node) {
|
|
149
|
+
if (skipKeys.has(key)) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
var value = node[key];
|
|
153
|
+
if (value && _typeof(value) === 'object') {
|
|
154
|
+
if (Array.isArray(value)) {
|
|
155
|
+
var _iterator2 = _createForOfIteratorHelper(value),
|
|
156
|
+
_step2;
|
|
157
|
+
try {
|
|
158
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
159
|
+
var child = _step2.value;
|
|
160
|
+
if (child && _typeof(child) === 'object' && 'type' in child) {
|
|
161
|
+
visit(child);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} catch (err) {
|
|
165
|
+
_iterator2.e(err);
|
|
166
|
+
} finally {
|
|
167
|
+
_iterator2.f();
|
|
168
|
+
}
|
|
169
|
+
} else if ('type' in value) {
|
|
170
|
+
visit(value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
visit(ast);
|
|
176
|
+
return results;
|
|
177
|
+
}
|
|
178
|
+
|
|
127
179
|
/**
|
|
128
180
|
* Determine the best new import path for a jest.requireMock() call by inspecting
|
|
129
181
|
* the destructured symbols or property access at the call site.
|
|
@@ -132,20 +184,20 @@ export function findJestRequireMockCalls(_ref) {
|
|
|
132
184
|
* @param symbolToNewPath - Map from symbol name to the new mock path that provides it
|
|
133
185
|
* @returns The resolved new path, or null if it cannot be determined
|
|
134
186
|
*/
|
|
135
|
-
export function resolveNewPathForRequireMock(
|
|
136
|
-
var requireMockNode =
|
|
137
|
-
symbolToNewPath =
|
|
187
|
+
export function resolveNewPathForRequireMock(_ref3) {
|
|
188
|
+
var requireMockNode = _ref3.requireMockNode,
|
|
189
|
+
symbolToNewPath = _ref3.symbolToNewPath;
|
|
138
190
|
var parent = requireMockNode.parent;
|
|
139
191
|
if (parent) {
|
|
140
192
|
var _parent;
|
|
141
193
|
// Check for destructuring pattern: const { foo } = jest.requireMock('...')
|
|
142
194
|
var declarator = parent.type === 'VariableDeclarator' ? parent : ((_parent = parent.parent) === null || _parent === void 0 ? void 0 : _parent.type) === 'VariableDeclarator' ? parent.parent : null;
|
|
143
195
|
if (declarator && declarator.type === 'VariableDeclarator' && declarator.id.type === 'ObjectPattern') {
|
|
144
|
-
var
|
|
145
|
-
|
|
196
|
+
var _iterator3 = _createForOfIteratorHelper(declarator.id.properties),
|
|
197
|
+
_step3;
|
|
146
198
|
try {
|
|
147
|
-
for (
|
|
148
|
-
var prop =
|
|
199
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
200
|
+
var prop = _step3.value;
|
|
149
201
|
if (prop.type === 'Property' && prop.key.type === 'Identifier') {
|
|
150
202
|
var matchedPath = symbolToNewPath.get(prop.key.name);
|
|
151
203
|
if (matchedPath) {
|
|
@@ -154,9 +206,9 @@ export function resolveNewPathForRequireMock(_ref2) {
|
|
|
154
206
|
}
|
|
155
207
|
}
|
|
156
208
|
} catch (err) {
|
|
157
|
-
|
|
209
|
+
_iterator3.e(err);
|
|
158
210
|
} finally {
|
|
159
|
-
|
|
211
|
+
_iterator3.f();
|
|
160
212
|
}
|
|
161
213
|
}
|
|
162
214
|
|
|
@@ -3,15 +3,93 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
3
3
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
4
4
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
5
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import
|
|
6
|
+
import { dirname, join } from 'path';
|
|
7
|
+
import * as ts from 'typescript';
|
|
8
|
+
import { isRelativeImport, readFileContent, resolveImportPath } from './file-system';
|
|
8
9
|
import { findPackageInRegistry } from './package-registry';
|
|
10
|
+
var ENTRY_POINT_FOLDER_NAMES = new Set(['entry-points', 'entrypoints', 'entrypoint', 'entry-point']);
|
|
11
|
+
function isInEntryPointsFolder(filePath) {
|
|
12
|
+
var parts = filePath.split(/[/\\]/);
|
|
13
|
+
return parts.some(function (part) {
|
|
14
|
+
return ENTRY_POINT_FOLDER_NAMES.has(part);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
9
17
|
/**
|
|
10
|
-
* Parse
|
|
18
|
+
* Parse an entry-point wrapper file and resolve the source files it re-exports from,
|
|
19
|
+
* along with name mappings (source export name → entry-point export name).
|
|
11
20
|
*/
|
|
12
|
-
|
|
13
|
-
var
|
|
21
|
+
function resolveEntryPointReExports(_ref) {
|
|
22
|
+
var entryPointFilePath = _ref.entryPointFilePath,
|
|
14
23
|
fs = _ref.fs;
|
|
24
|
+
var content = readFileContent({
|
|
25
|
+
filePath: entryPointFilePath,
|
|
26
|
+
fs: fs
|
|
27
|
+
});
|
|
28
|
+
if (!content) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
var sourceFile = ts.createSourceFile(entryPointFilePath, content, ts.ScriptTarget.Latest, true);
|
|
33
|
+
var basedir = dirname(entryPointFilePath);
|
|
34
|
+
var results = [];
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(sourceFile.statements),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var statement = _step.value;
|
|
40
|
+
if (ts.isExportDeclaration(statement) && statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)) {
|
|
41
|
+
var modulePath = statement.moduleSpecifier.text;
|
|
42
|
+
if (!isRelativeImport(modulePath)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
var resolved = resolveImportPath({
|
|
46
|
+
basedir: basedir,
|
|
47
|
+
importPath: modulePath,
|
|
48
|
+
fs: fs
|
|
49
|
+
});
|
|
50
|
+
if (!resolved) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
var nameMap = new Map();
|
|
54
|
+
if (statement.exportClause && ts.isNamedExports(statement.exportClause)) {
|
|
55
|
+
var _iterator2 = _createForOfIteratorHelper(statement.exportClause.elements),
|
|
56
|
+
_step2;
|
|
57
|
+
try {
|
|
58
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
59
|
+
var element = _step2.value;
|
|
60
|
+
var exportedName = element.name.text;
|
|
61
|
+
var sourceName = element.propertyName ? element.propertyName.text : exportedName;
|
|
62
|
+
nameMap.set(sourceName, exportedName);
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator2.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator2.f();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
results.push({
|
|
71
|
+
sourcePath: resolved,
|
|
72
|
+
nameMap: nameMap
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
_iterator.e(err);
|
|
78
|
+
} finally {
|
|
79
|
+
_iterator.f();
|
|
80
|
+
}
|
|
81
|
+
return results;
|
|
82
|
+
} catch (_unused) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Parse the package.json exports field and return a map of export paths to resolved file paths.
|
|
89
|
+
*/
|
|
90
|
+
export function parsePackageExports(_ref2) {
|
|
91
|
+
var packageDir = _ref2.packageDir,
|
|
92
|
+
fs = _ref2.fs;
|
|
15
93
|
// Memoize per-package to avoid repeated reads/parses during IDE lint runs.
|
|
16
94
|
// Additionally, invalidate per-package if the package.json mtime changes
|
|
17
95
|
// (covers unstaged local edits in IDE).
|
|
@@ -23,7 +101,7 @@ export function parsePackageExports(_ref) {
|
|
|
23
101
|
try {
|
|
24
102
|
var _fs$statSync$mtimeMs;
|
|
25
103
|
currentMtimeMs = (_fs$statSync$mtimeMs = fs.statSync(packageJsonPath).mtimeMs) !== null && _fs$statSync$mtimeMs !== void 0 ? _fs$statSync$mtimeMs : null;
|
|
26
|
-
} catch (
|
|
104
|
+
} catch (_unused2) {
|
|
27
105
|
// If package.json can't be stat'ed (missing/inaccessible), use null to force re-read
|
|
28
106
|
currentMtimeMs = null;
|
|
29
107
|
}
|
|
@@ -72,7 +150,7 @@ export function parsePackageExports(_ref) {
|
|
|
72
150
|
}
|
|
73
151
|
}
|
|
74
152
|
}
|
|
75
|
-
} catch (
|
|
153
|
+
} catch (_unused3) {
|
|
76
154
|
// Ignore parsing errors
|
|
77
155
|
}
|
|
78
156
|
|
|
@@ -83,29 +161,82 @@ export function parsePackageExports(_ref) {
|
|
|
83
161
|
});
|
|
84
162
|
return exportsMap;
|
|
85
163
|
}
|
|
86
|
-
|
|
87
164
|
/**
|
|
88
165
|
* Find a matching export entry for a given source file path.
|
|
89
166
|
* Returns the export path (e.g., "./controllers/analytics") or null if not found.
|
|
167
|
+
*
|
|
168
|
+
* When `fs` is provided, also checks entry-point wrapper files. If an export resolves
|
|
169
|
+
* to a file inside a recognized entry-points folder (entry-points, entrypoints, etc.),
|
|
170
|
+
* the wrapper is parsed to see if it re-exports from `sourceFilePath`.
|
|
171
|
+
*
|
|
172
|
+
* `sourceExportName` is the name under which the symbol is exported from the source file
|
|
173
|
+
* (e.g. `'default'`). Used to look up the corresponding entry-point export name so the
|
|
174
|
+
* caller can generate the correct import style.
|
|
90
175
|
*/
|
|
91
|
-
export function findExportForSourceFile(
|
|
92
|
-
var sourceFilePath =
|
|
93
|
-
exportsMap =
|
|
94
|
-
|
|
95
|
-
|
|
176
|
+
export function findExportForSourceFile(_ref3) {
|
|
177
|
+
var sourceFilePath = _ref3.sourceFilePath,
|
|
178
|
+
exportsMap = _ref3.exportsMap,
|
|
179
|
+
fs = _ref3.fs,
|
|
180
|
+
sourceExportName = _ref3.sourceExportName;
|
|
181
|
+
var _iterator3 = _createForOfIteratorHelper(exportsMap),
|
|
182
|
+
_step3;
|
|
96
183
|
try {
|
|
97
|
-
for (
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
184
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
185
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
186
|
+
_exportPath = _step3$value[0],
|
|
187
|
+
_resolvedPath = _step3$value[1];
|
|
188
|
+
if (_resolvedPath === sourceFilePath) {
|
|
189
|
+
return {
|
|
190
|
+
exportPath: _exportPath
|
|
191
|
+
};
|
|
103
192
|
}
|
|
104
193
|
}
|
|
105
194
|
} catch (err) {
|
|
106
|
-
|
|
195
|
+
_iterator3.e(err);
|
|
107
196
|
} finally {
|
|
108
|
-
|
|
197
|
+
_iterator3.f();
|
|
198
|
+
}
|
|
199
|
+
if (fs) {
|
|
200
|
+
var _iterator4 = _createForOfIteratorHelper(exportsMap),
|
|
201
|
+
_step4;
|
|
202
|
+
try {
|
|
203
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
204
|
+
var _step4$value = _slicedToArray(_step4.value, 2),
|
|
205
|
+
exportPath = _step4$value[0],
|
|
206
|
+
resolvedPath = _step4$value[1];
|
|
207
|
+
if (isInEntryPointsFolder(resolvedPath)) {
|
|
208
|
+
var reExports = resolveEntryPointReExports({
|
|
209
|
+
entryPointFilePath: resolvedPath,
|
|
210
|
+
fs: fs
|
|
211
|
+
});
|
|
212
|
+
var _iterator5 = _createForOfIteratorHelper(reExports),
|
|
213
|
+
_step5;
|
|
214
|
+
try {
|
|
215
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
216
|
+
var reExport = _step5.value;
|
|
217
|
+
if (reExport.sourcePath === sourceFilePath) {
|
|
218
|
+
var entryPointExportName = void 0;
|
|
219
|
+
if (sourceExportName !== undefined && reExport.nameMap.has(sourceExportName)) {
|
|
220
|
+
entryPointExportName = reExport.nameMap.get(sourceExportName);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
exportPath: exportPath,
|
|
224
|
+
entryPointExportName: entryPointExportName
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} catch (err) {
|
|
229
|
+
_iterator5.e(err);
|
|
230
|
+
} finally {
|
|
231
|
+
_iterator5.f();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
} catch (err) {
|
|
236
|
+
_iterator4.e(err);
|
|
237
|
+
} finally {
|
|
238
|
+
_iterator4.f();
|
|
239
|
+
}
|
|
109
240
|
}
|
|
110
241
|
return null;
|
|
111
242
|
}
|
|
@@ -129,10 +260,10 @@ export function extractPackageNameFromImport(moduleSpecifier) {
|
|
|
129
260
|
* Resolve a cross-package import to its package directory and export info.
|
|
130
261
|
* Returns null if the package is not in the target folder or cannot be resolved.
|
|
131
262
|
*/
|
|
132
|
-
export function resolveCrossPackageImport(
|
|
133
|
-
var moduleSpecifier =
|
|
134
|
-
workspaceRoot =
|
|
135
|
-
fs =
|
|
263
|
+
export function resolveCrossPackageImport(_ref4) {
|
|
264
|
+
var moduleSpecifier = _ref4.moduleSpecifier,
|
|
265
|
+
workspaceRoot = _ref4.workspaceRoot,
|
|
266
|
+
fs = _ref4.fs;
|
|
136
267
|
// Only handle @atlassian/* scoped packages
|
|
137
268
|
var parsed = extractPackageNameFromImport(moduleSpecifier);
|
|
138
269
|
if (!parsed) {
|