Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jsii): introduce submodules feature #1297

Merged
merged 26 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6e08662
feat(jsii): introduce submodules feature
RomainMuller Feb 27, 2020
8161f8f
Merge branch 'master' into rmuller/submodules
RomainMuller Mar 10, 2020
bfcdc22
address PR feedback
RomainMuller Mar 10, 2020
814e395
submodule some declarations in jsii-calc.
RomainMuller Mar 10, 2020
4cd2e17
Merge remote-tracking branch 'origin/master' into rmuller/submodules
RomainMuller Mar 10, 2020
bbb7406
Fix the python stuff
RomainMuller Mar 11, 2020
c8bfb68
Merge remote-tracking branch 'origin/master' into rmuller/submodules
RomainMuller Mar 11, 2020
eecc965
Fixup mktemp invokation for Linux
RomainMuller Mar 11, 2020
e0343da
specification addendum
RomainMuller Mar 12, 2020
bc8d3ba
Update docs/specifications/2-type-system.md
RomainMuller Mar 12, 2020
a396e82
typo
RomainMuller Mar 12, 2020
8845523
Represent submodules in jsii-reflect
RomainMuller Mar 13, 2020
a96ad4e
de-namespacing
RomainMuller Mar 13, 2020
54ab8da
Merge branch 'master' into rmuller/submodules
RomainMuller Mar 16, 2020
d46f8ac
undo import move in Python CodeGen
RomainMuller Mar 16, 2020
570540f
undo namespacing changes in kernel tests, too.
RomainMuller Mar 16, 2020
2d4aa0f
minor fixes
RomainMuller Mar 16, 2020
eec62fb
Fix bugs in compiler
RomainMuller Mar 16, 2020
318c67e
Fixing stuff in the submodules
RomainMuller Mar 16, 2020
9c7fe09
Fixup test
RomainMuller Mar 16, 2020
c8d7514
Merge remote-tracking branch 'origin/master' into rmuller/submodules
RomainMuller Mar 16, 2020
fd2d41a
fix test expectations
RomainMuller Mar 16, 2020
72877ca
Fix path capitalization (MacOS case-insentive FS made this... tough)
RomainMuller Mar 16, 2020
4f26cce
Merge branch 'master' into rmuller/submodules
RomainMuller Mar 17, 2020
09b567b
Merge branch 'master' into rmuller/submodules
RomainMuller Mar 18, 2020
b42349d
Merge remote-tracking branch 'origin/master' into rmuller/submodules
RomainMuller Mar 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/jsii-calc/lib/submodule/child/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
export interface Structure {
readonly bool: boolean;
}

export enum Goodness {
/** It's pretty good */
PRETTY_GOOD,
/** It's really good */
REALLY_GOOD,
/** It's amazingly good */
AMAZINGLY_GOOD
}
Comment on lines +5 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimistic today, aren't we? :-D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 changes: 3 additions & 14 deletions packages/jsii-calc/lib/submodule/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
export namespace nested_submodule {
export namespace deeplyNested {
export interface INamespaced {
readonly definedAt: string;
}
}

export class Namespaced implements deeplyNested.INamespaced {
public readonly definedAt = __filename;

private constructor() { }
}
}

export * as child from './child';
export * from './my-class';
export * from './nested_submodule';
export * as back_references from './refers-to-parent';
11 changes: 11 additions & 0 deletions packages/jsii-calc/lib/submodule/my-class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { nested_submodule } from './nested_submodule';
import { Goodness } from './child';
import { AllTypes } from '..';

export class MyClass implements nested_submodule.deeplyNested.INamespaced {
public readonly definedAt = __filename;
public readonly goodness = Goodness.AMAZINGLY_GOOD;
public allTypes?: AllTypes;

public constructor() { }
}
16 changes: 16 additions & 0 deletions packages/jsii-calc/lib/submodule/nested_submodule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Goodness } from './child';

export namespace nested_submodule {
export namespace deeplyNested {
export interface INamespaced {
readonly definedAt: string;
}
}

export abstract class Namespaced implements deeplyNested.INamespaced {
public readonly definedAt = __filename;
public abstract readonly goodness: Goodness;

private constructor() { }
}
}
5 changes: 5 additions & 0 deletions packages/jsii-calc/lib/submodule/refers-to-parent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { MyClass } from '..';

