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: internal accessibility #390

Merged
merged 4 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
64 changes: 61 additions & 3 deletions packages/jsii-calc/lib/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ export class StripInternal {
* This is an internal thing
* @internal
eladb marked this conversation as resolved.
Show resolved Hide resolved
*/
public youDontSeeMeAlthoughIamPublic = 'world'
public _youDontSeeMeAlthoughIamPublic = 'world'
}

/**
Expand All @@ -1357,12 +1357,70 @@ export class InternalClass {
/**
* @internal
*/
export interface IInternalInterface { }
export interface IInternalInterface {
prop: string;
}

/**
* @internal
*/
export enum InternalEnum {
Member1 = 12,
Member2 = 23
}
}

export interface IInterfaceWithInternal {
visible(): void;

/** @internal */
_hidden(): void;
}

export class ImplementsInterfaceWithInternal implements IInterfaceWithInternal {
visible() { }

/** @internal */
_hidden() { }

/** @internal */
_alsoHidden() { }

/** @internal */
_propertiesToo?: string;
}

export class ImplementsInterfaceWithInternalSubclass extends ImplementsInterfaceWithInternal {
/** @internal */
_alsoHidden() { }

/**
* @internal
*/
public _propertiesToo?: string;
}

//
// hidden interface erasure
// if a class/interface uses a hidden (private/internal) interface as base, the base will
// be erased from the API
//

interface IPrivateInterface {
private: string;
}

export interface ExtendsInternalInterface extends IInternalInterface {
boom: boolean
}

export class ImplementInternalInterface implements IInternalInterface {
prop = 'implement me'
}

export class ImplementsPrivateInterface implements IPrivateInterface {
public private = 'i came from private into the light'
}

