@tslite/normalize 0.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/dist/index.cjs +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/package.json +58 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var l=["start","end","loc","range","raw","method"],u={FunctionDeclaration:r=>r==="expression",FunctionExpression:r=>r==="expression",ArrowFunctionExpression:r=>r==="id",TemplateElement:r=>false};function f(r){function i(e,t=new WeakMap){if(e===null)return null;if(typeof e!="object")throw Error("Invalid AST");if(t.has(e))throw new Error("Detected a circular AST reference");if(t.set(e,true),Array.isArray(e)){let o=e.map(n=>i(n,t));return t.delete(e),o}let c={};for(let[o,n]of Object.entries(e)){if(l.includes(o)){o==="raw"&&e.cooked!==void 0&&(c[o]=n);continue}if(!u[e.type]?.(o,n)){if(typeof n!="object"||n instanceof RegExp||n===null){c[o]=n;continue}c[o]=i(n,t);}}return t.delete(e),c}return i(r)}exports.normalize=f;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=["start","end","loc","range","raw","method"],u={FunctionDeclaration:r=>r==="expression",FunctionExpression:r=>r==="expression",ArrowFunctionExpression:r=>r==="id",TemplateElement:r=>false};function f(r){function i(e,t=new WeakMap){if(e===null)return null;if(typeof e!="object")throw Error("Invalid AST");if(t.has(e))throw new Error("Detected a circular AST reference");if(t.set(e,true),Array.isArray(e)){let o=e.map(n=>i(n,t));return t.delete(e),o}let c={};for(let[o,n]of Object.entries(e)){if(l.includes(o)){o==="raw"&&e.cooked!==void 0&&(c[o]=n);continue}if(!u[e.type]?.(o,n)){if(typeof n!="object"||n instanceof RegExp||n===null){c[o]=n;continue}c[o]=i(n,t);}}return t.delete(e),c}return i(r)}export{f as normalize};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tslite/normalize",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TSLite normalize — canonicalizes ESTree from any parser into TSLite's AST (parser interop)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/andersondrosa/tslite.git",
|
|
26
|
+
"directory": "packages/normalize"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ast",
|
|
30
|
+
"estree",
|
|
31
|
+
"normalize",
|
|
32
|
+
"parser-agnostic",
|
|
33
|
+
"meriyah",
|
|
34
|
+
"acorn",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"author": "Anderson D. Rosa <andersondrosa@outlook.com>",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@tslite/core": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsup",
|
|
47
|
+
"dev": "tsup --watch",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"test:coverage": "vitest run --coverage",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"lint": "eslint src",
|
|
53
|
+
"lint:fix": "eslint src --fix",
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
56
|
+
"format:check": "prettier --check \"src/**/*.ts\""
|
|
57
|
+
}
|
|
58
|
+
}
|