jsii-pacmak 1.96.0 → 1.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import '@jsii/check-node/run';
3
- import '../lib/suppress-jsii-upgrade-prompts';
4
3
  //# sourceMappingURL=jsii-pacmak.d.ts.map
@@ -2,7 +2,6 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  require("@jsii/check-node/run");
5
- require("../lib/suppress-jsii-upgrade-prompts");
6
5
  const jsii_rosetta_1 = require("jsii-rosetta");
7
6
  const yargs = require("yargs");
8
7
  const lib_1 = require("../lib");
package/lib/builder.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Rosetta } from 'jsii-rosetta';
1
+ import { RosettaTabletReader } from 'jsii-rosetta';
2
2
  import { JsiiModule } from './packaging';
3
3
  import { TargetConstructor } from './target';
4
4
  import { TargetName } from './targets';
@@ -35,7 +35,7 @@ export interface BuildOptions {
35
35
  /**
36
36
  * The Rosetta instance to load examples from
37
37
  */
38
- readonly rosetta: Rosetta;
38
+ readonly rosetta: RosettaTabletReader;
39
39
  /**
40
40
  * Whether to generate runtime type checking code in places where compile-time
41
41
  * type checking is not possible.
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import './suppress-jsii-upgrade-prompts';
2
1
  import { UnknownSnippetMode } from 'jsii-rosetta';
3
2
  import { TargetName } from './targets';
4
3
  import { Timers } from './timer';
package/lib/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pacmak = exports.configureLogging = exports.TargetName = void 0;
4
- require("./suppress-jsii-upgrade-prompts");
5
4
  const jsii_reflect_1 = require("jsii-reflect");
6
5
  const jsii_rosetta_1 = require("jsii-rosetta");
7
6
  const path_1 = require("path");
@@ -18,7 +17,7 @@ Object.defineProperty(exports, "configureLogging", { enumerable: true, get: func
18
17
  * Generates code in the desired targets.
19
18
  */
20
19
  async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint = true, force = false, forceSubdirectory = true, forceTarget = false, inputDirectories, outputDirectory, parallel = true, recurse = false, rosettaTablet, rosettaUnknownSnippets = undefined, runtimeTypeChecking = true, targets = Object.values(targets_1.TargetName), timers = new timer_1.Timers(), updateNpmIgnoreFiles = false, validateAssemblies = false, }) {
21
- const rosetta = new jsii_rosetta_1.Rosetta({
20
+ const rosetta = new jsii_rosetta_1.RosettaTabletReader({
22
21
  unknownSnippets: rosettaUnknownSnippets,
23
22
  prefixDisclaimer: true,
24
23
  });
package/lib/target.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as spec from '@jsii/spec';
2
2
  import * as reflect from 'jsii-reflect';
3
- import { Rosetta } from 'jsii-rosetta';
3
+ import { RosettaTabletReader } from 'jsii-rosetta';
4
4
  import { IGenerator } from './generator';
5
5
  export declare abstract class Target {
6
6
  protected readonly packageDir: string;
@@ -11,7 +11,7 @@ export declare abstract class Target {
11
11
  };
12
12
  protected readonly targetName: string;
13
13
  protected readonly assembly: reflect.Assembly;
14
- protected readonly rosetta: Rosetta;
14
+ protected readonly rosetta: RosettaTabletReader;
15
15
  protected readonly runtimeTypeChecking: boolean;
16
16
  protected abstract readonly generator: IGenerator;
17
17
  constructor(options: TargetOptions);
@@ -125,7 +125,7 @@ export interface TargetOptions {
125
125
  /** The JSII-reflect assembly for this JSII assembly */
126
126
  assembly: reflect.Assembly;
127
127
  /** The Rosetta instance */
128
- rosetta: Rosetta;
128
+ rosetta: RosettaTabletReader;
129
129
  /** Whether to generate runtime type-checking code */
130
130
  runtimeTypeChecking: boolean;
131
131
  /**
@@ -1,6 +1,6 @@
1
1
  import * as spec from '@jsii/spec';
2
2
  import { CodeMaker } from 'codemaker';
3
- import { Rosetta, ApiLocation } from 'jsii-rosetta';
3
+ import { RosettaTabletReader, ApiLocation } from 'jsii-rosetta';
4
4
  /**
5
5
  * Generates the Jsii attributes and calls for the .NET runtime
6
6
  *
@@ -11,7 +11,7 @@ export declare class DotNetDocGenerator {
11
11
  private readonly assembly;
12
12
  private readonly code;
13
13
  private readonly nameutils;
14
- constructor(code: CodeMaker, rosetta: Rosetta, assembly: spec.Assembly);
14
+ constructor(code: CodeMaker, rosetta: RosettaTabletReader, assembly: spec.Assembly);
15
15
  /**
16
16
  * Emits all documentation depending on what is available in the jsii model
17
17
  *
@@ -25,7 +25,7 @@ export declare class DotNetDocGenerator {
25
25
  emitDocs(obj: spec.Documentable, apiLocation: ApiLocation): void;
26
26
  emitMarkdownAsRemarks(markdown: string | undefined, apiLocation: ApiLocation): void;
27
27
  /**
28
- * Returns the lines that should go into the <remarks> section
28
+ * Returns the lines that should go into the <remarks> section {@link http://www.google.com|Google}
29
29
  */
30
30
  private renderRemarks;
31
31
  private convertExample;
@@ -80,7 +80,7 @@ class DotNetDocGenerator {
80
80
  this.code.line('/// </remarks>');
81
81
  }
82
82
  /**
83
- * Returns the lines that should go into the <remarks> section
83
+ * Returns the lines that should go into the <remarks> section {@link http://www.google.com|Google}
84
84
  */
85
85
  renderRemarks(docs, apiLocation) {
86
86
  const ret = [];
@@ -1,6 +1,6 @@
1
1
  import * as spec from '@jsii/spec';
2
2
  import * as reflect from 'jsii-reflect';
3
- import { Rosetta } from 'jsii-rosetta';
3
+ import { RosettaTabletReader } from 'jsii-rosetta';
4
4
  import { Generator, Legalese } from '../../generator';
5
5
  /**
6
6
  * CODE GENERATOR V2
@@ -14,7 +14,7 @@ export declare class DotNetGenerator extends Generator {
14
14
  private dotnetRuntimeGenerator;
15
15
  private dotnetDocGenerator;
16
16
  constructor(assembliesCurrentlyBeingCompiled: string[], options: {
17
- readonly rosetta: Rosetta;
17
+ readonly rosetta: RosettaTabletReader;
18
18
  readonly runtimeTypeChecking: boolean;
19
19
  });
20
20
  load(packageRoot: string, assembly: reflect.Assembly): Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import { CodeMaker } from 'codemaker';
2
2
  import { Docs } from 'jsii-reflect';
3
- import { ApiLocation, Rosetta } from 'jsii-rosetta';
3
+ import { ApiLocation, RosettaTabletReader } from 'jsii-rosetta';
4
4
  export declare class Documentation {
5
5
  private readonly code;
6
6
  private readonly rosetta;
7
- constructor(code: CodeMaker, rosetta: Rosetta);
7
+ constructor(code: CodeMaker, rosetta: RosettaTabletReader);
8
8
  /**
9
9
  * Emits all documentation depending on what is available in the jsii model
10
10
  *
@@ -1,5 +1,5 @@
1
1
  import { Assembly } from 'jsii-reflect';
2
- import { Rosetta } from 'jsii-rosetta';
2
+ import { RosettaTabletReader } from 'jsii-rosetta';
3
3
  import { IGenerator, Legalese } from '../generator';
4
4
  import { Target, TargetOptions } from '../target';
5
5
  import { RootPackage } from './go/package';
@@ -31,7 +31,7 @@ declare class GoGenerator implements IGenerator {
31
31
  private readonly rosetta;
32
32
  private readonly runtimeTypeChecking;
33
33
  constructor(options: {
34
- readonly rosetta: Rosetta;
34
+ readonly rosetta: RosettaTabletReader;
35
35
  readonly runtimeTypeChecking: boolean;
36
36
  });
37
37
  load(_: string, assembly: Assembly): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import * as spec from '@jsii/spec';
2
- import { Rosetta } from 'jsii-rosetta';
2
+ import { RosettaTabletReader } from 'jsii-rosetta';
3
3
  import { TargetBuilder, BuildOptions } from '../builder';
4
4
  import { Generator } from '../generator';
5
5
  import { JsiiModule } from '../packaging';
@@ -70,7 +70,7 @@ declare class JavaGenerator extends Generator {
70
70
  private readonly referencedModules;
71
71
  private readonly rosetta;
72
72
  constructor(options: {
73
- readonly rosetta: Rosetta;
73
+ readonly rosetta: RosettaTabletReader;
74
74
  readonly runtimeTypeChecking: boolean;
75
75
  });
76
76
  protected onBeginAssembly(assm: spec.Assembly, fingerprint: boolean): void;
@@ -1,6 +1,6 @@
1
1
  import * as spec from '@jsii/spec';
2
2
  import { CodeMaker } from 'codemaker';
3
- import { Rosetta, ApiLocation } from 'jsii-rosetta';
3
+ import { RosettaTabletReader, ApiLocation } from 'jsii-rosetta';
4
4
  import { Generator, GeneratorOptions } from '../generator';
5
5
  import { Target, TargetOptions } from '../target';
6
6
  import { NamingContext, PythonImports } from './python/type-name';
@@ -61,7 +61,7 @@ declare class PythonGenerator extends Generator {
61
61
  private package;
62
62
  private rootModule?;
63
63
  private readonly types;
64
- constructor(rosetta: Rosetta, options: GeneratorOptions);
64
+ constructor(rosetta: RosettaTabletReader, options: GeneratorOptions);
65
65
  emitDocString(code: CodeMaker, apiLocation: ApiLocation, docs: spec.Docs | undefined, options?: {
66
66
  arguments?: DocumentableArgument[];
67
67
  documentableItem?: string;
@@ -81,30 +81,54 @@ function toReleaseVersion(assemblyVersion, target) {
81
81
  }
82
82
  switch (target) {
83
83
  case _1.TargetName.PYTHON:
84
+ const baseVersion = `${version.major}.${version.minor}.${version.patch}`;
84
85
  // Python supports a limited set of identifiers... And we have a mapping table...
85
86
  // https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning
86
- const [label, sequence, ...rest] = version.prerelease;
87
- if (rest.filter((elt) => elt !== 0).length > 0 || sequence == null) {
88
- throw new Error(`Unable to map prerelease identifier (in: ${assemblyVersion}) components to python: ${(0, util_1.inspect)(version.prerelease)}. The format should be 'X.Y.Z-label.sequence', where sequence is a positive integer, and label is "dev", "pre", "alpha", beta", or "rc"`);
89
- }
90
- if (!Number.isInteger(sequence)) {
91
- throw new Error(`Unable to map prerelease identifier (in: ${assemblyVersion}) to python, as sequence ${(0, util_1.inspect)(sequence)} is not an integer`);
92
- }
93
- const baseVersion = `${version.major}.${version.minor}.${version.patch}`;
94
- // See PEP 440: https://www.python.org/dev/peps/pep-0440/#pre-releases
95
- switch (label) {
96
- case 'dev':
97
- case 'pre':
98
- return `${baseVersion}.dev${sequence}`;
99
- case 'alpha':
100
- return `${baseVersion}.a${sequence}`;
101
- case 'beta':
102
- return `${baseVersion}.b${sequence}`;
103
- case 'rc':
104
- return `${baseVersion}.rc${sequence}`;
105
- default:
106
- throw new Error(`Unable to map prerelease identifier (in: ${assemblyVersion}) to python, as label ${(0, util_1.inspect)(label)} is not mapped (only "dev", "pre", "alpha", "beta" and "rc" are)`);
87
+ const releaseLabels = {
88
+ alpha: 'a',
89
+ beta: 'b',
90
+ rc: 'rc',
91
+ post: 'post',
92
+ dev: 'dev',
93
+ pre: 'pre',
94
+ };
95
+ const validationErrors = [];
96
+ // Ensure that prerelease composed entirely of [label, sequence] pairs
97
+ version.prerelease.forEach((elem, idx, arr) => {
98
+ const next = arr[idx + 1];
99
+ if (typeof elem === 'string') {
100
+ if (!Object.keys(releaseLabels).includes(elem)) {
101
+ validationErrors.push(`Label ${elem} is not one of ${Object.keys(releaseLabels).join(',')}`);
102
+ }
103
+ if (next === undefined || !Number.isInteger(next)) {
104
+ validationErrors.push(`Label ${elem} must be followed by a positive integer`);
105
+ }
106
+ }
107
+ });
108
+ if (validationErrors.length > 0) {
109
+ throw new Error(`Unable to map prerelease identifier (in: ${assemblyVersion}) components to python: ${(0, util_1.inspect)(version.prerelease)}. The format should be 'X.Y.Z-[label.sequence][.post.sequence][.(dev|pre).sequence]', where sequence is a positive integer and label is one of ${(0, util_1.inspect)(Object.keys(releaseLabels))}. Validation errors encountered: ${validationErrors.join(', ')}`);
107
110
  }
111
+ // PEP440 supports multiple labels in a given version, so
112
+ // we should attempt to identify and map as many labels as
113
+ // possible from the given prerelease input
114
+ // e.g. 1.2.3-rc.123.dev.456.post.789 => 1.2.3.rc123.dev456.post789
115
+ const postIdx = version.prerelease.findIndex((v) => v.toString() === 'post');
116
+ const devIdx = version.prerelease.findIndex((v) => ['dev', 'pre'].includes(v.toString()));
117
+ const preReleaseIdx = version.prerelease.findIndex((v) => ['alpha', 'beta', 'rc'].includes(v.toString()));
118
+ const prereleaseVersion = [
119
+ preReleaseIdx > -1
120
+ ? `${releaseLabels[version.prerelease[preReleaseIdx]]}${version.prerelease[preReleaseIdx + 1] ?? 0}`
121
+ : undefined,
122
+ postIdx > -1
123
+ ? `post${version.prerelease[postIdx + 1] ?? 0}`
124
+ : undefined,
125
+ devIdx > -1 ? `dev${version.prerelease[devIdx + 1] ?? 0}` : undefined,
126
+ ]
127
+ .filter((v) => v)
128
+ .join('.');
129
+ return version.build.length > 0
130
+ ? `${baseVersion}.${prereleaseVersion}+${version.build.join('.')}`
131
+ : `${baseVersion}.${prereleaseVersion}`;
108
132
  case _1.TargetName.DOTNET:
109
133
  case _1.TargetName.GO:
110
134
  case _1.TargetName.JAVA:
package/lib/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
2
2
  export declare const VERSION: string;
3
3
  /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION_DESC = "1.96.0 (build 921e240)";
4
+ export declare const VERSION_DESC = "1.98.0 (build 00b106d)";
5
5
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- // Generated at 2024-03-22T17:45:29Z by generate.sh
2
+ // Generated at 2024-04-30T19:18:56Z by generate.sh
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.VERSION_DESC = exports.VERSION = void 0;
5
5
  /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
6
6
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
7
- exports.VERSION = '1.96.0';
7
+ exports.VERSION = '1.98.0';
8
8
  /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION_DESC = '1.96.0 (build 921e240)';
9
+ exports.VERSION_DESC = '1.98.0 (build 00b106d)';
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-pacmak",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "description": "A code generation framework for jsii backend languages",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,36 +37,39 @@
37
37
  "package": "package-js"
38
38
  },
39
39
  "dependencies": {
40
- "@jsii/check-node": "1.96.0",
41
- "@jsii/spec": "^1.96.0",
40
+ "@jsii/check-node": "1.98.0",
41
+ "@jsii/spec": "^1.98.0",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.96.0",
43
+ "codemaker": "^1.98.0",
44
44
  "commonmark": "^0.30.0",
45
45
  "escape-string-regexp": "^4.0.0",
46
46
  "fs-extra": "^10.1.0",
47
- "jsii-reflect": "^1.96.0",
48
- "jsii-rosetta": "^1.96.0",
47
+ "jsii-reflect": "^1.98.0",
49
48
  "semver": "^7.5.4",
50
49
  "spdx-license-list": "^6.8.0",
51
50
  "xmlbuilder": "^15.1.1",
52
51
  "yargs": "^16.2.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@jsii/dotnet-runtime": "^1.96.0",
56
- "@jsii/java-runtime": "^1.96.0",
57
- "@jsii/go-runtime": "^1.96.0",
58
- "@scope/jsii-calc-lib": "^1.96.0",
54
+ "@jsii/dotnet-runtime": "^1.98.0",
55
+ "@jsii/java-runtime": "^1.98.0",
56
+ "@jsii/go-runtime": "^1.98.0",
57
+ "@scope/jsii-calc-lib": "^1.98.0",
59
58
  "@types/clone": "^2.1.4",
60
59
  "@types/diff": "^5.0.8",
61
60
  "@types/commonmark": "^0.27.9",
62
61
  "@types/fs-extra": "^9.0.13",
63
62
  "@types/semver": "^7.5.5",
64
63
  "diff": "^5.1.0",
65
- "jsii": "^1.96.0",
66
- "jsii-build-tools": "^1.96.0",
64
+ "jsii": "^1.98.0",
65
+ "jsii-build-tools": "^1.98.0",
67
66
  "jsii-calc": "^3.20.120",
67
+ "jsii-rosetta": "^1.98.0",
68
68
  "pyright": "^1.1.332"
69
69
  },
70
+ "peerDependencies": {
71
+ "jsii-rosetta": "^1.98.0 || ~5.2.0 || ~5.3.0 || ~5.4.0"
72
+ },
70
73
  "keywords": [
71
74
  "jsii",
72
75
  "aws"
@@ -1 +0,0 @@
1
- //# sourceMappingURL=suppress-jsii-upgrade-prompts.d.ts.map
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // Suppress the upgrade prompt from jsii and jsii-rosetta
3
- process.env.JSII_SUPPRESS_UPGRADE_PROMPT = '1';
4
- //# sourceMappingURL=suppress-jsii-upgrade-prompts.js.map