export interface ExtendsPrivateInterface extends IPrivateInterface {
moreThings: string[];
}
119 changes: 118 additions & 1 deletion packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,43 @@
}
]
},
"jsii-calc.ExtendsInternalInterface": {
"assembly": "jsii-calc",
"datatype": true,
"fqn": "jsii-calc.ExtendsInternalInterface",
"kind": "interface",
"name": "ExtendsInternalInterface",
"properties": [
{
"abstract": true,
"name": "boom",
"type": {
"primitive": "boolean"
}
}
]
},
"jsii-calc.ExtendsPrivateInterface": {
"assembly": "jsii-calc",
"datatype": true,
"fqn": "jsii-calc.ExtendsPrivateInterface",
"kind": "interface",
"name": "ExtendsPrivateInterface",
"properties": [
{
"abstract": true,
"name": "moreThings",
"type": {
"collection": {
"elementtype": {
"primitive": "string"
},
"kind": "array"
}
}
}
]
},
"jsii-calc.GiveMeStructs": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.GiveMeStructs",
Expand Down Expand Up @@ -1649,6 +1686,18 @@
}
]
},
"jsii-calc.IInterfaceWithInternal": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.IInterfaceWithInternal",
"kind": "interface",
"methods": [
{
"abstract": true,
"name": "visible"
}
],
"name": "IInterfaceWithInternal"
},
"jsii-calc.IInterfaceWithMethods": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.IInterfaceWithMethods",
Expand Down Expand Up @@ -1776,6 +1825,74 @@
}
]
},
"jsii-calc.ImplementInternalInterface": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementInternalInterface",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementInternalInterface",
"properties": [
{
"name": "prop",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.ImplementsInterfaceWithInternal": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementsInterfaceWithInternal",
"initializer": {
"initializer": true
},
"interfaces": [
{
"fqn": "jsii-calc.IInterfaceWithInternal"
}
],
"kind": "class",
"methods": [
{
"name": "visible",
"overrides": {
"fqn": "jsii-calc.IInterfaceWithInternal"
}
}
],
"name": "ImplementsInterfaceWithInternal"
},
"jsii-calc.ImplementsInterfaceWithInternalSubclass": {
"assembly": "jsii-calc",
"base": {
"fqn": "jsii-calc.ImplementsInterfaceWithInternal"
},
"fqn": "jsii-calc.ImplementsInterfaceWithInternalSubclass",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementsInterfaceWithInternalSubclass"
},
"jsii-calc.ImplementsPrivateInterface": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementsPrivateInterface",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementsPrivateInterface",
"properties": [
{
"name": "private",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.ImplictBaseOfBase": {
"assembly": "jsii-calc",
"datatype": true,
Expand Down Expand Up @@ -3966,5 +4083,5 @@
}
},
"version": "0.7.15",
"fingerprint": "73Alf0ZvqK2FlLtj23s9t2mdHy29p1KR8E8O6oLIxh4="
"fingerprint": "iMxRj3lsHKNzSiBrjCyBH6Pp7Uvo+1Sxh/jN3hW+3nA="
}
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,43 @@
}
]
},
"jsii-calc.ExtendsInternalInterface": {
"assembly": "jsii-calc",
"datatype": true,
"fqn": "jsii-calc.ExtendsInternalInterface",
"kind": "interface",
"name": "ExtendsInternalInterface",
"properties": [
{
"abstract": true,
"name": "boom",
"type": {
"primitive": "boolean"
}
}
]
},
"jsii-calc.ExtendsPrivateInterface": {
"assembly": "jsii-calc",
"datatype": true,
"fqn": "jsii-calc.ExtendsPrivateInterface",
"kind": "interface",
"name": "ExtendsPrivateInterface",
"properties": [
{
"abstract": true,
"name": "moreThings",
"type": {
"collection": {
"elementtype": {
"primitive": "string"
},
"kind": "array"
}
}
}
]
},
"jsii-calc.GiveMeStructs": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.GiveMeStructs",
Expand Down Expand Up @@ -1649,6 +1686,18 @@
}
]
},
"jsii-calc.IInterfaceWithInternal": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.IInterfaceWithInternal",
"kind": "interface",
"methods": [
{
"abstract": true,
"name": "visible"
}
],
"name": "IInterfaceWithInternal"
},
"jsii-calc.IInterfaceWithMethods": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.IInterfaceWithMethods",
Expand Down Expand Up @@ -1776,6 +1825,74 @@
}
]
},
"jsii-calc.ImplementInternalInterface": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementInternalInterface",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementInternalInterface",
"properties": [
{
"name": "prop",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.ImplementsInterfaceWithInternal": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementsInterfaceWithInternal",
"initializer": {
"initializer": true
},
"interfaces": [
{
"fqn": "jsii-calc.IInterfaceWithInternal"
}
],
"kind": "class",
"methods": [
{
"name": "visible",
"overrides": {
"fqn": "jsii-calc.IInterfaceWithInternal"
}
}
],
"name": "ImplementsInterfaceWithInternal"
},
"jsii-calc.ImplementsInterfaceWithInternalSubclass": {
"assembly": "jsii-calc",
"base": {
"fqn": "jsii-calc.ImplementsInterfaceWithInternal"
},
"fqn": "jsii-calc.ImplementsInterfaceWithInternalSubclass",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementsInterfaceWithInternalSubclass"
},
"jsii-calc.ImplementsPrivateInterface": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.ImplementsPrivateInterface",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "ImplementsPrivateInterface",
"properties": [
{
"name": "private",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.ImplictBaseOfBase": {
"assembly": "jsii-calc",
"datatype": true,
Expand Down Expand Up @@ -3318,6 +3435,23 @@
],
"name": "StringEnum"
},
"jsii-calc.StripInternal": {
"assembly": "jsii-calc",
"fqn": "jsii-calc.StripInternal",
"initializer": {
"initializer": true
},
"kind": "class",
"name": "StripInternal",
"properties": [
{
"name": "youSeeMe",
"type": {
"primitive": "string"
}
}
]
},
"jsii-calc.Sum": {
"assembly": "jsii-calc",
"base": {
Expand Down Expand Up @@ -3949,5 +4083,5 @@
}
},
"version": "0.7.15",
"fingerprint": "IWSOEhdZzuvrss5K2WBjZCawXayV13yCAKTj/kJ9+mo="
"fingerprint": "iMxRj3lsHKNzSiBrjCyBH6Pp7Uvo+1Sxh/jN3hW+3nA="
}
Loading