@runtime-type-inspector/transpiler 5.0.3 → 5.0.4

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.
Files changed (3) hide show
  1. package/index.cjs +15 -2
  2. package/index.mjs +15 -2
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -4938,6 +4938,10 @@
4938
4938
  * @property {string} [filename] - The name of a file to which the instance pertains.
4939
4939
  * @property {boolean} [addHeader] - Whether to add import declarations headers. Defaults to true.
4940
4940
  * @property {string[]} [ignoreLocations] - Ignore these locations because they are known false-positives.
4941
+ * @property {string} [projectVersion] - Host project version funneled into
4942
+ * the emitted header via `setProjectVersion(...)`, so `Download log` meta
4943
+ * identifies the app build. Bundler plugins resolve it from their own
4944
+ * option or the host package.json.
4941
4945
  */
4942
4946
  var Asserter = /*#__PURE__*/function (_Stringifier) {
4943
4947
  _inherits(Asserter, _Stringifier);
@@ -4960,7 +4964,8 @@
4960
4964
  _ref$addHeader = _ref.addHeader,
4961
4965
  addHeader = _ref$addHeader === void 0 ? true : _ref$addHeader,
4962
4966
  _ref$ignoreLocations = _ref.ignoreLocations,
4963
- ignoreLocations = _ref$ignoreLocations === void 0 ? [] : _ref$ignoreLocations;
4967
+ ignoreLocations = _ref$ignoreLocations === void 0 ? [] : _ref$ignoreLocations,
4968
+ projectVersion = _ref.projectVersion;
4964
4969
  _classCallCheck(this, Asserter);
4965
4970
  _this = _super.call(this);
4966
4971
  /** @type {Record<string, Stat>} */
@@ -5025,6 +5030,7 @@
5025
5030
  _this.filename = filename;
5026
5031
  _this.addHeader = addHeader;
5027
5032
  _this.ignoreLocations = ignoreLocations;
5033
+ _this.projectVersion = projectVersion;
5028
5034
  return _this;
5029
5035
  }
5030
5036
  _createClass(Asserter, [{
@@ -5133,9 +5139,16 @@
5133
5139
  if (this.validateDivision) {
5134
5140
  header += ", validateDivision";
5135
5141
  }
5136
- header += ", registerTypedef, registerClass, registerImportNamespaceSpecifier} from '@runtime-type-inspector/runtime';\n";
5142
+ header += ", registerTypedef, registerClass, registerImportNamespaceSpecifier";
5143
+ if (this.projectVersion !== undefined && this.projectVersion !== null) {
5144
+ header += ", setProjectVersion";
5145
+ }
5146
+ header += "} from '@runtime-type-inspector/runtime';\n";
5137
5147
  // Prevent tree-shaking in UMD build so we can always "add a breakpoint here".
5138
5148
  header += "export * from '@runtime-type-inspector/runtime';\n";
5149
+ if (this.projectVersion !== undefined && this.projectVersion !== null) {
5150
+ header += "setProjectVersion(".concat(JSON.stringify(this.projectVersion), ");\n");
5151
+ }
5139
5152
  return header;
5140
5153
  }
5141
5154
  /**
package/index.mjs CHANGED
@@ -4515,6 +4515,10 @@ class Stringifier {
4515
4515
  * @property {string} [filename] - The name of a file to which the instance pertains.
4516
4516
  * @property {boolean} [addHeader] - Whether to add import declarations headers. Defaults to true.
4517
4517
  * @property {string[]} [ignoreLocations] - Ignore these locations because they are known false-positives.
4518
+ * @property {string} [projectVersion] - Host project version funneled into
4519
+ * the emitted header via `setProjectVersion(...)`, so `Download log` meta
4520
+ * identifies the app build. Bundler plugins resolve it from their own
4521
+ * option or the host package.json.
4518
4522
  */
4519
4523
  class Asserter extends Stringifier {
4520
4524
  /**
@@ -4527,7 +4531,8 @@ class Asserter extends Stringifier {
4527
4531
  expandType = expandTypeDepFree,
4528
4532
  filename,
4529
4533
  addHeader = true,
4530
- ignoreLocations = []
4534
+ ignoreLocations = [],
4535
+ projectVersion
4531
4536
  } = {}) {
4532
4537
  super();
4533
4538
  /** @type {Record<string, Stat>} */
@@ -4592,6 +4597,7 @@ class Asserter extends Stringifier {
4592
4597
  this.filename = filename;
4593
4598
  this.addHeader = addHeader;
4594
4599
  this.ignoreLocations = ignoreLocations;
4600
+ this.projectVersion = projectVersion;
4595
4601
  }
4596
4602
  /**
4597
4603
  * We expand type-asserted ArrowFunctionExpressions in order to add type assertions.
@@ -4694,9 +4700,16 @@ class Asserter extends Stringifier {
4694
4700
  if (this.validateDivision) {
4695
4701
  header += ", validateDivision";
4696
4702
  }
4697
- header += ", registerTypedef, registerClass, registerImportNamespaceSpecifier} from '@runtime-type-inspector/runtime';\n";
4703
+ header += ", registerTypedef, registerClass, registerImportNamespaceSpecifier";
4704
+ if (this.projectVersion !== undefined && this.projectVersion !== null) {
4705
+ header += ", setProjectVersion";
4706
+ }
4707
+ header += "} from '@runtime-type-inspector/runtime';\n";
4698
4708
  // Prevent tree-shaking in UMD build so we can always "add a breakpoint here".
4699
4709
  header += "export * from '@runtime-type-inspector/runtime';\n";
4710
+ if (this.projectVersion !== undefined && this.projectVersion !== null) {
4711
+ header += `setProjectVersion(${JSON.stringify(this.projectVersion)});\n`;
4712
+ }
4700
4713
  return header;
4701
4714
  }
4702
4715
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "ts2js": "ts2js.js"
5
5
  },
6
6
  "name": "@runtime-type-inspector/transpiler",
7
- "version": "5.0.3",
7
+ "version": "5.0.4",
8
8
  "description": "Validating JSDoc types at runtime for high-quality types - Trust is good, control is better.",
9
9
  "main": "index.cjs",
10
10
  "module": "index.mjs",
@@ -22,7 +22,7 @@
22
22
  "homepage": "https://github.com/kungfooman/RuntimeTypeInspector.js#readme",
23
23
  "dependencies": {
24
24
  "@babel/parser": "^7.23.0",
25
- "@runtime-type-inspector/runtime": "^5.0.3",
25
+ "@runtime-type-inspector/runtime": "^5.0.4",
26
26
  "typescript": "^5.1.6"
27
27
  },
28
28
  "files": [