Skip to content

Commit

Permalink
chore(release): 1.90.0 (#4288)
Browse files Browse the repository at this point in the history
  • Loading branch information
madeline-k authored Oct 6, 2023
2 parents 2f74b3e + eaca06e commit d6bdb4d
Show file tree
Hide file tree
Showing 18 changed files with 549 additions and 380 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.90.0](https://github.com/aws/jsii/compare/v1.89.0...v1.90.0) (2023-10-06)

## [1.89.0](https://github.com/aws/jsii/compare/v1.88.0...v1.89.0) (2023-09-20)

## [1.88.0](https://github.com/aws/jsii/compare/v1.87.0...v1.88.0) (2023-08-24)
Expand Down
4 changes: 2 additions & 2 deletions gh-pages/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mkdocs~=1.5.2
mkdocs~=1.5.3
mkdocs-awesome-pages-plugin~=2.9.2
mkdocs-material~=9.3.1
mkdocs-material~=9.4.3
mkdocs-git-revision-date-plugin~=0.3.2
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"rejectCycles": true
}
},
"version": "1.89.0",
"version": "1.90.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"devDependencies": {
"@jest/types": "^28.1.3",
"@types/jest": "^29.5.5",
"@types/node": "^14.18.62",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@types/node": "^14.18.63",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"all-contributors-cli": "^6.26.1",
"eslint": "^8.49.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@types/glob": "^8.1.0",
"glob": "^10.3.4"
"glob": "^10.3.10"
},
"scripts": {
"build": "yarn --silent tsc --build && npm run lint",
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/dotnet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@jsii/runtime": "^0.0.0",
"@types/semver": "^7.5.2",
"@types/semver": "^7.5.3",
"jsii-build-tools": "^0.0.0",
"semver": "^7.5.4"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/@jsii/go-runtime-test/project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/aws/jsii/jsii-calc/go/scopejsiicalclib v0.0.0-devpreview
github.com/stretchr/testify v1.8.4
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/tools v0.13.0
golang.org/x/tools v0.14.0
)

