Skip to content

Commit

Permalink
feat(pacmak): allow use of any compatible jsii-rosetta version
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Apr 23, 2024
1 parent 466ed56 commit 2cd182e
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 44 deletions.
27 changes: 13 additions & 14 deletions gh-pages/content/overview/toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
!!! info
We are considering creating an "umbrella entrypoint" to make it easier to consume.

| Name | Release | Stability | Description |
| --------------- | ------- | -------------- | --------------------------------------------------------------------- |
| [jsii1] | `1.x` | [Maintenance] | Compiles TypeScript to jsii module (TypeScript 3.9 Syntax) |
| [jsii] | `5.0.x` | GA | Compiles TypeScript to jsii module (TypeScript 5.0 Syntax) |
| [jsii-pacmak] | `1.x` | GA | Creates ready-to-publish language-specific packages from jsii modules |
| [jsii-reflect] | `1.x` | GA | Strong-typed reflection library for jsii type systems |
| [jsii-diff] | `1.x` | GA | API backwards compatibility checker |
| [jsii-rosetta1] | `1.x` | [Maintenance] | Transpile code snippets (in docs) from TypeScript to jsii languages |
| [jsii-rosetta] | `5.0.x` | Experimental | Transpile code snippets (in docs) from TypeScript to jsii languages |
| [jsii-config] | `1.x` | Experimental | Interactive tool for generating jsii configuration |
| [jsii-release] | `1.x` | Community | Publishes jsii modules to all supported package managers |
| [jsii-srcmak] | `1.x` | Community | Generates relocatable source code in jsii languages from typescript |
| [jsii-docgen] | `1.x` | Community | Generates markdown API documentation for jsii modules |
| Name | Release | Stability | Description |
| --------------- | ------- | ------------- | --------------------------------------------------------------------- |
| [jsii1] | `1.x` | [Maintenance] | Compiles TypeScript to jsii module (TypeScript 3.9 Syntax) |
| [jsii] | `5.x` | GA | Compiles TypeScript to jsii module (TypeScript 5.x Syntax) |
| [jsii-pacmak] | `1.x` | GA | Creates ready-to-publish language-specific packages from jsii modules |
| [jsii-reflect] | `1.x` | GA | Strong-typed reflection library for jsii type systems |
| [jsii-diff] | `1.x` | GA | API backwards compatibility checker |
| [jsii-rosetta1] | `1.x` | [Maintenance] | Transpile code snippets (in docs) from TypeScript to jsii languages |
| [jsii-rosetta] | `5.x` | GA | Transpile code snippets (in docs) from TypeScript to jsii languages |
| [jsii-config] | `1.x` | Experimental | Interactive tool for generating jsii configuration |
| [jsii-release] | `1.x` | Community | Publishes jsii modules to all supported package managers |
| [jsii-srcmak] | `1.x` | Community | Generates relocatable source code in jsii languages from typescript |
| [jsii-docgen] | *any* | Community | Generates markdown API documentation for jsii modules |

??? question "Stability Definitions"
- **GA**: Projects that are deemed *Generally Available* and for which customers can expect full support, including
Expand All @@ -32,7 +32,6 @@

[semver]: https://semver.org/spec/v2.0.0.html


[Maintenance]: ../compiler-and-rosetta-maintenance.md
[jsii1]: https://github.com/aws/jsii/tree/main/packages/jsii
[jsii]: https://github.com/aws/jsii-compiler#readme
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/content/user-guides/language-support/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ declared _Generally Available_. At this point, breaking changes are no longer po
[`jsii-calc`]: ../../packages/jsii-calc
[`jsii-config`]: ../../packages/jsii-config
[`jsii-pacmak`]: ../../packages/jsii-pacmak
[`jsii-rosetta`]: ../../packages/jsii-rosetta
[`jsii-rosetta`]: https://github.com/aws/jsii-rosetta
[standard compliance suite]: ../../specification/4-standard-compliance-suite.md
[`public.ecr.aws/jsii/superchain`]: ../../superchain
[`aws-delivlib`]: https://github.com/awslabs/aws-delivlib
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/builder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Rosetta } from 'jsii-rosetta';
import { RosettaTabletReader } from 'jsii-rosetta';
import * as path from 'path';

