@runtime-type-inspector/plugin-rollup 1.0.7 → 1.1.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.
- package/index.mjs +9 -22
- package/package.json +3 -6
- package/types.d.ts +2 -6
package/index.mjs
CHANGED
|
@@ -3,30 +3,19 @@ import {
|
|
|
3
3
|
addTypeChecks, expandType, compareAST, code2ast2code
|
|
4
4
|
} from '@runtime-type-inspector/transpiler';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
*/
|
|
10
|
-
function getHeader(validateDivision) {
|
|
11
|
-
let header = "import { assertType, youCanAddABreakpointHere";
|
|
12
|
-
if (validateDivision) {
|
|
13
|
-
header += ", validateDivision";
|
|
14
|
-
}
|
|
15
|
-
header += ", registerTypedef, registerClass } from '@runtime-type-inspector/runtime';\n";
|
|
16
|
-
// Prevent tree-shaking in UMD build so we can always "add a breakpoint here".
|
|
17
|
-
header += "export * from '@runtime-type-inspector/runtime';\n";
|
|
18
|
-
return header;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @param {object} [options] - Optional options.
|
|
22
|
-
* @param {boolean} [options.enable] - Enable or disable entire plugin. Defaults to true.
|
|
23
|
-
* @param {boolean} [options.selftest] - Every once in a while Babel changes the AST, so we
|
|
6
|
+
* @typedef Options
|
|
7
|
+
* @property {boolean} [enable] - Enable or disable entire plugin. Defaults to true.
|
|
8
|
+
* @property {boolean} [selftest] - Every once in a while Babel changes the AST, so we
|
|
24
9
|
* self-test Stringifier class to ensure its functionanlity.
|
|
25
|
-
* @
|
|
10
|
+
* @property {string[]} [ignoredFiles] - Ignore certain files which operate in a different
|
|
26
11
|
* context, for example framework/parsers/draco-worker.js operates as WebWorker (without RTI).
|
|
12
|
+
* @property {boolean} [validateDivision] - Whether divisions are validated. Defaults to true.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @param {Options} [options] - Optional options.
|
|
27
16
|
* @returns {import('rollup').Plugin} The rollup plugin.
|
|
28
17
|
*/
|
|
29
|
-
function runtimeTypeInspector({enable = true, selftest = false, ignoredFiles} = {}) {
|
|
18
|
+
function runtimeTypeInspector({enable = true, selftest = false, ignoredFiles, validateDivision = true} = {}) {
|
|
30
19
|
const filter = createFilter([
|
|
31
20
|
'**/*.js'
|
|
32
21
|
], []);
|
|
@@ -46,8 +35,6 @@ function runtimeTypeInspector({enable = true, selftest = false, ignoredFiles} =
|
|
|
46
35
|
console.warn(`AST is NOT equal`);
|
|
47
36
|
}
|
|
48
37
|
}
|
|
49
|
-
const validateDivision = true;
|
|
50
|
-
code = getHeader(validateDivision) + code;
|
|
51
38
|
// todo expose options to rollup plugin
|
|
52
39
|
code = addTypeChecks(code, {
|
|
53
40
|
validateDivision,
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtime-type-inspector/plugin-rollup",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Rollup plugin for https://runtimetypeinspector.org/",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "types.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
-
},
|
|
11
8
|
"author": "Hermann Rolfes (kungfooman)",
|
|
12
9
|
"license": "MIT",
|
|
13
10
|
"dependencies": {
|
|
14
11
|
"@runtime-type-inspector/runtime": "^2.0.6",
|
|
15
|
-
"@runtime-type-inspector/transpiler": "^2.0
|
|
12
|
+
"@runtime-type-inspector/transpiler": "^2.1.0",
|
|
16
13
|
"rollup": "^3.29.4"
|
|
17
14
|
}
|
|
18
15
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
// The content of this types.d.ts file is authored manually.
|
|
2
|
-
type Options =
|
|
3
|
-
enable?: boolean;
|
|
4
|
-
selftest?: boolean;
|
|
5
|
-
ignoredFiles?: string[];
|
|
6
|
-
};
|
|
2
|
+
type Options = import('./index.mjs').Options;
|
|
7
3
|
declare function runtimeTypeInspector(options?: Options): import('rollup').Plugin;
|
|
8
|
-
export{runtimeTypeInspector};
|
|
4
|
+
export {runtimeTypeInspector};
|