@runtime-type-inspector/plugin-rollup 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/index.mjs +5 -17
  2. package/package.json +2 -2
package/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import {createFilter} from '@rollup/pluginutils';
2
- import {parse } from '@babel/parser';
3
2
  import {
4
- addTypeChecks, expandType,ast2jsonForComparison, code2ast2code
3
+ addTypeChecks, expandType, compareAST, code2ast2code
5
4
  } from '@runtime-type-inspector/transpiler';
6
5
  /**
7
6
  * Alternatively "import * as rti from ..." would also prevent "Unused external imports" warning...
@@ -18,20 +17,6 @@ function getHeader(validateDivision) {
18
17
  header += "export * from '@runtime-type-inspector/runtime';\n";
19
18
  return header;
20
19
  }
21
- /**
22
- * @param {string} left
23
- * @param {string} right
24
- */
25
- function compareAST(left, right) {
26
- const l = parse(left , {sourceType: 'module'});
27
- const r = parse(right, {sourceType: 'module'});
28
- const ljson = ast2jsonForComparison(l);
29
- const rjson = ast2jsonForComparison(r);
30
- const test = ljson == rjson;
31
- if (!test) {
32
- console.warn(`AST is NOT equal`);
33
- }
34
- }
35
20
  /**
36
21
  * @param {object} [options] - Optional options.
37
22
  * @param {boolean} [options.enable] - Enable or disable entire plugin. Defaults to true.
@@ -56,7 +41,10 @@ function runtimeTypeInspector({enable = true, selftest = false, ignoredFiles} =
56
41
  return;
57
42
  }
58
43
  if (selftest) {
59
- compareAST(code, code2ast2code(code));
44
+ const test = compareAST(code, code2ast2code(code));
45
+ if (!test) {
46
+ console.warn(`AST is NOT equal`);
47
+ }
60
48
  }
61
49
  const validateDivision = true;
62
50
  code = getHeader(validateDivision) + code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtime-type-inspector/plugin-rollup",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "module": "index.mjs",
6
6
  "type": "module",
@@ -11,7 +11,7 @@
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
13
  "@runtime-type-inspector/runtime": "^2.0.5",
14
- "@runtime-type-inspector/transpiler": "^2.0.4",
14
+ "@runtime-type-inspector/transpiler": "^2.0.11",
15
15
  "rollup": "^3.29.4"
16
16
  }
17
17
  }