import * as logging from './logging';
Expand Down Expand Up @@ -44,7 +44,7 @@ export interface BuildOptions {
/**
* The Rosetta instance to load examples from
*/
readonly rosetta: Rosetta;
readonly rosetta: RosettaTabletReader;

/**
* Whether to generate runtime type checking code in places where compile-time
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './suppress-jsii-upgrade-prompts';

import { TypeSystem } from 'jsii-reflect';
import { Rosetta, UnknownSnippetMode } from 'jsii-rosetta';
import { RosettaTabletReader, UnknownSnippetMode } from 'jsii-rosetta';
import { resolve } from 'path';
import { cwd } from 'process';

Expand Down Expand Up @@ -41,7 +41,7 @@ export async function pacmak({
updateNpmIgnoreFiles = false,
validateAssemblies = false,
}: PacmakOptions): Promise<void> {
const rosetta = new Rosetta({
const rosetta = new RosettaTabletReader({
unknownSnippets: rosettaUnknownSnippets,
prefixDisclaimer: true,
});
Expand Down Expand Up @@ -315,7 +315,7 @@ async function buildTargetsForLanguage(
fingerprint: boolean;
force: boolean;
perLanguageDirectory: boolean;
rosetta: Rosetta;
rosetta: RosettaTabletReader;
runtimeTypeChecking: boolean;
},
): Promise<void> {
Expand Down
2 changes: 0 additions & 2 deletions packages/jsii-pacmak/lib/suppress-jsii-upgrade-prompts.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/jsii-pacmak/lib/target.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as spec from '@jsii/spec';
import * as fs from 'fs-extra';
import * as reflect from 'jsii-reflect';
import { Rosetta } from 'jsii-rosetta';
import { RosettaTabletReader } from 'jsii-rosetta';
import * as path from 'path';
import * as spdx from 'spdx-license-list/full';

Expand All @@ -16,7 +16,7 @@ export abstract class Target {
protected readonly arguments: { [name: string]: any };
protected readonly targetName: string;
protected readonly assembly: reflect.Assembly;
protected readonly rosetta: Rosetta;
protected readonly rosetta: RosettaTabletReader;
protected readonly runtimeTypeChecking: boolean;

protected abstract readonly generator: IGenerator;
Expand Down Expand Up @@ -211,7 +211,7 @@ export interface TargetOptions {
assembly: reflect.Assembly;

/** The Rosetta instance */
rosetta: Rosetta;
rosetta: RosettaTabletReader;

/** Whether to generate runtime type-checking code */
runtimeTypeChecking: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/targets/dotnet/dotnetdocgenerator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as spec from '@jsii/spec';
import { CodeMaker } from 'codemaker';
import {
Rosetta,
RosettaTabletReader,
TargetLanguage,
enforcesStrictMode,
markDownToXmlDoc,
Expand All @@ -23,7 +23,7 @@ export class DotNetDocGenerator {

public constructor(
code: CodeMaker,
private readonly rosetta: Rosetta,
private readonly rosetta: RosettaTabletReader,
private readonly assembly: spec.Assembly,
) {
this.code = code;
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs-extra';
import * as http from 'http';
import * as https from 'https';
import * as reflect from 'jsii-reflect';
import { Rosetta } from 'jsii-rosetta';
import { RosettaTabletReader } from 'jsii-rosetta';
import * as path from 'path';

import { Generator, Legalese } from '../../generator';
Expand All @@ -23,7 +23,7 @@ import { ParameterValidator } from './runtime-type-checking';
export class DotNetGenerator extends Generator {
private readonly nameutils: DotNetNameUtils = new DotNetNameUtils();

private readonly rosetta: Rosetta;
private readonly rosetta: RosettaTabletReader;

// Flags that tracks if we have already wrote the first member of the class
private firstMemberWritten = false;
Expand All @@ -37,7 +37,7 @@ export class DotNetGenerator extends Generator {
public constructor(
private readonly assembliesCurrentlyBeingCompiled: string[],
options: {
readonly rosetta: Rosetta;
readonly rosetta: RosettaTabletReader;
readonly runtimeTypeChecking: boolean;
},
) {
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/lib/targets/go.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CodeMaker } from 'codemaker';
import * as fs from 'fs-extra';
import { Assembly } from 'jsii-reflect';
import { Rosetta } from 'jsii-rosetta';
import { RosettaTabletReader } from 'jsii-rosetta';
import * as path from 'path';

import { IGenerator, Legalese } from '../generator';
Expand Down Expand Up @@ -150,11 +150,11 @@ class GoGenerator implements IGenerator {
});
private readonly documenter: Documentation;

private readonly rosetta: Rosetta;
private readonly rosetta: RosettaTabletReader;
private readonly runtimeTypeChecking: boolean;

public constructor(options: {
readonly rosetta: Rosetta;
readonly rosetta: RosettaTabletReader;
readonly runtimeTypeChecking: boolean;
}) {
this.rosetta = options.rosetta;
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/targets/go/documentation.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Stability } from '@jsii/spec';
import { CodeMaker } from 'codemaker';
import { Docs } from 'jsii-reflect';
import { ApiLocation, Rosetta, TargetLanguage } from 'jsii-rosetta';
import { ApiLocation, RosettaTabletReader, TargetLanguage } from 'jsii-rosetta';

export class Documentation {
public constructor(
private readonly code: CodeMaker,
private readonly rosetta: Rosetta,
private readonly rosetta: RosettaTabletReader,
) {}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createHash } from 'crypto';
import * as fs from 'fs-extra';
import * as reflect from 'jsii-reflect';
import {
Rosetta,
RosettaTabletReader,
TargetLanguage,
enforcesStrictMode,
markDownToJavaDoc,
Expand Down Expand Up @@ -633,10 +633,10 @@ class JavaGenerator extends Generator {
[name: string]: spec.AssemblyConfiguration;
} = {};

private readonly rosetta: Rosetta;
private readonly rosetta: RosettaTabletReader;

public constructor(options: {
readonly rosetta: Rosetta;
readonly rosetta: RosettaTabletReader;
readonly runtimeTypeChecking: boolean;
}) {
super({ ...options, generateOverloadsForMethodWithOptionals: true });
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as fs from 'fs-extra';
import * as reflect from 'jsii-reflect';
import {
TargetLanguage,
Rosetta,
RosettaTabletReader,
enforcesStrictMode,
ApiLocation,
} from 'jsii-rosetta';
Expand Down Expand Up @@ -2406,7 +2406,7 @@ class PythonGenerator extends Generator {
private readonly types: Map<string, PythonType>;

public constructor(
private readonly rosetta: Rosetta,
private readonly rosetta: RosettaTabletReader,
options: GeneratorOptions,
) {
super(options);
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"escape-string-regexp": "^4.0.0",
"fs-extra": "^10.1.0",
"jsii-reflect": "^0.0.0",
"jsii-rosetta": "^0.0.0",
"jsii-rosetta": "^1.85.0 || ~5.0.14 || ~5.1.2 || ~5.2.0 || ~5.3.0 || ~5.4.0",
"semver": "^7.5.4",
"spdx-license-list": "^6.8.0",
"xmlbuilder": "^15.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/test/targets/go.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { promises as fs } from 'fs';
import { TypeSystem } from 'jsii-reflect';
import { Rosetta } from 'jsii-rosetta';
import { RosettaTabletReader } from 'jsii-rosetta';
import { tmpdir } from 'os';
import { join } from 'path';

Expand All @@ -18,7 +18,7 @@ test('does not generate imports for unused types', async () => {
require.resolve('./fixtures/dependent.jsii.json'),
);

const rosetta = new Rosetta();
const rosetta = new RosettaTabletReader();
const subject = new Golang({
arguments: {},
assembly,
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii-reflect/lib/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class ClassType extends ReferenceType {
return out;
}

public isClassType() {
public isClassType(): this is ClassType {
return true;
}

Expand Down

0 comments on commit 2cd182e

Please sign in to comment.