runtime-type-inspector 2.0.1 → 2.0.3
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/README.md +8 -5
- package/build/rti-transpiler.cjs +2359 -0
- package/build/rti-transpiler.mjs +1979 -0
- package/package.json +4 -2
- package/.eslintrc.js +0 -480
- package/jsconfig.json +0 -10
- package/plugin-parcel/index.mjs +0 -4
- package/plugin-rollup/index.mjs +0 -78
- package/plugin-webpack/index.mjs +0 -4
- package/rollup.config.mjs +0 -183
- package/src-runtime/assertType.mjs +0 -54
- package/src-runtime/createDiv.mjs +0 -69
- package/src-runtime/index.mjs +0 -21
- package/src-runtime/makeJSDoc.mjs +0 -40
- package/src-runtime/registerClass.mjs +0 -11
- package/src-runtime/registerTypedef.mjs +0 -12
- package/src-runtime/typecheckDiv.mjs +0 -3
- package/src-runtime/typecheckEvery.mjs +0 -21
- package/src-runtime/typecheckOptions.mjs +0 -60
- package/src-runtime/typecheckTable.mjs +0 -14
- package/src-runtime/typecheckWarn.mjs +0 -23
- package/src-runtime/validateArray.mjs +0 -26
- package/src-runtime/validateDivision.mjs +0 -31
- package/src-runtime/validateMap.mjs +0 -36
- package/src-runtime/validateNumber.mjs +0 -29
- package/src-runtime/validateObject.mjs +0 -43
- package/src-runtime/validateRecord.mjs +0 -31
- package/src-runtime/validateSet.mjs +0 -26
- package/src-runtime/validateTuple.mjs +0 -28
- package/src-runtime/validateType.mjs +0 -214
- package/src-runtime/validateTypedef.mjs +0 -18
- package/src-runtime/validateUnion.mjs +0 -19
- package/src-runtime/youCanAddABreakpointHere.mjs +0 -11
- package/src-transpiler/Stringifier.mjs +0 -1268
- package/src-transpiler/StringifierWithTypeAssertions.mjs +0 -478
- package/src-transpiler/addTypeChecks.mjs +0 -20
- package/src-transpiler/ast2json.mjs +0 -13
- package/src-transpiler/ast2jsonForComparison.mjs +0 -28
- package/src-transpiler/code2ast2code.mjs +0 -16
- package/src-transpiler/expandType.mjs +0 -187
- package/src-transpiler/expandTypeDepFree.mjs +0 -122
- package/src-transpiler/extractNameAndOptionality.mjs +0 -23
- package/src-transpiler/index.mjs +0 -13
- package/src-transpiler/parseJSDoc.mjs +0 -69
- package/src-transpiler/parseJSDocSetter.mjs +0 -16
- package/src-transpiler/parseJSDocTypedef.mjs +0 -69
- package/src-transpiler/simplifyType.mjs +0 -31
- package/src-transpiler/stat.mjs +0 -13
- package/ui/babel-core.mjs +0 -5
- package/ui/babel-helper-plugin-utils.mjs +0 -7
- package/ui/babel-parser.mjs +0 -8
- package/ui/babel-plugin-syntax-typescript.mjs +0 -58
- package/ui/importmap.js +0 -38
- package/ui/index.html +0 -30
- package/ui/index.mjs +0 -379
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runtime-type-inspector",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Validating JSDoc types at runtime for high-quality types - Trust is good, control is better.",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "build/rti-transpiler.cjs",
|
|
6
|
+
"module": "build/rti-transpiler.mjs",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "rollup -c",
|
|
8
9
|
"build:atBabelCore": "rollup -c --environment target:atBabelCore",
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
"bugs": {
|
|
18
19
|
"url": "https://github.com/kungfooman/RuntimeTypeInspector.js/issues"
|
|
19
20
|
},
|
|
21
|
+
"type": "module",
|
|
20
22
|
"homepage": "https://github.com/kungfooman/RuntimeTypeInspector.js#readme",
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@babel/preset-env": "^7.22.20",
|
package/.eslintrc.js
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"ecmaVersion": 2022,
|
|
5
|
-
"sourceType": "module",
|
|
6
|
-
"ecmaFeatures": {}
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
// Rules reference: https://eslint.org/docs/rules/
|
|
10
|
-
"rules": {
|
|
11
|
-
// Possible Problems
|
|
12
|
-
"array-callback-return": "error",
|
|
13
|
-
"constructor-super": "error",
|
|
14
|
-
"for-direction": "error",
|
|
15
|
-
"getter-return": "error",
|
|
16
|
-
"no-async-promise-executor": "error",
|
|
17
|
-
"no-await-in-loop": "error",
|
|
18
|
-
"no-class-assign": "error",
|
|
19
|
-
"no-compare-neg-zero": "error",
|
|
20
|
-
"no-cond-assign": "error",
|
|
21
|
-
"no-const-assign": "error",
|
|
22
|
-
"no-constant-binary-expression": "error",
|
|
23
|
-
"no-constant-condition": [
|
|
24
|
-
"error", {
|
|
25
|
-
"checkLoops": false
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"no-constructor-return": "error",
|
|
29
|
-
"no-control-regex": "error",
|
|
30
|
-
"no-debugger": "error",
|
|
31
|
-
"no-dupe-args": "error",
|
|
32
|
-
"no-dupe-class-members": "error",
|
|
33
|
-
"no-dupe-else-if": "error",
|
|
34
|
-
"no-dupe-keys": "error",
|
|
35
|
-
"no-duplicate-case": "error",
|
|
36
|
-
"no-duplicate-imports": "error",
|
|
37
|
-
"no-empty-character-class": "error",
|
|
38
|
-
"no-empty-pattern": "error",
|
|
39
|
-
"no-ex-assign": "error",
|
|
40
|
-
"no-fallthrough": "error",
|
|
41
|
-
"no-func-assign": "error",
|
|
42
|
-
"no-import-assign": "error",
|
|
43
|
-
"no-inner-declarations": "error",
|
|
44
|
-
"no-invalid-regexp": "error",
|
|
45
|
-
"no-irregular-whitespace": "error",
|
|
46
|
-
"no-loss-of-precision": "error",
|
|
47
|
-
"no-misleading-character-class": "error",
|
|
48
|
-
"no-new-native-nonconstructor": "error",
|
|
49
|
-
"no-new-symbol": "error",
|
|
50
|
-
"no-obj-calls": "error",
|
|
51
|
-
"no-promise-executor-return": "error",
|
|
52
|
-
"no-prototype-builtins": "off",
|
|
53
|
-
"no-self-assign": "error",
|
|
54
|
-
"no-self-compare": "error",
|
|
55
|
-
"no-setter-return": "error",
|
|
56
|
-
"no-sparse-arrays": "error",
|
|
57
|
-
"no-template-curly-in-string": "error",
|
|
58
|
-
"no-this-before-super": "error",
|
|
59
|
-
"no-undef": "error",
|
|
60
|
-
"no-unexpected-multiline": "error",
|
|
61
|
-
"no-unmodified-loop-condition": "error",
|
|
62
|
-
"no-unreachable": "error",
|
|
63
|
-
"no-unreachable-loop": "error",
|
|
64
|
-
"no-unsafe-finally": "error",
|
|
65
|
-
"no-unsafe-negation": "error",
|
|
66
|
-
"no-unsafe-optional-chaining": "error",
|
|
67
|
-
"no-unused-private-class-members": "error",
|
|
68
|
-
"no-unused-vars": [
|
|
69
|
-
"error", {
|
|
70
|
-
"args": "none"
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
"no-use-before-define": [
|
|
74
|
-
"error", {
|
|
75
|
-
"functions": false
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
"no-useless-backreference": "error",
|
|
79
|
-
"require-atomic-updates": "error",
|
|
80
|
-
"use-isnan": "error",
|
|
81
|
-
"valid-typeof": "error",
|
|
82
|
-
|
|
83
|
-
// Suggestions
|
|
84
|
-
"accessor-pairs": "error",
|
|
85
|
-
"arrow-body-style": "off",
|
|
86
|
-
"block-scoped-var": "error",
|
|
87
|
-
"camelcase": "off",
|
|
88
|
-
"capitalized-comments": "off",
|
|
89
|
-
"class-methods-use-this": "off",
|
|
90
|
-
"complexity": "off",
|
|
91
|
-
"consistent-return": "off",
|
|
92
|
-
"consistent-this": "off",
|
|
93
|
-
"curly": "off",
|
|
94
|
-
"default-case": "off",
|
|
95
|
-
"default-case-last": "off",
|
|
96
|
-
"default-param-last": "off",
|
|
97
|
-
"dot-notation": "error",
|
|
98
|
-
"eqeqeq": ["error", "smart"],
|
|
99
|
-
"func-name-matching": "error",
|
|
100
|
-
"func-names": "off",
|
|
101
|
-
"func-style": "off",
|
|
102
|
-
"grouped-accessor-pairs": ["error", "setBeforeGet"],
|
|
103
|
-
"guard-for-in": "off",
|
|
104
|
-
"id-denylist": "off",
|
|
105
|
-
"id-length": "off",
|
|
106
|
-
"id-match": "off",
|
|
107
|
-
"init-declarations": "off",
|
|
108
|
-
"logical-assignment-operators": "off",
|
|
109
|
-
"max-classes-per-file": "off",
|
|
110
|
-
"max-depth": "off",
|
|
111
|
-
"max-lines": "off",
|
|
112
|
-
"max-lines-per-function": "off",
|
|
113
|
-
"max-nested-callbacks": "off",
|
|
114
|
-
"max-params": "off",
|
|
115
|
-
"max-statements": "off",
|
|
116
|
-
"multiline-comment-style": ["warn", "separate-lines"],
|
|
117
|
-
"new-cap": "off",
|
|
118
|
-
"no-alert": "error",
|
|
119
|
-
"no-array-constructor": "error",
|
|
120
|
-
"no-bitwise": "off",
|
|
121
|
-
"no-caller": "error",
|
|
122
|
-
"no-case-declarations": "error",
|
|
123
|
-
"no-confusing-arrow": "error",
|
|
124
|
-
"no-console": "off",
|
|
125
|
-
"no-continue": "off",
|
|
126
|
-
"no-delete-var": "error",
|
|
127
|
-
"no-div-regex": "error",
|
|
128
|
-
"no-else-return": "error",
|
|
129
|
-
"no-empty": [
|
|
130
|
-
"error", {
|
|
131
|
-
"allowEmptyCatch": true
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"no-empty-function": "off",
|
|
135
|
-
"no-empty-static-block": "error",
|
|
136
|
-
"no-eq-null": "off",
|
|
137
|
-
"no-eval": "error",
|
|
138
|
-
"no-extend-native": "error",
|
|
139
|
-
"no-extra-bind": "error",
|
|
140
|
-
"no-extra-boolean-cast": "off",
|
|
141
|
-
"no-extra-label": "error",
|
|
142
|
-
"no-extra-semi": "error",
|
|
143
|
-
"no-floating-decimal": "error",
|
|
144
|
-
"no-global-assign": "error",
|
|
145
|
-
"no-implicit-coercion": "off",
|
|
146
|
-
"no-implicit-globals": "error",
|
|
147
|
-
"no-implied-eval": "error",
|
|
148
|
-
"no-inline-comments": "off",
|
|
149
|
-
"no-invalid-this": "off",
|
|
150
|
-
"no-iterator": "error",
|
|
151
|
-
"no-label-var": "error",
|
|
152
|
-
"no-labels": "error",
|
|
153
|
-
"no-lone-blocks": "error",
|
|
154
|
-
"no-lonely-if": "off",
|
|
155
|
-
"no-loop-func": "error",
|
|
156
|
-
"no-magic-numbers": "off",
|
|
157
|
-
"no-mixed-operators": "off",
|
|
158
|
-
"no-multi-assign": "off",
|
|
159
|
-
"no-multi-str": "error",
|
|
160
|
-
"no-negated-condition": "off",
|
|
161
|
-
"no-nested-ternary": "off",
|
|
162
|
-
"no-new": "warn",
|
|
163
|
-
"no-new-func": "error",
|
|
164
|
-
"no-new-object": "error",
|
|
165
|
-
"no-new-wrappers": "error",
|
|
166
|
-
"no-nonoctal-decimal-escape": "error",
|
|
167
|
-
"no-octal": "error",
|
|
168
|
-
"no-octal-escape": "error",
|
|
169
|
-
"no-param-reassign": "off",
|
|
170
|
-
"no-plusplus": "off",
|
|
171
|
-
"no-proto": "error",
|
|
172
|
-
"no-redeclare": "error",
|
|
173
|
-
"no-regex-spaces": "error",
|
|
174
|
-
"no-restricted-exports": "error",
|
|
175
|
-
"no-restricted-globals": "off",
|
|
176
|
-
"no-restricted-imports": "error",
|
|
177
|
-
"no-restricted-properties": "off",
|
|
178
|
-
"no-restricted-syntax": "error",
|
|
179
|
-
"no-return-assign": "error",
|
|
180
|
-
"no-script-url": "error",
|
|
181
|
-
"no-sequences": "error",
|
|
182
|
-
"no-shadow": "off",
|
|
183
|
-
"no-shadow-restricted-names": "error",
|
|
184
|
-
"no-ternary": "off",
|
|
185
|
-
"no-throw-literal": "error",
|
|
186
|
-
"no-undef-init": "error",
|
|
187
|
-
"no-undefined": "off",
|
|
188
|
-
"no-underscore-dangle": "off",
|
|
189
|
-
"no-unneeded-ternary": "error",
|
|
190
|
-
"no-unused-expressions": "error",
|
|
191
|
-
"no-unused-labels": "error",
|
|
192
|
-
"no-useless-call": "error",
|
|
193
|
-
"no-useless-catch": "error",
|
|
194
|
-
"no-useless-computed-key": "error",
|
|
195
|
-
"no-useless-concat": "error",
|
|
196
|
-
"no-useless-constructor": "error",
|
|
197
|
-
"no-useless-escape": "off",
|
|
198
|
-
"no-useless-rename": "error",
|
|
199
|
-
"no-useless-return": "error",
|
|
200
|
-
"no-var": "off", // update to error
|
|
201
|
-
"no-void": "error",
|
|
202
|
-
"no-warning-comments": "off",
|
|
203
|
-
"no-with": "error",
|
|
204
|
-
"object-shorthand": "off",
|
|
205
|
-
"one-var": "off",
|
|
206
|
-
"one-var-declaration-per-line": "off",
|
|
207
|
-
"operator-assignment": ["error", "always"],
|
|
208
|
-
"prefer-arrow-callback": "off",
|
|
209
|
-
"prefer-const": "error",
|
|
210
|
-
"prefer-destructuring": "off",
|
|
211
|
-
"prefer-exponentiation-operator": "off",
|
|
212
|
-
"prefer-named-capture-group": "off",
|
|
213
|
-
"prefer-numeric-literals": "error",
|
|
214
|
-
"prefer-object-has-own": "off",
|
|
215
|
-
"prefer-object-spread": "off",
|
|
216
|
-
"prefer-promise-reject-errors": "error",
|
|
217
|
-
"prefer-regex-literals": "off",
|
|
218
|
-
"prefer-rest-params": "off",
|
|
219
|
-
"prefer-spread": "warn",
|
|
220
|
-
"prefer-template": "off",
|
|
221
|
-
"quote-props": "off",
|
|
222
|
-
"radix": "error",
|
|
223
|
-
"require-await": "error",
|
|
224
|
-
"require-unicode-regexp": "off",
|
|
225
|
-
"require-yield": "error",
|
|
226
|
-
"sort-imports": "off",
|
|
227
|
-
"sort-keys": "off",
|
|
228
|
-
"sort-vars": "off",
|
|
229
|
-
"spaced-comment": [
|
|
230
|
-
"error", "always", {
|
|
231
|
-
"exceptions": ["/"]
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
"strict": "error",
|
|
235
|
-
"symbol-description": "error",
|
|
236
|
-
"vars-on-top": "off",
|
|
237
|
-
"yoda": "error",
|
|
238
|
-
|
|
239
|
-
// Layout & Formatting
|
|
240
|
-
"array-bracket-newline": ["error", "consistent"],
|
|
241
|
-
"array-bracket-spacing": ["error", "never"],
|
|
242
|
-
"array-element-newline": "off",
|
|
243
|
-
"arrow-parens": [
|
|
244
|
-
"error", "as-needed", {
|
|
245
|
-
"requireForBlockBody": true
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
"arrow-spacing": "error",
|
|
249
|
-
"block-spacing": "error",
|
|
250
|
-
"brace-style": "error",
|
|
251
|
-
"comma-dangle": ["error", "never"],
|
|
252
|
-
"comma-spacing": [
|
|
253
|
-
"error", {
|
|
254
|
-
"before": false,
|
|
255
|
-
"after": true
|
|
256
|
-
}
|
|
257
|
-
],
|
|
258
|
-
"comma-style": ["error", "last"],
|
|
259
|
-
"computed-property-spacing": ["error", "never"],
|
|
260
|
-
"dot-location": ["error", "property"],
|
|
261
|
-
"eol-last": ["error", "always"],
|
|
262
|
-
"func-call-spacing": ["error", "never"],
|
|
263
|
-
"function-call-argument-newline": "off",
|
|
264
|
-
"function-paren-newline": "off",
|
|
265
|
-
"generator-star-spacing": "error",
|
|
266
|
-
"implicit-arrow-linebreak": "error",
|
|
267
|
-
"indent": [
|
|
268
|
-
"error", 2, {
|
|
269
|
-
"SwitchCase": 1,
|
|
270
|
-
"CallExpression": {
|
|
271
|
-
"arguments": "first"
|
|
272
|
-
},
|
|
273
|
-
"ignoreComments": true
|
|
274
|
-
}
|
|
275
|
-
],
|
|
276
|
-
"jsx-quotes": "off",
|
|
277
|
-
"key-spacing": [
|
|
278
|
-
"error", {
|
|
279
|
-
"beforeColon": false,
|
|
280
|
-
"afterColon": true
|
|
281
|
-
}
|
|
282
|
-
],
|
|
283
|
-
"keyword-spacing": [
|
|
284
|
-
"error", {
|
|
285
|
-
"before": true,
|
|
286
|
-
"after": true
|
|
287
|
-
}
|
|
288
|
-
],
|
|
289
|
-
"line-comment-position": "off",
|
|
290
|
-
"linebreak-style": "off",
|
|
291
|
-
"lines-around-comment": "off",
|
|
292
|
-
"lines-between-class-members": ["error", "always"],
|
|
293
|
-
"max-len": "off",
|
|
294
|
-
"max-statements-per-line": "off",
|
|
295
|
-
"multiline-ternary": "off",
|
|
296
|
-
"new-parens": "error",
|
|
297
|
-
"newline-per-chained-call": "off",
|
|
298
|
-
"no-extra-parens": ["error", "functions"],
|
|
299
|
-
"no-mixed-spaces-and-tabs": "error",
|
|
300
|
-
"no-multi-spaces": [
|
|
301
|
-
"error", {
|
|
302
|
-
"ignoreEOLComments": true,
|
|
303
|
-
"exceptions": {
|
|
304
|
-
"ArrayExpression": true,
|
|
305
|
-
"AssignmentExpression": true,
|
|
306
|
-
"BinaryExpression": true,
|
|
307
|
-
"IfStatement": true,
|
|
308
|
-
"LogicalExpression": true,
|
|
309
|
-
"SwitchCase": true,
|
|
310
|
-
"VariableDeclarator": true
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
],
|
|
314
|
-
"no-multiple-empty-lines": [
|
|
315
|
-
"error", {
|
|
316
|
-
"max": 2,
|
|
317
|
-
"maxBOF": 0,
|
|
318
|
-
"maxEOF": 0
|
|
319
|
-
}
|
|
320
|
-
],
|
|
321
|
-
"no-tabs": "error",
|
|
322
|
-
"no-trailing-spaces": "error",
|
|
323
|
-
"no-whitespace-before-property": "error",
|
|
324
|
-
"nonblock-statement-body-position": "off",
|
|
325
|
-
"object-curly-newline": [
|
|
326
|
-
"error", {
|
|
327
|
-
"consistent": true
|
|
328
|
-
}
|
|
329
|
-
],
|
|
330
|
-
"object-curly-spacing": ["error", "always"],
|
|
331
|
-
"object-property-newline": [
|
|
332
|
-
"error", {
|
|
333
|
-
"allowAllPropertiesOnSameLine": true
|
|
334
|
-
}
|
|
335
|
-
],
|
|
336
|
-
"operator-linebreak": ["error", "after"],
|
|
337
|
-
"padded-blocks": [
|
|
338
|
-
"error", {
|
|
339
|
-
"classes": "never"
|
|
340
|
-
}
|
|
341
|
-
],
|
|
342
|
-
"padding-line-between-statements": "off",
|
|
343
|
-
"quotes": ["off", "single"],
|
|
344
|
-
"rest-spread-spacing": "error",
|
|
345
|
-
"semi": ["error", "always"],
|
|
346
|
-
"semi-spacing": [
|
|
347
|
-
"error", {
|
|
348
|
-
"before": false,
|
|
349
|
-
"after": true
|
|
350
|
-
}
|
|
351
|
-
],
|
|
352
|
-
"semi-style": ["error", "last"],
|
|
353
|
-
"space-before-blocks": "error",
|
|
354
|
-
"space-before-function-paren": [
|
|
355
|
-
"error", {
|
|
356
|
-
"anonymous": "always",
|
|
357
|
-
"named": "never"
|
|
358
|
-
}
|
|
359
|
-
],
|
|
360
|
-
"space-in-parens": ["error", "never"],
|
|
361
|
-
"space-infix-ops": [
|
|
362
|
-
"error", {
|
|
363
|
-
"int32Hint": false
|
|
364
|
-
}
|
|
365
|
-
],
|
|
366
|
-
"space-unary-ops": [
|
|
367
|
-
"error", {
|
|
368
|
-
"words": true,
|
|
369
|
-
"nonwords": false,
|
|
370
|
-
"overrides": {
|
|
371
|
-
}
|
|
372
|
-
}],
|
|
373
|
-
"switch-colon-spacing": [
|
|
374
|
-
"error", {
|
|
375
|
-
"after": true,
|
|
376
|
-
"before": false
|
|
377
|
-
}
|
|
378
|
-
],
|
|
379
|
-
"template-curly-spacing": "error",
|
|
380
|
-
"template-tag-spacing": "error",
|
|
381
|
-
"unicode-bom": ["error", "never"],
|
|
382
|
-
"wrap-iife": "off",
|
|
383
|
-
"wrap-regex": "off",
|
|
384
|
-
"yield-star-spacing": "error",
|
|
385
|
-
|
|
386
|
-
// Import rules
|
|
387
|
-
|
|
388
|
-
// Static analysis
|
|
389
|
-
"import/default": "error",
|
|
390
|
-
"import/named": "error",
|
|
391
|
-
"import/namespace": "error",
|
|
392
|
-
"import/no-unresolved": "error",
|
|
393
|
-
|
|
394
|
-
// Helpful warnings
|
|
395
|
-
"import/export": "error",
|
|
396
|
-
"import/no-named-as-default": "warn",
|
|
397
|
-
"import/no-named-as-default-member": "warn",
|
|
398
|
-
|
|
399
|
-
// Style guide
|
|
400
|
-
"import/extensions": ["error", "always", { "ts": "never", "tsx": "never" }],
|
|
401
|
-
"import/no-duplicates": "warn",
|
|
402
|
-
|
|
403
|
-
// JSDoc rules
|
|
404
|
-
"jsdoc/check-access": "error",
|
|
405
|
-
"jsdoc/check-alignment": "error",
|
|
406
|
-
"jsdoc/check-examples": "off",
|
|
407
|
-
"jsdoc/check-indentation": "off",
|
|
408
|
-
"jsdoc/check-line-alignment": "error",
|
|
409
|
-
"jsdoc/check-param-names": "off",
|
|
410
|
-
"jsdoc/check-property-names": "error",
|
|
411
|
-
"jsdoc/check-syntax": "error",
|
|
412
|
-
"jsdoc/check-tag-names": "error",
|
|
413
|
-
"jsdoc/check-types": "off",
|
|
414
|
-
"jsdoc/check-values": "error",
|
|
415
|
-
"jsdoc/empty-tags": "error",
|
|
416
|
-
"jsdoc/implements-on-classes": "error",
|
|
417
|
-
"jsdoc/informative-docs": "off",
|
|
418
|
-
"jsdoc/match-description": "off",
|
|
419
|
-
"jsdoc/match-name": "off",
|
|
420
|
-
"jsdoc/multiline-blocks": "error",
|
|
421
|
-
"jsdoc/no-bad-blocks": "error",
|
|
422
|
-
"jsdoc/no-blank-block-descriptions": "error",
|
|
423
|
-
"jsdoc/no-blank-blocks": "error",
|
|
424
|
-
"jsdoc/no-defaults": "error",
|
|
425
|
-
"jsdoc/no-missing-syntax": "off",
|
|
426
|
-
"jsdoc/no-multi-asterisks": "error",
|
|
427
|
-
"jsdoc/no-restricted-syntax": "off",
|
|
428
|
-
"jsdoc/no-types": "off",
|
|
429
|
-
"jsdoc/no-undefined-types": "off",
|
|
430
|
-
"jsdoc/require-asterisk-prefix": "error",
|
|
431
|
-
"jsdoc/require-description": "off",
|
|
432
|
-
"jsdoc/require-description-complete-sentence": [
|
|
433
|
-
"off", {
|
|
434
|
-
"abbreviations": ["e.g."]
|
|
435
|
-
}
|
|
436
|
-
],
|
|
437
|
-
"jsdoc/require-example": "off",
|
|
438
|
-
"jsdoc/require-file-overview": "off",
|
|
439
|
-
"jsdoc/require-hyphen-before-param-description": ["error", "always"],
|
|
440
|
-
"jsdoc/require-jsdoc": "off",
|
|
441
|
-
"jsdoc/require-param": "error",
|
|
442
|
-
"jsdoc/require-param-description": "error",
|
|
443
|
-
"jsdoc/require-param-name": "error",
|
|
444
|
-
"jsdoc/require-param-type": "error",
|
|
445
|
-
"jsdoc/require-property": "error",
|
|
446
|
-
"jsdoc/require-property-description": "error",
|
|
447
|
-
"jsdoc/require-property-name": "error",
|
|
448
|
-
"jsdoc/require-property-type": "error",
|
|
449
|
-
"jsdoc/require-returns": "error",
|
|
450
|
-
"jsdoc/require-returns-check": "error",
|
|
451
|
-
"jsdoc/require-returns-description": "error",
|
|
452
|
-
"jsdoc/require-returns-type": "error",
|
|
453
|
-
"jsdoc/require-throws": "off",
|
|
454
|
-
"jsdoc/require-yields": "error",
|
|
455
|
-
"jsdoc/require-yields-check": "error",
|
|
456
|
-
"jsdoc/sort-tags": "off",
|
|
457
|
-
"jsdoc/tag-lines": "off",
|
|
458
|
-
"jsdoc/text-escaping": "off",
|
|
459
|
-
"jsdoc/valid-types": "off"
|
|
460
|
-
},
|
|
461
|
-
|
|
462
|
-
"plugins": [
|
|
463
|
-
"import",
|
|
464
|
-
"jsdoc"
|
|
465
|
-
],
|
|
466
|
-
|
|
467
|
-
"settings": {
|
|
468
|
-
"jsdoc": {
|
|
469
|
-
"mode": "typescript"
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
"env": {
|
|
474
|
-
"browser": true,
|
|
475
|
-
"es2022": true,
|
|
476
|
-
"node": true,
|
|
477
|
-
"worker": true
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
};
|
package/jsconfig.json
DELETED
package/plugin-parcel/index.mjs
DELETED
package/plugin-rollup/index.mjs
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {createFilter } from '@rollup/pluginutils';
|
|
2
|
-
import {parse } from '@babel/parser';
|
|
3
|
-
import {addTypeChecks } from '../src-transpiler/addTypeChecks.mjs';
|
|
4
|
-
import {expandType } from '../src-transpiler/expandType.mjs';
|
|
5
|
-
import {ast2jsonForComparison} from '../src-transpiler/ast2jsonForComparison.mjs';
|
|
6
|
-
import {code2ast2code } from '../src-transpiler/code2ast2code.mjs';
|
|
7
|
-
/**
|
|
8
|
-
* Alternatively "import * as rti from ..." would also prevent "Unused external imports" warning...
|
|
9
|
-
* or keeping log of every single call during RTI parsing.
|
|
10
|
-
* @param {boolean} validateDivision
|
|
11
|
-
*/
|
|
12
|
-
function getHeader(validateDivision) {
|
|
13
|
-
let header = "import { assertType, youCanAddABreakpointHere";
|
|
14
|
-
if (validateDivision) {
|
|
15
|
-
header += ", validateDivision";
|
|
16
|
-
}
|
|
17
|
-
header += ", registerTypedef, registerClass } from 'runtime-type-inspector/src-runtime/index.mjs';\n";
|
|
18
|
-
// Prevent tree-shaking in UMD build so we can always "add a breakpoint here".
|
|
19
|
-
header += "export * from 'runtime-type-inspector/src-runtime/index.mjs';\n";
|
|
20
|
-
return header;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @param {string} left
|
|
24
|
-
* @param {string} right
|
|
25
|
-
*/
|
|
26
|
-
function compareAST(left, right) {
|
|
27
|
-
const l = parse(left , {sourceType: 'module'});
|
|
28
|
-
const r = parse(right, {sourceType: 'module'});
|
|
29
|
-
const ljson = ast2jsonForComparison(l);
|
|
30
|
-
const rjson = ast2jsonForComparison(r);
|
|
31
|
-
const test = ljson == rjson;
|
|
32
|
-
if (!test) {
|
|
33
|
-
console.warn(`AST is NOT equal`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @param {object} [options] - Optional options.
|
|
38
|
-
* @param {boolean} [options.enable] - Enable or disable entire plugin. Defaults to true.
|
|
39
|
-
* @param {boolean} [options.selftest] - Every once in a while Babel changes the AST, so we
|
|
40
|
-
* self-test Stringifier class to ensure its functionanlity.
|
|
41
|
-
* @param {string[]} [options.ignoredFiles] - Ignore certain files which operate in a different
|
|
42
|
-
* context, for example framework/parsers/draco-worker.js operates as WebWorker (without RTI).
|
|
43
|
-
* @returns {import('rollup').Plugin}
|
|
44
|
-
*/
|
|
45
|
-
function runtimeTypeInspector({enable = true, selftest = false, ignoredFiles} = {}) {
|
|
46
|
-
const filter = createFilter([
|
|
47
|
-
'**/*.js'
|
|
48
|
-
], []);
|
|
49
|
-
return {
|
|
50
|
-
name: 'runtime-type-inspector',
|
|
51
|
-
transform(code, id) {
|
|
52
|
-
if (!enable || !filter(id)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// Ignore files which are supposed to run in e.g. a Worker context without RTI
|
|
56
|
-
if (ignoredFiles?.some(_ => id.includes(_))) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (selftest) {
|
|
60
|
-
compareAST(code, code2ast2code(code));
|
|
61
|
-
}
|
|
62
|
-
const validateDivision = true;
|
|
63
|
-
code = getHeader(validateDivision) + code;
|
|
64
|
-
// todo expose options to rollup plugin
|
|
65
|
-
code = addTypeChecks(code, {
|
|
66
|
-
validateDivision,
|
|
67
|
-
// ignoreLocations: ['Tensor#constructor'], // todo
|
|
68
|
-
expandType,
|
|
69
|
-
filename: id,
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
code,
|
|
73
|
-
map: null
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export {runtimeTypeInspector};
|
package/plugin-webpack/index.mjs
DELETED