babel-plugin-explicit-exports-references
Version:
Transforms all internal references to a module's exports such that each reference starts with `module.exports` instead of directly referencing an internal name. This enables easy mocking of specific (exported) functions in Jest with Babel/TypeScript, even
103 lines (102 loc) • 3.86 kB
JSON
{
"name": "babel-plugin-explicit-exports-references",
"version": "1.0.2",
"description": "Transforms all internal references to a module's exports such that each reference starts with `module.exports` instead of directly referencing an internal name. This enables easy mocking of specific (exported) functions in Jest with Babel/TypeScript, even when the mocked functions call each other in the same module.",
"keywords": [
"babel",
"rewire",
"jest",
"function",
"mock",
"spy",
"exported",
"single",
"same",
"module",
"functions",
"import",
"require",
"specific",
"test",
"typescript"
],
"repository": {
"type": "git",
"url": "https://github.com/Xunnamius/babel-plugin-explicit-exports-references"
},
"license": "MIT",
"author": "Xunnamius",
"sideEffects": false,
"type": "commonjs",
"exports": {
".": "./dist/index.js",
"./package": "./package.json",
"./package.json": "./package.json"
},
"main": "./dist/index",
"types": "./dist/index.d.ts",
"files": [
"/dist",
"/LICENSE",
"/package.json",
"/README.md"
],
"scripts": {
"build": "npm run clean && tsc --project tsconfig.types.json && NODE_ENV=production webpack --config-name main",
"build-stats": "NODE_ENV=production webpack --config-name main --json > bundle-stats.json",
"check-types": "rm -f npm.pipe; touch npm.pipe; command -v unbuffer >/dev/null; X=$?; [ $X -eq 0 ] && unbuffer tsc --project tsconfig.check-types.json >> npm.pipe; Y=$?; [ $Y -eq 0 ] && echo >> npm.pipe; unbuffer eslint --parser-options=project:tsconfig.check-types.json src >> npm.pipe; Z=$?; [ $X -ne 0 ] && tsc --project tsconfig.check-types.json >> npm.pipe && eslint --parser-options=project:tsconfig.check-types.json src >> npm.pipe; W=$?; cat npm.pipe | less -R -FX; rm npm.pipe; [ $W -eq 0 ] && [ $X -eq 1 ] || [ $X -eq 0 ] && [ $Y -eq 0 ] && [ $Z -eq 0 ]",
"clean": "rm -rf dist npm.pipe coverage external-scripts/bin",
"fixup": "npm run check-types && npm run test && npx npm-force-resolutions && npx Xunnamius/sort-package-json && npm audit",
"list-tasks": "npm run",
"prepublishOnly": "npm run build",
"postpublish": "npm run clean",
"repl": "command -v rlwrap >/dev/null && rlwrap npx -p @babel/core -p @babel/node babel-node",
"test": "BABEL_ENV=test jest --coverage"
},
"dependencies": {
"@babel/core": "^7.13.15",
"@babel/template": "^7.12.13",
"@babel/types": "^7.13.14",
"debug": "^4.3.1"
},
"devDependencies": {
"@babel/cli": "^7.13.14",
"@babel/eslint-parser": "^7.13.14",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-proposal-function-bind": "^7.12.13",
"@babel/plugin-syntax-module-string-names": "^7.12.13",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@types/babel-types": "^7.0.9",
"@types/babel__core": "^7.1.14",
"@types/debug": "^4.1.5",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.39",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.2",
"babel-plugin-source-map-support": "^2.1.3",
"babel-plugin-tester": "^10.0.0",
"eslint": "^7.24.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.5",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-extended": "^0.11.5",
"prettier": "^2.2.1",
"source-map-support": "^0.5.19",
"typescript": "^4.2.4",
"webpack": "^5.33.2",
"webpack-cli": "^4.6.0",
"webpack-node-externals": "^2.5.2"
},
"engines": {
"node": ">= 12.x"
},
"publishConfig": {
"access": "public"
}
}