require (
Expand All @@ -21,8 +21,8 @@ require (
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
7 changes: 7 additions & 0 deletions packages/@jsii/go-runtime-test/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -45,6 +48,8 @@ golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
Expand All @@ -57,6 +62,8 @@ golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 3 additions & 3 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ require (
github.com/mattn/go-isatty v0.0.19
github.com/stretchr/testify v1.8.4
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/tools v0.13.0
golang.org/x/tools v0.14.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
14 changes: 7 additions & 7 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/python-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"jsii-build-tools": "^0.0.0",
"jsii-calc": "^3.20.120",
"jsii-pacmak": "^0.0.0",
"pyright": "^1.1.328"
"pyright": "^1.1.330"
}
}
158 changes: 158 additions & 0 deletions packages/jsii-diff/BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Changes jsii-diff considers breaking

jsii-diff considers a change breaking if there exists a program that would
successfully compile against a previous version of the library, but would fail
to compile against the new proposed version of the library.

Some rules are specific to one of TypeScript, Java, C#, Python and Go, but as a
jsii user you have to take all of these into account.

This document will go over the most common changes you want to make that jsii-diff
will consider breaking, why that is, and what to do about it.

## Making properties optional

By far the most commonly asked question is: *Why am I not allowed to turn this required property into an optional property?*

The answer is:

> [!IMPORTANT]
> You are allowed to make *inputs* optional, but you are not allowed to make *outputs* optional.
This often manifests itself as a class that takes a struct, and then copies some of the values onto itself as properties. For example:

```ts
interface DogOptions {
readonly name: string; // This 'name: string' is an INPUT
}

class Dog {
public readonly name: string; // This 'name: string' is an OUTPUT

constructor(options: DogOptions) {
this.name = options.name;
}
}
```

You *are* allowed to make `DogOptions.name` optional! Someone could have written the program:

```ts
// Still valid. 'name' takes either 'string' or 'undefined', and we are giving it a 'string'
new Dog({ name: 'Fido' });
```

You are *not* allowed to make `Dog.name` optional though. Someone could have written the program:

```ts
const d = new Dog({ name: 'Fido' });
console.log(d.name.toLowerCase());

// Not valid anymore after the type of `d.name` has changed into `string | undefined`.
// 'd.name' can be undefined, and we have to account for that with an `if`!
```

### Optional properties: how to solve

You'll have to make the input optional without making the output optional. That raises
the question, what do we do when we have to produce an output value that we don't have?
The simplest solution is to throw an exception:

```ts
interface DogOptions {
readonly name?: string;
}

class Dog {
private readonly _name?: string;

constructor(options: DogOptions) {
this._name = options.name;
}

public get name(): string {
if (!this._name) {
throw new Error('Dog does not have a name');
}
return this._name;
}
}
```

This doesn't break any existing users: all their Dogs will have names, so they will not hit the exception path.

For new users that fail to give their Dog a name, presumably they will be aware that their Dog doesn't have a name, so they can avoid trying to read it. If you want to give them a way to avoid the exception, add a `public get hasName(): boolean` field so they can test for the existence of the name before accessing it.

## Changing types to superclass/subclass

When changing types involved in an operation, you run into a similar issue as with changing the optionality of a property:

> [!IMPORTANT]
> You are allowed to make *inputs* accept a supertype, but you are only allowed to make *outputs* return a subtype.
This manifests when you want to introduce a new common supertype from two or more existing types. For example,
let's say we have Dogs and Cats, and some operations that only work on some of them:

```ts
class Dog { }
class Cat { }

function feed(animal: Cat): void;
function pet(animal: Dog): void;
function getFromKennel(name: string): Dog;
```

We would like to clean up this code and introduce a new class, `Animal`, that will be a new supertype to both Dog and Cat:

```ts
class Animal { }
class Dog extends Animal { }
class Cat extends Animal { }
```

Now, what can we do with our operations? Can we make `feed` and `pet` accept an `Animal`?

```ts
function feed(animal: Animal): void;
function pet(animal: Animal): void;

// Yes! Code from before still works:
feed(new Cat());
feed(new Dog());
```

Can we make `getFromKennel()` return an `Animal`?

```ts
function getFromKennel(name: string): Animal;

// NO! Someone could have written this, and this no longer compiles without an 'instanceof' check!
const d: Dog = getFromKennel('Fido');
```

> [!WARNING]
> Depending on your definitions of `Dog`, `Cat` and `Animal`, the above code might actually compile just
> fine in TypeScript. That is because of TypeScript's [structural typing](https://www.typescriptlang.org/docs/handbook/type-compatibility.html),
> which doesn't (always) look at the name of the type, but just at the fields on it. If the fields are the
> same, TypeScript may consider the types "close enough" and allow the assignment. The above TypeScript
> behavior may make it possible to accidentally build APIs that can never be used in nominally typed
> languages like Java or C#. jsii-diff will do nominal checks on function signatures, but it cannot
> do nominal checks on function implementations.
### Extracting a supertype: how to solve

`getFromKennel()` must keep returning a `Dog`, so we have to make an alternative function for the generic case and forward the implementation:

```ts
function getAnimalFromKennel(name: string): Animal {
return /* ... */;
}

function getFromKennel(name: string): Dog {
const x = getAnimalFromKennel(name);
if (!(x instanceof Dog)) {
throw new Error(`I expected ${name} to be a Dog`);
}
return x;
}
```
4 changes: 4 additions & 0 deletions packages/jsii-diff/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ abstract members yet.
for subclassing, but treating them as such would limit the evolvability of
libraries too much.

## Help! jsii-diff is marking my changes as breaking

See [BREAKING_CHANGES.md](./BREAKING_CHANGES.md) for more information.

## License

__jsii-diff__ is distributed under the
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
"@jsii/go-runtime": "^0.0.0",
"@scope/jsii-calc-lib": "^0.0.0",
"@types/clone": "^2.1.2",
"@types/diff": "^5.0.4",
"@types/diff": "^5.0.5",
"@types/commonmark": "^0.27.7",
"@types/fs-extra": "^9.0.13",
"@types/semver": "^7.5.2",
"@types/semver": "^7.5.3",
"diff": "^5.1.0",
"jsii": "^0.0.0",
"jsii-build-tools": "^0.0.0",
"jsii-calc": "^3.20.120",
"pyright": "^1.1.328"
"pyright": "^1.1.330"
},
"keywords": [
"jsii",
Expand Down
13 changes: 12 additions & 1 deletion packages/jsii-reflect/lib/type-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class TypeSystem {

private readonly _assemblyLookup = new Map<string, Assembly>();

private readonly _cachedClasses = new Map<Assembly, readonly ClassType[]>();

/**
* All assemblies in this type system.
*/
Expand Down Expand Up @@ -274,7 +276,16 @@ export class TypeSystem {
public get classes(): readonly ClassType[] {
const out = new Array<ClassType>();
this.assemblies.forEach((a) => {
out.push(...collectTypes(a, (item) => item.classes));
// Cache the class list for each assembly. We can't use @memoized for this method since new
// assemblies can be added between calls, via loadModule().
if (!this._cachedClasses.has(a)) {
this._cachedClasses.set(
a,
collectTypes(a, (item) => item.classes),
);
}

out.push(...this._cachedClasses.get(a)!);
});
return out;
}
Expand Down
Loading

0 comments on commit d6bdb4d

Please sign in to comment.