@iyulab/components 2.27.0 → 2.27.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.27.1] - 2026-10-15
4
+
5
+ ### Fixed
6
+
7
+ - `plugins/dts-globals`: a class the declaration bundler inlined into an entry as a private copy (declared there, exported
8
+ only by another entry) is now pointed at the public export as well. The copy is a second nominal type for the same tag,
9
+ so a program that loaded both entries failed with `TS2717`.
10
+
3
11
  ## [2.27.0] - 2026-10-15
4
12
 
5
13
  ### Added
@@ -39,6 +39,8 @@ export declare function indexExportedTypes(packageName: string, entries: {
39
39
  key: string;
40
40
  source: string;
41
41
  }[]): Map<string, string>;
42
+ /** Type-capable names a declaration file exports (`export declare class X` · `export { X }` of a declared `X`). */
43
+ export declare function exportedTypeNames(source: string): Set<string>;
42
44
  /** Names a declaration file can use as types: its own type declarations and its imports. */
43
45
  export declare function localTypeNames(source: string): Set<string>;
44
46
  /**
@@ -61,24 +61,28 @@ export function indexExportedTypes(packageName, entries) {
61
61
  const ordered = [...entries].sort((a, b) => (a.key === '.' ? -1 : b.key === '.' ? 1 : 0));
62
62
  for (const { key, source } of ordered) {
63
63
  const specifier = key === '.' ? packageName : `${packageName}/${key.replace(/^\.\//, '')}`;
64
- const declared = localTypeNames(source);
65
- const exported = new Set();
66
- for (const m of source.matchAll(/^export\s+declare\s+(?:abstract\s+)?(?:class|interface|type|enum)\s+([A-Za-z_$][\w$]*)/gm)) {
67
- exported.add(m[1]);
68
- }
69
- for (const m of source.matchAll(/^export\s*\{([^}]*)\}\s*;?\s*$/gm)) {
70
- for (const part of m[1].split(',')) {
71
- const [local, alias] = part.trim().replace(/^type\s+/, '').split(/\s+as\s+/);
72
- if (local && declared.has(local))
73
- exported.add((alias ?? local).trim());
74
- }
75
- }
76
- for (const name of exported)
64
+ for (const name of exportedTypeNames(source))
77
65
  if (!index.has(name))
78
66
  index.set(name, specifier);
79
67
  }
80
68
  return index;
81
69
  }
70
+ /** Type-capable names a declaration file exports (`export declare class X` · `export { X }` of a declared `X`). */
71
+ export function exportedTypeNames(source) {
72
+ const declared = localTypeNames(source);
73
+ const exported = new Set();
74
+ for (const m of source.matchAll(/^export\s+declare\s+(?:abstract\s+)?(?:class|interface|type|enum)\s+([A-Za-z_$][\w$]*)/gm)) {
75
+ exported.add(m[1]);
76
+ }
77
+ for (const m of source.matchAll(/^export\s*\{([^}]*)\}\s*;?\s*$/gm)) {
78
+ for (const part of m[1].split(',')) {
79
+ const [local, alias] = part.trim().replace(/^type\s+/, '').split(/\s+as\s+/);
80
+ if (local && declared.has(local))
81
+ exported.add((alias ?? local).trim());
82
+ }
83
+ }
84
+ return exported;
85
+ }
82
86
  /** Names a declaration file can use as types: its own type declarations and its imports. */
83
87
  export function localTypeNames(source) {
84
88
  const names = new Set();
@@ -135,6 +139,16 @@ export function libGlobalNames(packageRoot) {
135
139
  */
136
140
  export function resolveDanglingGlobals(source, exportedFrom, globals = new Set()) {
137
141
  const local = localTypeNames(source);
142
+ // A class the bundler inlined as a private copy (declared here, exported only by another entry) is a second nominal
143
+ // type for the same tag — merging both copies into one global map fails with TS2717. Point at the public one.
144
+ const exportedHere = exportedTypeNames(source);
145
+ for (const name of [...local]) {
146
+ if (exportedHere.has(name) || !exportedFrom.has(name))
147
+ continue;
148
+ const declared = new RegExp(`^\\s*(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?(?:class|interface|type|enum)\\s+${name}\\b`, 'm');
149
+ if (declared.test(source))
150
+ local.delete(name); // an import is an explicit binding — kept
151
+ }
138
152
  for (const name of globals)
139
153
  if (!exportedFrom.has(name))
140
154
  local.add(name);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.27.0",
4
+ "version": "2.27.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",