poe-code 3.0.448 → 3.0.450
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/package.json
CHANGED
|
@@ -3,7 +3,9 @@ import { type Rule } from "../model.js";
|
|
|
3
3
|
* Import-driven vendoring check: for each genuinely-published package, every
|
|
4
4
|
* workspace package its shipped source actually imports (by bare name, at
|
|
5
5
|
* runtime — type-only and test imports excluded) must be vendored into its
|
|
6
|
-
* tarball (`bundledDependencies`)
|
|
7
|
-
*
|
|
6
|
+
* tarball (`bundledDependencies`), compiled into its entrypoint, or itself
|
|
7
|
+
* reach npm AND be declared in the importer's dependencies. A published-but-
|
|
8
|
+
* undeclared import is a phantom dependency that resolves only through
|
|
9
|
+
* hoisting luck and breaks the moment the tree layout changes.
|
|
8
10
|
*/
|
|
9
11
|
export declare const importedWorkspaceDepUnresolvable: Rule;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { isPublishedNpm, releaseTargetDirs } from "../model.js";
|
|
1
|
+
import { dependencyEdges, isPublishedNpm, releaseTargetDirs } from "../model.js";
|
|
2
2
|
const id = "imported-workspace-dep-unresolvable";
|
|
3
3
|
/**
|
|
4
4
|
* Import-driven vendoring check: for each genuinely-published package, every
|
|
5
5
|
* workspace package its shipped source actually imports (by bare name, at
|
|
6
6
|
* runtime — type-only and test imports excluded) must be vendored into its
|
|
7
|
-
* tarball (`bundledDependencies`)
|
|
8
|
-
*
|
|
7
|
+
* tarball (`bundledDependencies`), compiled into its entrypoint, or itself
|
|
8
|
+
* reach npm AND be declared in the importer's dependencies. A published-but-
|
|
9
|
+
* undeclared import is a phantom dependency that resolves only through
|
|
10
|
+
* hoisting luck and breaks the moment the tree layout changes.
|
|
9
11
|
*/
|
|
10
12
|
export const importedWorkspaceDepUnresolvable = {
|
|
11
13
|
id,
|
|
@@ -17,6 +19,7 @@ export const importedWorkspaceDepUnresolvable = {
|
|
|
17
19
|
continue;
|
|
18
20
|
const bundled = new Set(pkg.bundledDependencies);
|
|
19
21
|
const inlined = new Set(pkg.inlinedDependencies);
|
|
22
|
+
const declared = new Set(dependencyEdges(pkg).map((edge) => edge.name));
|
|
20
23
|
const unresolvable = new Map();
|
|
21
24
|
for (const ref of model.sourceImports.get(pkg.dir) ?? []) {
|
|
22
25
|
if (ref.isTest || ref.typeOnly || ref.kind !== "bare" || !ref.packageName)
|
|
@@ -28,8 +31,9 @@ export const importedWorkspaceDepUnresolvable = {
|
|
|
28
31
|
continue; // vendored into the tarball
|
|
29
32
|
if (inlined.has(dep.name))
|
|
30
33
|
continue; // compiled into the published entrypoint
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
// dep itself reaches npm — but only helps when the importer declares it
|
|
35
|
+
if (isPublishedNpm(dep) && released.has(dep.dir) && declared.has(dep.name))
|
|
36
|
+
continue;
|
|
33
37
|
const files = unresolvable.get(dep.name) ?? new Set();
|
|
34
38
|
files.add(ref.file);
|
|
35
39
|
unresolvable.set(dep.name, files);
|
|
@@ -48,8 +52,8 @@ export const importedWorkspaceDepUnresolvable = {
|
|
|
48
52
|
files: [...(unresolvable.get(d) ?? [])].sort()
|
|
49
53
|
}))
|
|
50
54
|
},
|
|
51
|
-
message: `${pkg.name} imports workspace packages that are neither bundled nor published: ${deps.join(", ")}`,
|
|
52
|
-
fix: `Vendor them via bundledDependencies,
|
|
55
|
+
message: `${pkg.name} imports workspace packages that are neither bundled nor declared published dependencies: ${deps.join(", ")}`,
|
|
56
|
+
fix: `Vendor them via bundledDependencies, or declare them in dependencies (publishing alone leaves a phantom import): ${deps.join(", ")}.`
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
return violations;
|