Skip to content

Commit c22a0a4

Browse files
committed
fix(compiler): fix static analysis of dependencies
1 parent ecafff2 commit c22a0a4

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/compiler/entries/entry-modules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ export function createEntryModule(cmps: d.ComponentCompilerMeta[]): d.EntryModul
3232

3333
// get the modes used in this bundle
3434
modeNames: getEntryModes(cmps),
35-
36-
// figure out if we'll need a scoped css build
37-
requiresScopedStyles: true
3835
};
3936
}
4037

src/compiler/entries/resolve-component-dependencies.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as d from '../../declarations';
22
import { flatOne, unique } from '@utils';
33

4-
export function resolveComponentDependencies(compilerCtx: d.CompilerCtx, cmps: d.ComponentCompilerMeta[]) {
5-
computeDependencies(compilerCtx, cmps);
4+
export function resolveComponentDependencies(cmps: d.ComponentCompilerMeta[]) {
5+
computeDependencies(cmps);
66
computeDependants(cmps);
77
}
88

9-
function computeDependencies(compilerCtx: d.CompilerCtx, cmps: d.ComponentCompilerMeta[]) {
9+
function computeDependencies(cmps: d.ComponentCompilerMeta[]) {
1010
const visited = new Set();
1111
cmps.forEach(cmp => {
12-
resolveTransitiveDependencies(compilerCtx, cmp, cmps, visited);
12+
resolveTransitiveDependencies(cmp, cmps, visited);
1313
cmp.dependencies = unique(cmp.dependencies).sort();
1414
});
1515
}
@@ -20,21 +20,19 @@ function computeDependants(cmps: d.ComponentCompilerMeta[]) {
2020
});
2121
}
2222

23-
function resolveTransitiveDependencies(compilerCtx: d.CompilerCtx, cmp: d.ComponentCompilerMeta, cmps: d.ComponentCompilerMeta[], visited: Set<d.ComponentCompilerMeta>): string[] {
23+
function resolveTransitiveDependencies(cmp: d.ComponentCompilerMeta, cmps: d.ComponentCompilerMeta[], visited: Set<d.ComponentCompilerMeta>): string[] {
2424
if (visited.has(cmp)) {
2525
return cmp.dependencies;
2626
}
2727
visited.add(cmp);
2828

29-
const moduleFile = compilerCtx.moduleMap.get(cmp.sourceFilePath);
30-
31-
const dependencies = moduleFile.potentialCmpRefs.filter(tagName => cmps.some(c => c.tagName === tagName));
29+
const dependencies = cmp.potentialCmpRefs.filter(tagName => cmps.some(c => c.tagName === tagName));
3230
cmp.dependencies = cmp.directDependencies = dependencies;
3331

3432
const transitiveDeps = flatOne(
3533
dependencies
3634
.map(tagName => cmps.find(c => c.tagName === tagName))
37-
.map(c => resolveTransitiveDependencies(compilerCtx, c, cmps, visited))
35+
.map(c => resolveTransitiveDependencies(c, cmps, visited))
3836
);
3937
return cmp.dependencies = [
4038
...dependencies,

src/compiler/transpile/transpile-app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ async function processMetadata(config: d.Config, compilerCtx: d.CompilerCtx, bui
3535

3636
buildCtx.moduleFiles = Array.from(compilerCtx.moduleMap.values());
3737
buildCtx.components = getComponentsFromModules(buildCtx.moduleFiles);
38-
resolveComponentDependencies(compilerCtx, buildCtx.components);
3938
updateComponentBuildConditionals(compilerCtx.moduleMap, buildCtx.components);
39+
resolveComponentDependencies(buildCtx.components);
4040

4141
if (doTranspile && !buildCtx.hasError) {
4242
// ts changes have happened!!

src/declarations/entry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export interface EntryModule {
55
entryKey?: string;
66
dependencies?: string[];
77
cmps: d.ComponentCompilerMeta[];
8-
requiresScopedStyles?: boolean;
98
modeNames?: string[];
109
entryBundles?: EntryBundle[];
1110
}

0 commit comments

Comments
 (0)