@babel/plugin-syntax-typescript
Advanced tools
+1
-1
| import { declare } from '@babel/helper-plugin-utils'; | ||
| var index = declare((api, opts) => { | ||
| api.assertVersion("8.0.0-beta.3"); | ||
| api.assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-beta.4"); | ||
| const { | ||
@@ -6,0 +6,0 @@ disallowAmbiguousJSXLike, |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var removePlugin = function (plugins: any[], name: string) {\n const indices: number[] = [];\n plugins.forEach((plugin, i) => {\n const n = Array.isArray(plugin) ? plugin[0] : plugin;\n\n if (n === name) {\n indices.unshift(i);\n }\n });\n\n for (const i of indices) {\n plugins.splice(i, 1);\n }\n };\n}\n\nexport interface Options {\n disallowAmbiguousJSXLike?: boolean;\n dts?: boolean;\n isTSX?: boolean;\n}\n\nexport default declare((api, opts: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const { disallowAmbiguousJSXLike, dts } = opts;\n\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { isTSX } = opts;\n }\n\n return {\n name: \"syntax-typescript\",\n\n manipulateOptions(opts, parserOpts) {\n if (!process.env.BABEL_8_BREAKING) {\n const { plugins } = parserOpts;\n // If the Flow syntax plugin already ran, remove it since Typescript\n // takes priority.\n removePlugin(plugins, \"flow\");\n\n // If the JSX syntax plugin already ran, remove it because JSX handling\n // in TS depends on the extensions, and is purely dependent on 'isTSX'.\n removePlugin(plugins, \"jsx\");\n\n if (!process.env.BABEL_8_BREAKING) {\n // These are now enabled by default in @babel/parser, but we push\n // them for compat with older versions.\n // @ts-ignore(Babel 7 vs Babel 8) These plugins have been removed\n plugins.push(\"objectRestSpread\", \"classProperties\");\n }\n\n if (isTSX) {\n plugins.push(\"jsx\");\n }\n }\n\n parserOpts.plugins.push([\n \"typescript\",\n { disallowAmbiguousJSXLike, dts },\n ]);\n },\n };\n});\n"],"names":["declare","api","opts","assertVersion","disallowAmbiguousJSXLike","dts","name","manipulateOptions","parserOpts","plugins","push"],"mappings":";;AA0BA,YAAeA,OAAO,CAAC,CAACC,GAAG,EAAEC,IAAa,KAAK;EAC7CD,GAAG,CAACE,aAAa,CAAA,cAAoB,CAAC,CAAA;EAEtC,MAAM;IAAEC,wBAAwB;AAAEC,IAAAA,GAAAA;AAAI,GAAC,GAAGH,IAAI,CAAA;EAO9C,OAAO;AACLI,IAAAA,IAAI,EAAE,mBAAmB;AAEzBC,IAAAA,iBAAiBA,CAACL,IAAI,EAAEM,UAAU,EAAE;AAuBlCA,MAAAA,UAAU,CAACC,OAAO,CAACC,IAAI,CAAC,CACtB,YAAY,EACZ;QAAEN,wBAAwB;AAAEC,QAAAA,GAAAA;AAAI,OAAC,CAClC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;AACH,CAAC,CAAC;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\n\nexport interface Options {\n disallowAmbiguousJSXLike?: boolean;\n dts?: boolean;\n isTSX?: boolean;\n}\n\nexport default declare((api, opts: Options) => {\n api.assertVersion(REQUIRED_VERSION(\"^7.0.0-0 || ^8.0.0\"));\n\n const { disallowAmbiguousJSXLike, dts } = opts;\n\n return {\n name: \"syntax-typescript\",\n\n manipulateOptions(opts, parserOpts) {\n parserOpts.plugins.push([\n \"typescript\",\n { disallowAmbiguousJSXLike, dts },\n ]);\n },\n };\n});\n"],"names":["declare","api","opts","assertVersion","disallowAmbiguousJSXLike","dts","name","manipulateOptions","parserOpts","plugins","push"],"mappings":";;AAQA,YAAeA,OAAO,CAAC,CAACC,GAAG,EAAEC,IAAa,KAAK;EAC7CD,GAAG,CAACE,aAAa,CAAA,oCAAuC,CAAC,CAAA;EAEzD,MAAM;IAAEC,wBAAwB;AAAEC,IAAAA,GAAAA;AAAI,GAAC,GAAGH,IAAI,CAAA;EAE9C,OAAO;AACLI,IAAAA,IAAI,EAAE,mBAAmB;AAEzBC,IAAAA,iBAAiBA,CAACL,IAAI,EAAEM,UAAU,EAAE;AAClCA,MAAAA,UAAU,CAACC,OAAO,CAACC,IAAI,CAAC,CACtB,YAAY,EACZ;QAAEN,wBAAwB;AAAEC,QAAAA,GAAAA;AAAI,OAAC,CAClC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;AACH,CAAC,CAAC;;;;"} |
+5
-5
| { | ||
| "name": "@babel/plugin-syntax-typescript", | ||
| "version": "8.0.0-beta.3", | ||
| "version": "8.0.0-beta.4", | ||
| "description": "Allow parsing of TypeScript syntax", | ||
@@ -21,10 +21,10 @@ "repository": { | ||
| "dependencies": { | ||
| "@babel/helper-plugin-utils": "^8.0.0-beta.3" | ||
| "@babel/helper-plugin-utils": "^8.0.0-beta.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "@babel/core": "^8.0.0-beta.3" | ||
| "@babel/core": "^7.0.0-0" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^8.0.0-beta.3", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-beta.3" | ||
| "@babel/core": "^8.0.0-beta.4", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-beta.4" | ||
| }, | ||
@@ -31,0 +31,0 @@ "engines": { |
4551
-22.96%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added