Sha256: 6f0bad39e4e04a73226bd921417c31268cba76359be4fcbce1810ea9f428fc47

Contents?: true

Size: 1.79 KB

Versions: 12

Compression:

Stored size: 1.79 KB

Contents

{"version":3,"names":["GLOBAL_TYPES","exports","WeakMap","isGlobalType","scope","name","hasBinding","get","has","console","warn","registerGlobalType","programScope","add"],"sources":["../src/global-types.ts"],"sourcesContent":["import type { NodePath, Scope } from \"@babel/core\";\n\nexport const GLOBAL_TYPES = new WeakMap<Scope, Set<string>>();\n\nexport function isGlobalType({ scope }: NodePath, name: string) {\n  if (scope.hasBinding(name)) return false;\n  if (GLOBAL_TYPES.get(scope).has(name)) return true;\n\n  console.warn(\n    `The exported identifier \"${name}\" is not declared in Babel's scope tracker\\n` +\n      `as a JavaScript value binding, and \"@babel/plugin-transform-typescript\"\\n` +\n      `never encountered it as a TypeScript type declaration.\\n` +\n      `It will be treated as a JavaScript value.\\n\\n` +\n      `This problem is likely caused by another plugin injecting\\n` +\n      `\"${name}\" without registering it in the scope tracker. If you are the author\\n` +\n      ` of that plugin, please use \"scope.registerDeclaration(declarationPath)\".`,\n  );\n\n  return false;\n}\n\nexport function registerGlobalType(programScope: Scope, name: string) {\n  GLOBAL_TYPES.get(programScope).add(name);\n}\n"],"mappings":";;;;;;;;AAEO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAIE,OAAO,CAAqB,CAAC;AAEtD,SAASC,YAAYA,CAAC;EAAEC;AAAgB,CAAC,EAAEC,IAAY,EAAE;EAC9D,IAAID,KAAK,CAACE,UAAU,CAACD,IAAI,CAAC,EAAE,OAAO,KAAK;EACxC,IAAIL,YAAY,CAACO,GAAG,CAACH,KAAK,CAAC,CAACI,GAAG,CAACH,IAAI,CAAC,EAAE,OAAO,IAAI;EAElDI,OAAO,CAACC,IAAI,CACT,4BAA2BL,IAAK,8CAA6C,GAC3E,2EAA0E,GAC1E,0DAAyD,GACzD,+CAA8C,GAC9C,6DAA4D,GAC5D,IAAGA,IAAK,wEAAuE,GAC/E,2EACL,CAAC;EAED,OAAO,KAAK;AACd;AAEO,SAASM,kBAAkBA,CAACC,YAAmB,EAAEP,IAAY,EAAE;EACpEL,YAAY,CAACO,GAAG,CAACK,YAAY,CAAC,CAACC,GAAG,CAACR,IAAI,CAAC;AAC1C","ignoreList":[]}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.50 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.49 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.47 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.44 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.43 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.42 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.41 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map
immosquare-cleaner-0.1.40 node_modules/@babel/plugin-transform-typescript/lib/global-types.js.map