jsii 5.4.34-dev.0 → 5.4.34-dev.2

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.
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import * as log4js from 'log4js';
2
2
  import * as ts from 'typescript';
3
+ /**
4
+ * Name of the logger for cli errors
5
+ */
6
+ export declare const CLI_LOGGER = "jsii/cli";
3
7
  /**
4
8
  * Name of the logger for diagnostics information
5
9
  */
@@ -61,4 +65,19 @@ export declare function stripAnsi(x: string): string;
61
65
  export type Mutable<T> = {
62
66
  -readonly [K in keyof T]: Mutable<T[K]>;
63
67
  };
68
+ /**
69
+ * Throws an error that is intended as CLI output.
70
+ */
71
+ export declare class JsiiError extends Error {
72
+ readonly message: string;
73
+ readonly showHelp: boolean;
74
+ /**
75
+ * An expected error that can be nicely formatted where needed (e.g. in CLI output)
76
+ * This should only be used for errors that a user can fix themselves.
77
+ *
78
+ * @param message The error message to be printed to the user.
79
+ * @param showHelp Print the help before the error.
80
+ */
81
+ constructor(message: string, showHelp?: boolean);
82
+ }
64
83
  //# sourceMappingURL=utils.d.ts.map
package/lib/utils.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripAnsi = exports.parseRepository = exports.parsePerson = exports.logDiagnostic = exports._formatDiagnostic = exports.formatDiagnostic = exports.diagnosticsLogger = exports.JSII_DIAGNOSTICS_CODE = exports.DIAGNOSTICS = void 0;
3
+ exports.JsiiError = exports.stripAnsi = exports.parseRepository = exports.parsePerson = exports.logDiagnostic = exports._formatDiagnostic = exports.formatDiagnostic = exports.diagnosticsLogger = exports.JSII_DIAGNOSTICS_CODE = exports.DIAGNOSTICS = exports.CLI_LOGGER = void 0;
4
4
  const log4js = require("log4js");
5
5
  const ts = require("typescript");
6
6
  const jsii_diagnostic_1 = require("./jsii-diagnostic");
7
+ /**
8
+ * Name of the logger for cli errors
9
+ */
10
+ exports.CLI_LOGGER = 'jsii/cli';
7
11
  /**
8
12
  * Name of the logger for diagnostics information
9
13
  */
