Sha256: d579df1470470923f9830e38673bd47566ca84d90f43675fd4bea95dcce2ea38

Contents?: true

Size: 1.57 KB

Versions: 25

Compression:

Stored size: 1.57 KB

Contents

{"version":3,"names":["_helperEnvironmentVisitor","require","_core","numericLiteral","unaryExpression","t","rewriteThisVisitor","traverse","visitors","merge","environmentVisitor","ThisExpression","path","replaceWith","rewriteThis","programPath","node","Object","assign","noScope"],"sources":["../src/rewrite-this.ts"],"sourcesContent":["import environmentVisitor from \"@babel/helper-environment-visitor\";\nimport { traverse, types as t } from \"@babel/core\";\nconst { numericLiteral, unaryExpression } = t;\n\nimport type { NodePath, Visitor } from \"@babel/core\";\n\n/**\n * A visitor to walk the tree, rewriting all `this` references in the top-level scope to be\n * `void 0` (undefined).\n */\nconst rewriteThisVisitor: Visitor = traverse.visitors.merge([\n  environmentVisitor,\n  {\n    ThisExpression(path) {\n      path.replaceWith(unaryExpression(\"void\", numericLiteral(0), true));\n    },\n  },\n]);\n\nexport default function rewriteThis(programPath: NodePath) {\n  // Rewrite \"this\" to be \"undefined\".\n  traverse(programPath.node, { ...rewriteThisVisitor, noScope: true });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,MAAM;EAAEE,cAAc;EAAEC;AAAgB,CAAC,GAAGC,WAAC;AAQ7C,MAAMC,kBAA2B,GAAGC,cAAQ,CAACC,QAAQ,CAACC,KAAK,CAAC,CAC1DC,iCAAkB,EAClB;EACEC,cAAcA,CAACC,IAAI,EAAE;IACnBA,IAAI,CAACC,WAAW,CAACT,eAAe,CAAC,MAAM,EAAED,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;EACpE;AACF,CAAC,CACF,CAAC;AAEa,SAASW,WAAWA,CAACC,WAAqB,EAAE;EAEzD,IAAAR,cAAQ,EAACQ,WAAW,CAACC,IAAI,EAAAC,MAAA,CAAAC,MAAA,KAAOZ,kBAAkB;IAAEa,OAAO,EAAE;EAAI,EAAE,CAAC;AACtE","ignoreList":[]}

Version data entries

25 entries across 13 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-amd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-commonjs/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-modules-umd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.51 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-modules-umd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.50 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-modules-commonjs/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-modules-amd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-modules-amd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-modules-umd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.49 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-modules-commonjs/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.48 node_modules/jscodeshift/node_modules/@babel/core/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-amd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-commonjs/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-modules-umd/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.47 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map
immosquare-cleaner-0.1.44 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map