Skip to content

Commit 753eba9

Browse files
committed
Fix
1 parent 1832d42 commit 753eba9

9 files changed

Lines changed: 39 additions & 86 deletions

File tree

eslint-rules/no-barrel-imports.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ function resolveImportSource(spec, fromFile) {
4545
return null;
4646
}
4747

48+
// A name may be exported both as a value and as a type with the same identifier
49+
// (e.g. `export const X = ...; export type X = typeof X`). When merging entries
50+
// for the same name, treat the export as a value if any declaration is a value.
51+
function setExport(exports, name, entry) {
52+
const existing = exports.get(name);
53+
if (existing) {
54+
exports.set(name, { ...entry, isType: existing.isType && entry.isType });
55+
} else {
56+
exports.set(name, entry);
57+
}
58+
}
59+
4860
function declarationNames(decl) {
4961
if (!decl) return [];
5062
switch (decl.type) {
@@ -85,7 +97,7 @@ function getModuleExports(filepath, stack = new Set()) {
8597
else if (stmt.type === 'ExportAllDeclaration')
8698
collectStarExports(stmt, exports, filepath, stack);
8799
else if (stmt.type === 'ExportDefaultDeclaration') {
88-
exports.set('default', {
100+
setExport(exports, 'default', {
89101
source: filepath,
90102
localName: 'default',
91103
isType: false,
@@ -104,7 +116,7 @@ function collectNamedExports(stmt, exports, filepath, stack) {
104116

105117
if (stmt.declaration) {
106118
for (const { name, isType } of declarationNames(stmt.declaration)) {
107-
exports.set(name, {
119+
setExport(exports, name, {
108120
source: filepath,
109121
localName: name,
110122
isType: isType || stmtIsType,
@@ -117,7 +129,7 @@ function collectNamedExports(stmt, exports, filepath, stack) {
117129
if (!stmt.source) {
118130
for (const spec of stmt.specifiers ?? []) {
119131
if (spec.type !== 'ExportSpecifier') continue;
120-
exports.set(idOrStr(spec.exported), {
132+
setExport(exports, idOrStr(spec.exported), {
121133
source: filepath,
122134
localName: idOrStr(spec.local),
123135
isType: stmtIsType || spec.exportKind === 'type',
@@ -152,7 +164,7 @@ function collectNamedExports(stmt, exports, filepath, stack) {
152164
}
153165
}
154166

155-
exports.set(idOrStr(spec.exported), {
167+
setExport(exports, idOrStr(spec.exported), {
156168
source,
157169
bareSource,
158170
localName: local,
@@ -167,7 +179,7 @@ function collectStarExports(stmt, exports, filepath, stack) {
167179
const targetFile = resolveImportSource(stmt.source.value, filepath);
168180

169181
if (stmt.exported) {
170-
exports.set(idOrStr(stmt.exported), {
182+
setExport(exports, idOrStr(stmt.exported), {
171183
source: targetFile,
172184
isType: stmtIsType,
173185
kind: 'namespace',

packages/@ember/array/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@ember/utils": "workspace:*",
2121
"@glimmer/destroyable": "workspace:*",
2222
"@glimmer/env": "workspace:*",
23+
"@glimmer/interfaces": "workspace:*",
2324
"@glimmer/manager": "workspace:*",
2425
"@glimmer/owner": "workspace:*",
2526
"@glimmer/util": "workspace:*",

packages/@ember/object/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@ember/utils": "workspace:*",
3030
"@glimmer/destroyable": "workspace:*",
3131
"@glimmer/env": "workspace:*",
32+
"@glimmer/interfaces": "workspace:*",
3233
"@glimmer/manager": "workspace:*",
3334
"@glimmer/owner": "workspace:*",
3435
"@glimmer/util": "workspace:*",

packages/@ember/reactive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"./*": "./*.ts"
99
},
1010
"dependencies": {
11-
"@glimmer/validator": "0.95.0"
11+
"@glimmer/validator": "workspace:*"
1212
}
1313
}

packages/@ember/template-factory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"./*": "./*.ts"
88
},
99
"dependencies": {
10-
"@glimmer/opcode-compiler": "0.94.10"
10+
"@glimmer/opcode-compiler": "workspace:*"
1111
}
1212
}

packages/@glimmer/debug/lib/render/basic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { CompilableTemplate, Optional, Reference, SimpleNode } from '@glimmer/interfaces';
2-
import type { IS_COMPILABLE_TEMPLATE } from '@glimmer/constants/lib/brand';
2+
import { IS_COMPILABLE_TEMPLATE } from '@glimmer/constants/lib/brand';
33
import { REFERENCE } from '@glimmer/reference/lib/reference';
44
import { isIndexable } from '@glimmer/util/lib/collections';
55

packages/@glimmer/opcode-compiler/lib/compilable-template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
SymbolTable,
1616
WireFormat,
1717
} from '@glimmer/interfaces';
18-
import type { IS_COMPILABLE_TEMPLATE } from '@glimmer/constants/lib/brand';
18+
import { IS_COMPILABLE_TEMPLATE } from '@glimmer/constants/lib/brand';
1919
import { LOCAL_TRACE_LOGGING } from '@glimmer/local-debug-flags';
2020
import { EMPTY_ARRAY } from '@glimmer/util/lib/array-utils';
2121

packages/@glimmer/tracking/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"./*": "./*.ts"
99
},
1010
"dependencies": {
11-
"@ember/-internals": "workspace:*"
11+
"@ember/-internals": "workspace:*",
12+
"@glimmer/validator": "workspace:*"
1213
}
13-
}
14+
}

pnpm-lock.yaml

Lines changed: 13 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)