@@ -108,7 +112,7 @@ const PERSON_REGEX = /^\s*(.+?)(?:\s*<([^>]+)>)?(?:\s*\(([^)]+)\))?\s*$/;
108
112
  function parsePerson(value) {
109
113
  const match = PERSON_REGEX.exec(value);
110
114
  if (!match) {
111
- throw new Error(`Invalid stringified "person" value: ${value}`);
115
+ throw new JsiiError(`Invalid stringified "person" value: ${value}`);
112
116
  }
113
117
  const [, name, email, url] = match;
114
118
  const result = {
@@ -140,7 +144,7 @@ function parseRepository(value) {
140
144
  case 'gitlab':
141
145
  return { url: `https://gitlab.com/${slug}.git` };
142
146
  default:
143
- throw new Error(`Unknown host service: ${host}`);
147
+ throw new JsiiError(`Unknown repository hosting service: ${host}`);
144
148
  }
145
149
  }
146
150
  exports.parseRepository = parseRepository;
@@ -151,4 +155,23 @@ function stripAnsi(x) {
151
155
  return x.replace(ANSI_REGEX, '');
152
156
  }
153
157
  exports.stripAnsi = stripAnsi;
158
+ /**
159
+ * Throws an error that is intended as CLI output.
160
+ */
161
+ class JsiiError extends Error {
162
+ /**
163
+ * An expected error that can be nicely formatted where needed (e.g. in CLI output)
164
+ * This should only be used for errors that a user can fix themselves.
165
+ *
166
+ * @param message The error message to be printed to the user.
167
+ * @param showHelp Print the help before the error.
168
+ */
169
+ constructor(message, showHelp = false) {
170
+ super(message);
171
+ this.message = message;
172
+ this.showHelp = showHelp;
173
+ Object.setPrototypeOf(this, JsiiError.prototype);
174
+ }
175
+ }
176
+ exports.JsiiError = JsiiError;
154
177
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAmD;AAEnD;;GAEG;AACU,QAAA,WAAW,GAAG,aAAa,CAAC;AACzC;;GAEG;A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AAE,CAAC;QACnD;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAlBD,0CAkBC;AAED,MAAM,UAAU;AACd,4CAA4C;AAC5C,6EAA6E,CAAC;AAEhF,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC","sourcesContent":["import * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n return message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new Error(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new Error(`Unknown host service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,iCAAiC;AAEjC,uDAAmD;AAEnD;;GAEG;AACU,QAAA,UAAU,GAAG,UAAU,CAAC;AACrC;;GAEG;AACU,QAAA,WAAW,GAAG,aAAa,CAAC;AACzC;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,UAAyB;IAEzB,QAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAA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,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC;AAOD;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAClC;;;;;;OAMG;IACH,YAAqC,OAAe,EAAkB,WAAW,KAAK;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAQ;QAAkB,aAAQ,GAAR,QAAQ,CAAQ;QAEpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACF;AAZD,8BAYC","sourcesContent":["import * as log4js from 'log4js';\nimport * as ts from 'typescript';\n\nimport { JsiiDiagnostic } from './jsii-diagnostic';\n\n/**\n * Name of the logger for cli errors\n */\nexport const CLI_LOGGER = 'jsii/cli';\n/**\n * Name of the logger for diagnostics information\n */\nexport const DIAGNOSTICS = 'diagnostics';\n/**\n * Diagnostic code for JSII-generated messages.\n */\nexport const JSII_DIAGNOSTICS_CODE = 9999;\n\n/**\n * Obtains the relevant logger to be used for a given diagnostic message.\n *\n * @param logger the ``log4js.Logger`` to use for emitting the message.\n * @param diagnostic the message for which a logger is requested.\n *\n * @returns a logger method of the ``logger`` for the appropriate level.\n */\nexport function diagnosticsLogger(\n logger: log4js.Logger,\n diagnostic: ts.Diagnostic,\n): ((message: any, ...args: any[]) => void) | undefined {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Error:\n if (!logger.isErrorEnabled()) {\n return undefined;\n }\n return logger.error.bind(logger);\n case ts.DiagnosticCategory.Warning:\n if (!logger.isWarnEnabled()) {\n return undefined;\n }\n return logger.warn.bind(logger);\n case ts.DiagnosticCategory.Message:\n if (!logger.isDebugEnabled()) {\n return undefined;\n }\n return logger.debug.bind(logger);\n case ts.DiagnosticCategory.Suggestion:\n default:\n if (!logger.isTraceEnabled()) {\n return undefined;\n }\n return logger.trace.bind(logger);\n }\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n if (JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n // Ensure we leverage pre-rendered diagnostics where available.\n return diagnostic.format(projectRoot);\n }\n return _formatDiagnostic(diagnostic, projectRoot);\n}\n\n/**\n * Formats a diagnostic message with color and context, if possible. Users\n * should use `formatDiagnostic` instead, as this implementation is intended for\n * internal usafe only.\n *\n * @param diagnostic the diagnostic message ot be formatted.\n * @param projectRoot the root of the TypeScript project.\n *\n * @returns a formatted string.\n */\nexport function _formatDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const formatDiagnosticsHost: ts.FormatDiagnosticsHost = {\n getCurrentDirectory: () => projectRoot,\n getCanonicalFileName: (fileName) => fileName,\n getNewLine: () => ts.sys.newLine,\n };\n\n const message =\n diagnostic.file != null\n ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost)\n : ts.formatDiagnostic(diagnostic, formatDiagnosticsHost);\n\n if (!JsiiDiagnostic.isJsiiDiagnostic(diagnostic)) {\n return message;\n }\n\n // This is our own diagnostics, so we'll format appropriately (replacing TS#### with JSII####).\n return message.replace(` TS${JSII_DIAGNOSTICS_CODE}: `, ` JSII${diagnostic.jsiiCode}: `);\n}\n\nexport function logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) {\n const logFunc = diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic);\n if (!logFunc) {\n return;\n }\n logFunc(formatDiagnostic(diagnostic, projectRoot).trim());\n}\n\nconst PERSON_REGEX = /^\\s*(.+?)(?:\\s*<([^>]+)>)?(?:\\s*\\(([^)]+)\\))?\\s*$/;\n/**\n * Parses a string-formatted person entry from `package.json`.\n * @param value the string-formatted person entry.\n *\n * @example\n * parsePerson(\"Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)\");\n * // => { name: \"Barney Rubble\", email: \"b@rubble.com\", url: \"http://barnyrubble.tumblr.com/\" }\n */\nexport function parsePerson(value: string) {\n const match = PERSON_REGEX.exec(value);\n if (!match) {\n throw new JsiiError(`Invalid stringified \"person\" value: ${value}`);\n }\n const [, name, email, url] = match;\n const result: { name: string; email?: string; url?: string } = {\n name: name.trim(),\n };\n if (email) {\n result.email = email.trim();\n }\n if (url) {\n result.url = url.trim();\n }\n return result;\n}\n\nconst REPOSITORY_REGEX = /^(?:(github|gist|bitbucket|gitlab):)?([A-Za-z\\d_-]+\\/[A-Za-z\\d_-]+)$/;\nexport function parseRepository(value: string): { url: string } {\n const match = REPOSITORY_REGEX.exec(value);\n if (!match) {\n return { url: value };\n }\n const [, host, slug] = match;\n switch (host ?? 'github') {\n case 'github':\n return { url: `https://github.com/${slug}.git` };\n case 'gist':\n return { url: `https://gist.github.com/${slug}.git` };\n case 'bitbucket':\n return { url: `https://bitbucket.org/${slug}.git` };\n case 'gitlab':\n return { url: `https://gitlab.com/${slug}.git` };\n default:\n throw new JsiiError(`Unknown repository hosting service: ${host}`);\n }\n}\n\nconst ANSI_REGEX =\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n\nexport function stripAnsi(x: string): string {\n return x.replace(ANSI_REGEX, '');\n}\n\n/**\n * Maps the provided type to stip all `readonly` modifiers from its properties.\n */\nexport type Mutable<T> = { -readonly [K in keyof T]: Mutable<T[K]> };\n\n/**\n * Throws an error that is intended as CLI output.\n */\nexport class JsiiError extends Error {\n /**\n * An expected error that can be nicely formatted where needed (e.g. in CLI output)\n * This should only be used for errors that a user can fix themselves.\n *\n * @param message The error message to be printed to the user.\n * @param showHelp Print the help before the error.\n */\n constructor(public override readonly message: string, public readonly showHelp = false) {\n super(message);\n Object.setPrototypeOf(this, JsiiError.prototype);\n }\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
2
- export declare const SHORT_VERSION = "5.4.34-dev.0";
2
+ export declare const SHORT_VERSION = "5.4.34-dev.2";
3
3
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION = "5.4.34-dev.0 (build aa3b066)";
4
+ export declare const VERSION = "5.4.34-dev.2 (build 48fa62e)";
5
5
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
6
6
  export declare const RELEASE_LINE = "5.4";
7
7
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -4,9 +4,9 @@ exports.RELEASE_LINE = exports.VERSION = exports.SHORT_VERSION = void 0;
4
4
  const typescript_1 = require("typescript");
5
5
  // GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!
6
6
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
7
- exports.SHORT_VERSION = '5.4.34-dev.0';
7
+ exports.SHORT_VERSION = '5.4.34-dev.2';
8
8
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION = '5.4.34-dev.0 (build aa3b066)';
9
+ exports.VERSION = '5.4.34-dev.2 (build 48fa62e)';
10
10
  /** The release line identifier for this JSII compiler (e.g: `X.Y`) */
11
11
  exports.RELEASE_LINE = typescript_1.versionMajorMinor;
12
12
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.4.34-dev.0';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.4.34-dev.0 (build aa3b066)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,uFAAuF;AAEvF,qEAAqE;AACxD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yFAAyF;AAC5E,QAAA,OAAO,GAAG,8BAA8B,CAAC;AAEtD,sEAAsE;AACzD,QAAA,YAAY,GAAG,8BAAiB,CAAC","sourcesContent":["import { versionMajorMinor } from 'typescript';\n\n// GENERATED: This file is generated by build-tools/code-gen.ts -- Do not edit by hand!\n\n/** The short version number for this JSII compiler (e.g: `X.Y.Z`) */\nexport const SHORT_VERSION = '5.4.34-dev.2';\n\n/** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */\nexport const VERSION = '5.4.34-dev.2 (build 48fa62e)';\n\n/** The release line identifier for this JSII compiler (e.g: `X.Y`) */\nexport const RELEASE_LINE = versionMajorMinor;\n"]}
package/package.json CHANGED
@@ -64,7 +64,7 @@
64
64
  "npm": "^9.9.3",
65
65
  "npm-check-updates": "^16",
66
66
  "prettier": "^2.8.8",
67
- "projen": "^0.85.0",
67
+ "projen": "^0.85.2",
68
68
  "tar": "^6.2.1",
69
69
  "ts-jest": "^29.2.4",
70
70
  "ts-node": "^10.9.2"
@@ -93,7 +93,7 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "version": "5.4.34-dev.0",
96
+ "version": "5.4.34-dev.2",
97
97
  "types": "lib/index.d.ts",
98
98
  "exports": {
99
99
  ".": "./lib/index.js",