Skip to content

Commit

Permalink
Merge branch 'main' into rmuller/hide-deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 26, 2021
2 parents d4645e0 + 2630a80 commit a598334
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
8 changes: 1 addition & 7 deletions packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@
},
"schema": "jsii/0.10.0",
"submodules": {
"@scope/jsii-calc-lib.submodule": {
"locationInModule": {
"filename": "../@scope/jsii-calc-lib/build/index.d.ts",
"line": 157
}
},
"jsii-calc.DerivedClassHasNoProperties": {
"locationInModule": {
"filename": "lib/compliance.ts",
Expand Down Expand Up @@ -14441,5 +14435,5 @@
}
},
"version": "0.0.0",
"fingerprint": "4fJXgLfvFXFeZPUflIUswNxZKtt1vgIANXs/lWot+qg="
"fingerprint": "2KFlnOkWR5oOwLlri+7JlkA0BsYvnRkpBrk4nPWnJfw="
}
25 changes: 21 additions & 4 deletions packages/jsii/lib/assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export class Assembler implements Emitter {

/** Map of Symbol to namespace export Symbol */
private readonly _submoduleMap = new Map<ts.Symbol, ts.Symbol>();

/**
* Submodule information
*
* Contains submodule information for all namespaces that have been seen
* across all assemblies (this and dependencies).
*
* Filtered to local submodules only at time of writing the assembly out to disk.
*/
private readonly _submodules = new Map<ts.Symbol, SubmoduleSpec>();

/**
Expand Down Expand Up @@ -208,9 +217,7 @@ export class Assembler implements Emitter {
),
bundled: this.projectInfo.bundleDependencies,
types: this._types,
submodules: noEmptyDict(
toSubmoduleDeclarations(this._submodules.values()),
),
submodules: noEmptyDict(toSubmoduleDeclarations(this.mySubmodules())),
targets: this.projectInfo.targets,
metadata: this.projectInfo.metadata,
docs,
Expand Down Expand Up @@ -2596,6 +2603,16 @@ export class Assembler implements Emitter {
}
return docs;
}

/**
* Return only those submodules from the submodules list that are submodules inside this
* assembly.
*/
private mySubmodules() {
return Array.from(this._submodules.values()).filter((m) =>
m.fqn.startsWith(`${this.projectInfo.name}.`),
);
}
}

export interface AssemblerOptions {
Expand Down Expand Up @@ -2925,7 +2942,7 @@ function toDependencyClosure(
}

function toSubmoduleDeclarations(
submodules: IterableIterator<SubmoduleSpec>,
submodules: Iterable<SubmoduleSpec>,
): spec.Assembly['submodules'] {
const result: spec.Assembly['submodules'] = {};

Expand Down

0 comments on commit a598334

Please sign in to comment.