export interface MyClassReference {
readonly reference: MyClass;
}
170 changes: 161 additions & 9 deletions packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -12154,6 +12154,142 @@
"name": "CompositionStringStyle",
"namespace": "composition.CompositeOperation"
},
"jsii-calc.submodule.MyClass": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.MyClass",
"initializer": {
"docs": {
"stability": "experimental"
}
},
"interfaces": [
"jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced"
],
"kind": "class",
"locationInModule": {
"filename": "lib/submodule/my-class.ts",
"line": 5
},
"name": "MyClass",
"namespace": "submodule",
"properties": [
{
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/my-class.ts",
"line": 6
},
"name": "definedAt",
"overrides": "jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced",
"type": {
"primitive": "string"
}
},
{
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/my-class.ts",
"line": 7
},
"name": "goodness",
"type": {
"fqn": "jsii-calc.submodule.child.Goodness"
}
},
{
"docs": {
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/submodule/my-class.ts",
"line": 8
},
"name": "allTypes",
"optional": true,
"type": {
"fqn": "jsii-calc.AllTypes"
}
}
]
},
"jsii-calc.submodule.back_references.MyClassReference": {
"assembly": "jsii-calc",
"datatype": true,
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.back_references.MyClassReference",
"kind": "interface",
"locationInModule": {
"filename": "lib/submodule/refers-to-parent/index.ts",
"line": 3
},
"name": "MyClassReference",
"namespace": "submodule.back_references",
"properties": [
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/refers-to-parent/index.ts",
"line": 4
},
"name": "reference",
"type": {
"fqn": "jsii-calc.submodule.MyClass"
}
}
]
},
"jsii-calc.submodule.child.Goodness": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.submodule.child.Goodness",
"kind": "enum",
"locationInModule": {
"filename": "lib/submodule/child/index.ts",
"line": 5
},
"members": [
{
"docs": {
"stability": "experimental",
"summary": "It's pretty good."
},
"name": "PRETTY_GOOD"
},
{
"docs": {
"stability": "experimental",
"summary": "It's really good."
},
"name": "REALLY_GOOD"
},
{
"docs": {
"stability": "experimental",
"summary": "It's amazingly good."
},
"name": "AMAZINGLY_GOOD"
}
],
"name": "Goodness",
"namespace": "submodule.child"
},
"jsii-calc.submodule.child.Structure": {
"assembly": "jsii-calc",
"datatype": true,
Expand Down Expand Up @@ -12187,6 +12323,7 @@
]
},
"jsii-calc.submodule.nested_submodule.Namespaced": {
"abstract": true,
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
Expand All @@ -12197,8 +12334,8 @@
],
"kind": "class",
"locationInModule": {
"filename": "lib/submodule/index.ts",
"line": 8
"filename": "lib/submodule/nested_submodule.ts",
"line": 10
},
"name": "Namespaced",
"namespace": "submodule.nested_submodule",
Expand All @@ -12209,14 +12346,29 @@
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/index.ts",
"line": 9
"filename": "lib/submodule/nested_submodule.ts",
"line": 11
},
"name": "definedAt",
"overrides": "jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced",
"type": {
"primitive": "string"
}
},
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/nested_submodule.ts",
"line": 12
},
"name": "goodness",
"type": {
"fqn": "jsii-calc.submodule.child.Goodness"
}
}
]
},
Expand All @@ -12228,8 +12380,8 @@
"fqn": "jsii-calc.submodule.nested_submodule.deeplyNested.INamespaced",
"kind": "interface",
"locationInModule": {
"filename": "lib/submodule/index.ts",
"line": 3
"filename": "lib/submodule/nested_submodule.ts",
"line": 5
},
"name": "INamespaced",
"namespace": "submodule.nested_submodule.deeplyNested",
Expand All @@ -12241,8 +12393,8 @@
},
"immutable": true,
"locationInModule": {
"filename": "lib/submodule/index.ts",
"line": 4
"filename": "lib/submodule/nested_submodule.ts",
"line": 6
},
"name": "definedAt",
"type": {
Expand All @@ -12253,5 +12405,5 @@
}
},
"version": "1.1.0",
"fingerprint": "q2bAmQlqnFhbni6+NVgvKc4llulsPPEXGKkQvoTi1jo="
"fingerprint": "vtobmk8xL6Ke30Blb4NyDZ1X7T7J8lcKbbrmZtMtcpU="
}
Loading