babel-preset-proposal-typescript
Advanced tools
Comparing version 2.0.3 to 2.1.0
'use strict'; | ||
var helperPluginUtils = require('@babel/helper-plugin-utils'); | ||
var proposalAsyncDoExpressions = require('@babel/plugin-proposal-async-do-expressions'); | ||
var proposalClassProperties = require('@babel/plugin-proposal-class-properties'); | ||
@@ -14,9 +15,11 @@ var proposalClassStaticBlock = require('@babel/plugin-proposal-class-static-block'); | ||
var proposalPrivatePropertyInObject = require('@babel/plugin-proposal-private-property-in-object'); | ||
var proposalRecordAndTuple = require('@babel/plugin-proposal-record-and-tuple'); | ||
var proposalThrowExpression = require('@babel/plugin-proposal-throw-expressions'); | ||
var syntaxDecorators = require('@babel/plugin-syntax-decorators'); | ||
var syntaxDynamicImport = require('@babel/plugin-syntax-dynamic-import'); | ||
var syntaxTypeScript = require('@babel/plugin-syntax-typescript'); | ||
var compareVersions = require('compare-versions'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var proposalAsyncDoExpressions__default = /*#__PURE__*/_interopDefaultLegacy(proposalAsyncDoExpressions); | ||
var proposalClassProperties__default = /*#__PURE__*/_interopDefaultLegacy(proposalClassProperties); | ||
@@ -32,5 +35,5 @@ var proposalClassStaticBlock__default = /*#__PURE__*/_interopDefaultLegacy(proposalClassStaticBlock); | ||
var proposalPrivatePropertyInObject__default = /*#__PURE__*/_interopDefaultLegacy(proposalPrivatePropertyInObject); | ||
var proposalRecordAndTuple__default = /*#__PURE__*/_interopDefaultLegacy(proposalRecordAndTuple); | ||
var proposalThrowExpression__default = /*#__PURE__*/_interopDefaultLegacy(proposalThrowExpression); | ||
var syntaxDecorators__default = /*#__PURE__*/_interopDefaultLegacy(syntaxDecorators); | ||
var syntaxDynamicImport__default = /*#__PURE__*/_interopDefaultLegacy(syntaxDynamicImport); | ||
var syntaxTypeScript__default = /*#__PURE__*/_interopDefaultLegacy(syntaxTypeScript); | ||
@@ -48,4 +51,7 @@ | ||
var NODE_VERSION = process.versions.node; | ||
var IS_RECORD_TUPLE_SUPPORTED = compareVersions.compare(NODE_VERSION, '14.6', '>='); | ||
var index = helperPluginUtils.declare(function (api, _a) { | ||
var _b = _a.classLoose, classLoose = _b === void 0 ? true : _b, decoratorsBeforeExport = _a.decoratorsBeforeExport, _c = _a.decoratorsLegacy, decoratorsLegacy = _c === void 0 ? true : _c, isTSX = _a.isTSX, _d = _a.pipelineOperator, pipelineOperator = _d === void 0 ? 'minimal' : _d; | ||
var classLoose = _a.classLoose, decoratorsBeforeExport = _a.decoratorsBeforeExport, _b = _a.decoratorsLegacy, decoratorsLegacy = _b === void 0 ? true : _b, isTSX = _a.isTSX, _c = _a.pipelineOperator, pipelineOperator = _c === void 0 ? 'minimal' : _c, _d = _a.recordTuplePolyfill, recordTuplePolyfill = _d === void 0 ? IS_RECORD_TUPLE_SUPPORTED : _d, _e = _a.recordTupleSyntaxType, recordTupleSyntaxType = _e === void 0 ? 'hash' : _e; | ||
api.assertVersion(7); | ||
@@ -61,3 +67,2 @@ return { | ||
], | ||
syntaxDynamicImport__default['default'], | ||
[ | ||
@@ -70,2 +75,3 @@ syntaxTypeScript__default['default'], | ||
syntaxV8intrinsic, | ||
proposalAsyncDoExpressions__default['default'], | ||
[ | ||
@@ -106,4 +112,14 @@ proposalClassStaticBlock__default['default'], | ||
], | ||
recordTuplePolyfill && [ | ||
proposalRecordAndTuple__default['default'], | ||
{ | ||
importPolyfill: !!recordTuplePolyfill, | ||
polyfillModuleName: typeof recordTuplePolyfill === 'string' | ||
? recordTuplePolyfill | ||
: undefined, | ||
syntaxType: recordTupleSyntaxType, | ||
}, | ||
], | ||
proposalThrowExpression__default['default'], | ||
], | ||
].filter(Boolean), | ||
// no need to override if it has been enabled | ||
@@ -110,0 +126,0 @@ overrides: isTSX |
import { declare } from '@babel/helper-plugin-utils'; | ||
import proposalAsyncDoExpressions from '@babel/plugin-proposal-async-do-expressions'; | ||
import proposalClassProperties from '@babel/plugin-proposal-class-properties'; | ||
@@ -12,6 +13,7 @@ import proposalClassStaticBlock from '@babel/plugin-proposal-class-static-block'; | ||
import proposalPrivatePropertyInObject from '@babel/plugin-proposal-private-property-in-object'; | ||
import proposalRecordAndTuple from '@babel/plugin-proposal-record-and-tuple'; | ||
import proposalThrowExpression from '@babel/plugin-proposal-throw-expressions'; | ||
import syntaxDecorators from '@babel/plugin-syntax-decorators'; | ||
import syntaxDynamicImport from '@babel/plugin-syntax-dynamic-import'; | ||
import syntaxTypeScript from '@babel/plugin-syntax-typescript'; | ||
import { compare } from 'compare-versions'; | ||
@@ -28,3 +30,6 @@ var syntaxV8intrinsic = declare((api) => { | ||
var index = declare((api, { classLoose = true, decoratorsBeforeExport, decoratorsLegacy = true, isTSX, pipelineOperator = 'minimal', }) => { | ||
const NODE_VERSION = process.versions.node; | ||
const IS_RECORD_TUPLE_SUPPORTED = compare(NODE_VERSION, '14.6', '>='); | ||
var index = declare((api, { classLoose, decoratorsBeforeExport, decoratorsLegacy = true, isTSX, pipelineOperator = 'minimal', recordTuplePolyfill = IS_RECORD_TUPLE_SUPPORTED, recordTupleSyntaxType = 'hash', }) => { | ||
api.assertVersion(7); | ||
@@ -40,3 +45,2 @@ return { | ||
], | ||
syntaxDynamicImport, | ||
[ | ||
@@ -49,2 +53,3 @@ syntaxTypeScript, | ||
syntaxV8intrinsic, | ||
proposalAsyncDoExpressions, | ||
[ | ||
@@ -85,4 +90,14 @@ proposalClassStaticBlock, | ||
], | ||
recordTuplePolyfill && [ | ||
proposalRecordAndTuple, | ||
{ | ||
importPolyfill: !!recordTuplePolyfill, | ||
polyfillModuleName: typeof recordTuplePolyfill === 'string' | ||
? recordTuplePolyfill | ||
: undefined, | ||
syntaxType: recordTupleSyntaxType, | ||
}, | ||
], | ||
proposalThrowExpression, | ||
], | ||
].filter(Boolean), | ||
// no need to override if it has been enabled | ||
@@ -89,0 +104,0 @@ overrides: isTSX |
import { declare } from '@babel/helper-plugin-utils'; | ||
import proposalAsyncDoExpressions from '@babel/plugin-proposal-async-do-expressions'; | ||
import proposalClassProperties from '@babel/plugin-proposal-class-properties'; | ||
@@ -12,6 +13,7 @@ import proposalClassStaticBlock from '@babel/plugin-proposal-class-static-block'; | ||
import proposalPrivatePropertyInObject from '@babel/plugin-proposal-private-property-in-object'; | ||
import proposalRecordAndTuple from '@babel/plugin-proposal-record-and-tuple'; | ||
import proposalThrowExpression from '@babel/plugin-proposal-throw-expressions'; | ||
import syntaxDecorators from '@babel/plugin-syntax-decorators'; | ||
import syntaxDynamicImport from '@babel/plugin-syntax-dynamic-import'; | ||
import syntaxTypeScript from '@babel/plugin-syntax-typescript'; | ||
import { compare } from 'compare-versions'; | ||
@@ -28,4 +30,7 @@ var syntaxV8intrinsic = declare(function (api) { | ||
var NODE_VERSION = process.versions.node; | ||
var IS_RECORD_TUPLE_SUPPORTED = compare(NODE_VERSION, '14.6', '>='); | ||
var index = declare(function (api, _a) { | ||
var _b = _a.classLoose, classLoose = _b === void 0 ? true : _b, decoratorsBeforeExport = _a.decoratorsBeforeExport, _c = _a.decoratorsLegacy, decoratorsLegacy = _c === void 0 ? true : _c, isTSX = _a.isTSX, _d = _a.pipelineOperator, pipelineOperator = _d === void 0 ? 'minimal' : _d; | ||
var classLoose = _a.classLoose, decoratorsBeforeExport = _a.decoratorsBeforeExport, _b = _a.decoratorsLegacy, decoratorsLegacy = _b === void 0 ? true : _b, isTSX = _a.isTSX, _c = _a.pipelineOperator, pipelineOperator = _c === void 0 ? 'minimal' : _c, _d = _a.recordTuplePolyfill, recordTuplePolyfill = _d === void 0 ? IS_RECORD_TUPLE_SUPPORTED : _d, _e = _a.recordTupleSyntaxType, recordTupleSyntaxType = _e === void 0 ? 'hash' : _e; | ||
api.assertVersion(7); | ||
@@ -41,3 +46,2 @@ return { | ||
], | ||
syntaxDynamicImport, | ||
[ | ||
@@ -50,2 +54,3 @@ syntaxTypeScript, | ||
syntaxV8intrinsic, | ||
proposalAsyncDoExpressions, | ||
[ | ||
@@ -86,4 +91,14 @@ proposalClassStaticBlock, | ||
], | ||
recordTuplePolyfill && [ | ||
proposalRecordAndTuple, | ||
{ | ||
importPolyfill: !!recordTuplePolyfill, | ||
polyfillModuleName: typeof recordTuplePolyfill === 'string' | ||
? recordTuplePolyfill | ||
: undefined, | ||
syntaxType: recordTupleSyntaxType, | ||
}, | ||
], | ||
proposalThrowExpression, | ||
], | ||
].filter(Boolean), | ||
// no need to override if it has been enabled | ||
@@ -90,0 +105,0 @@ overrides: isTSX |
@@ -6,6 +6,7 @@ export interface ProposalTypeScriptOptions { | ||
isTSX?: boolean; | ||
pipelineOperator?: 'minimal'; | ||
pipelineOperator?: 'minimal' | 'smart' | 'fsharp'; | ||
recordTuplePolyfill?: boolean | string; | ||
recordTupleSyntaxType?: 'hash' | 'bar'; | ||
} | ||
declare const _default: import("@babel/core").PluginItem; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
import { declare } from '@babel/helper-plugin-utils'; | ||
import proposalAsyncDoExpressions from '@babel/plugin-proposal-async-do-expressions'; | ||
import proposalClassProperties from '@babel/plugin-proposal-class-properties'; | ||
@@ -12,9 +13,9 @@ import proposalClassStaticBlock from '@babel/plugin-proposal-class-static-block'; | ||
import proposalPrivatePropertyInObject from '@babel/plugin-proposal-private-property-in-object'; | ||
import proposalRecordAndTuple from '@babel/plugin-proposal-record-and-tuple'; | ||
import proposalThrowExpression from '@babel/plugin-proposal-throw-expressions'; | ||
import syntaxDecorators from '@babel/plugin-syntax-decorators'; | ||
import syntaxDynamicImport from '@babel/plugin-syntax-dynamic-import'; | ||
import syntaxTypeScript from '@babel/plugin-syntax-typescript'; | ||
import syntaxV8intrinsic from './v8intrinsic'; | ||
export default declare(function (api, _a) { | ||
var _b = _a.classLoose, classLoose = _b === void 0 ? true : _b, decoratorsBeforeExport = _a.decoratorsBeforeExport, _c = _a.decoratorsLegacy, decoratorsLegacy = _c === void 0 ? true : _c, isTSX = _a.isTSX, _d = _a.pipelineOperator, pipelineOperator = _d === void 0 ? 'minimal' : _d; | ||
import { IS_RECORD_TUPLE_SUPPORTED } from './utils'; | ||
export default declare((api, { classLoose, decoratorsBeforeExport, decoratorsLegacy = true, isTSX, pipelineOperator = 'minimal', recordTuplePolyfill = IS_RECORD_TUPLE_SUPPORTED, recordTupleSyntaxType = 'hash', }) => { | ||
api.assertVersion(7); | ||
@@ -26,14 +27,14 @@ return { | ||
{ | ||
decoratorsBeforeExport: decoratorsBeforeExport, | ||
decoratorsBeforeExport, | ||
legacy: decoratorsLegacy, | ||
}, | ||
], | ||
syntaxDynamicImport, | ||
[ | ||
syntaxTypeScript, | ||
{ | ||
isTSX: isTSX, | ||
isTSX, | ||
}, | ||
], | ||
syntaxV8intrinsic, | ||
proposalAsyncDoExpressions, | ||
[ | ||
@@ -74,4 +75,14 @@ proposalClassStaticBlock, | ||
], | ||
recordTuplePolyfill && [ | ||
proposalRecordAndTuple, | ||
{ | ||
importPolyfill: !!recordTuplePolyfill, | ||
polyfillModuleName: typeof recordTuplePolyfill === 'string' | ||
? recordTuplePolyfill | ||
: undefined, | ||
syntaxType: recordTupleSyntaxType, | ||
}, | ||
], | ||
proposalThrowExpression, | ||
], | ||
].filter(Boolean), | ||
// no need to override if it has been enabled | ||
@@ -78,0 +89,0 @@ overrides: isTSX |
declare const _default: import("@babel/core").PluginItem; | ||
export default _default; | ||
//# sourceMappingURL=v8intrinsic.d.ts.map |
import { declare } from '@babel/helper-plugin-utils'; | ||
export default declare(function (api) { | ||
export default declare((api) => { | ||
api.assertVersion(7); | ||
return { | ||
name: 'v8intrinsic', | ||
manipulateOptions: function (_opts, parserOpts) { | ||
manipulateOptions(_opts, parserOpts) { | ||
parserOpts.plugins.push('v8intrinsic'); | ||
@@ -8,0 +8,0 @@ }, |
{ | ||
"name": "babel-preset-proposal-typescript", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "Yet another Babel preset for TypeScript, only transforms proposals which TypeScript does not support now.", | ||
@@ -17,4 +17,4 @@ "repository": "git+https://github.com/rx-ts/babel-preset-proposal-typescript.git", | ||
"files": [ | ||
"!*.tsbuildinfo", | ||
"lib" | ||
"lib", | ||
"!*.tsbuildinfo" | ||
], | ||
@@ -31,22 +31,26 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@babel/core": "^7.12.0", | ||
"@babel/core": "^7.14.1", | ||
"typescript": "^4.0.0" | ||
}, | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.10.4", | ||
"@babel/plugin-proposal-class-properties": "^7.12.1", | ||
"@babel/plugin-proposal-class-static-block": "^7.12.1", | ||
"@babel/plugin-proposal-do-expressions": "^7.12.1", | ||
"@babel/plugin-proposal-function-bind": "^7.12.1", | ||
"@babel/plugin-proposal-function-sent": "^7.12.1", | ||
"@babel/plugin-proposal-json-strings": "^7.12.1", | ||
"@babel/plugin-proposal-partial-application": "^7.12.1", | ||
"@babel/plugin-proposal-pipeline-operator": "^7.12.1", | ||
"@babel/plugin-proposal-private-methods": "^7.12.1", | ||
"@babel/plugin-proposal-private-property-in-object": "^7.12.1", | ||
"@babel/plugin-proposal-throw-expressions": "^7.12.1", | ||
"@babel/plugin-syntax-decorators": "^7.12.1", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/plugin-syntax-typescript": "^7.12.1" | ||
"@babel/helper-plugin-utils": "^7.13.0", | ||
"@babel/plugin-proposal-async-do-expressions": "^7.14.0", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/plugin-proposal-class-static-block": "^7.13.11", | ||
"@babel/plugin-proposal-do-expressions": "^7.14.0", | ||
"@babel/plugin-proposal-function-bind": "^7.12.13", | ||
"@babel/plugin-proposal-function-sent": "^7.12.13", | ||
"@babel/plugin-proposal-json-strings": "^7.13.8", | ||
"@babel/plugin-proposal-optional-chaining": "^7.13.12", | ||
"@babel/plugin-proposal-partial-application": "^7.12.13", | ||
"@babel/plugin-proposal-pipeline-operator": "^7.12.13", | ||
"@babel/plugin-proposal-private-methods": "^7.13.0", | ||
"@babel/plugin-proposal-private-property-in-object": "^7.14.0", | ||
"@babel/plugin-proposal-record-and-tuple": "^7.13.0", | ||
"@babel/plugin-proposal-throw-expressions": "^7.12.13", | ||
"@babel/plugin-syntax-decorators": "^7.12.13", | ||
"@babel/plugin-syntax-typescript": "^7.12.13", | ||
"@bloomberg/record-tuple-polyfill": "^0.0.3", | ||
"compare-versions": "^3.6.0" | ||
} | ||
} |
@@ -38,14 +38,16 @@ # babel-preset-proposal-typescript | ||
1. [class-static-block](https://www.npmjs.com/package/@babel/plugin-proposal-class-static-block) | ||
2. [class-properties](https://www.npmjs.com/package/@babel/plugin-proposal-class-properties) | ||
3. [do-expressions](https://www.npmjs.com/package/@babel/plugin-proposal-do-expressions) | ||
4. [function-bind](https://www.npmjs.com/package/@babel/plugin-proposal-function-bind) | ||
5. [function-sent](https://www.npmjs.com/package/@babel/plugin-proposal-function-sent) | ||
6. [json-strings](https://www.npmjs.com/package/@babel/plugin-proposal-json-strings) | ||
7. [partial-application](https://www.npmjs.com/package/@babel/plugin-proposal-partial-application) | ||
8. [pipeline-operator](https://www.npmjs.com/package/@babel/plugin-proposal-pipeline-operator) | ||
9. [private-methods](https://www.npmjs.com/package/@babel/plugin-proposal-private-methods) | ||
10. [private-property-in-object](https://www.npmjs.com/package/@babel/plugin-proposal-private-property-in-object) | ||
11. [throw-expressions](https://www.npmjs.com/package/@babel/plugin-proposal-throw-expressions) | ||
12. [v8intrinsic](./src/v8intrinsic.ts) - [Further Detail](https://babeljs.io/blog/2019/09/05/7.6.0#v8-intrinsic-runtime-functions-parsing-10148-https-githubcom-babel-babel-pull-10148) | ||
1. [async-do-expressions](https://www.npmjs.com/package/@babel/plugin-proposal-async-do-expressions) | ||
2. [class-properties](https://www.npmjs.com/package/@babel/plugin-proposal-class-properties) | ||
3. [class-static-block](https://www.npmjs.com/package/@babel/plugin-proposal-class-static-block) | ||
4. [do-expressions](https://www.npmjs.com/package/@babel/plugin-proposal-do-expressions) | ||
5. [function-bind](https://www.npmjs.com/package/@babel/plugin-proposal-function-bind) | ||
6. [function-sent](https://www.npmjs.com/package/@babel/plugin-proposal-function-sent) | ||
7. [json-strings](https://www.npmjs.com/package/@babel/plugin-proposal-json-strings) | ||
8. [partial-application](https://www.npmjs.com/package/@babel/plugin-proposal-partial-application) | ||
9. [pipeline-operator](https://www.npmjs.com/package/@babel/plugin-proposal-pipeline-operator) | ||
10. [private-methods](https://www.npmjs.com/package/@babel/plugin-proposal-private-methods) | ||
11. [private-property-in-object](https://www.npmjs.com/package/@babel/plugin-proposal-private-property-in-object) | ||
12. [record-and-tuple](https://www.npmjs.com/package/@babel/plugin-proposal-record-and-tuple) | ||
13. [throw-expressions](https://www.npmjs.com/package/@babel/plugin-proposal-throw-expressions) | ||
14. [v8intrinsic](./src/v8intrinsic.ts) - [Further Detail](https://babeljs.io/blog/2019/09/05/7.6.0#v8-intrinsic-runtime-functions-parsing-10148-https-githubcom-babel-babel-pull-10148) | ||
@@ -64,12 +66,16 @@ ## Install | ||
| option | description | defaults | | ||
| ------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------- | | ||
| `classLoose` | whether to use loose mode for class properties and private methods | `true` | | ||
| `decoratorsBeforeExport` | See [Babel Document](https://babeljs.io/docs/en/babel-plugin-proposal-decorators#decoratorsbeforeexport) | `undefined` | | ||
| `decoratorsLegacy` | whether to use legacy decorators semantic | `true` | | ||
| `isTSX` | whether to enable `jsx` plugin with `typescript` | `false`, but `true` for `/\.[jt]sx$/` | | ||
| `pipelineOperator` | implementation of pipeline operator | `"minimal"` | | ||
| option | description | defaults | | ||
| ------------------------ | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | | ||
| `classLoose` | whether to use loose mode for `class-static-block`, `class-properties` and `private-methods` | `undefined` | | ||
| `decoratorsBeforeExport` | See [Babel Document](https://babeljs.io/docs/en/babel-plugin-proposal-decorators#decoratorsbeforeexport) | `undefined` | | ||
| `decoratorsLegacy` | whether to use legacy decorators semantic | `true` | | ||
| `isTSX` | whether to enable `jsx` plugin with `typescript` | `false`, but `true` for `/\.[jt]sx$/` | | ||
| `pipelineOperator` | implementation of pipeline operator, `minimal`, `smart` or `fsharp` | `minimal` | | ||
| `recordTuplePolyfill` | whether to enable import `record-tuple` plugin and polyfill, or specific the polyfill module name | `true` for Node>=14.6, it represents `@bloomberg/record-tuple-polyfill` | | ||
| `recordTupleSyntaxType` | record-tuple syntax, `hash` or `bar` | `hash` | | ||
## Usage | ||
Note that unlike plugins, the presets are applied in an order of last to first (<https://babeljs.io/docs/en/presets/#preset-ordering>), so please make sure `proposal-typescript` is used at the last. | ||
### Via `.babelrc` (Recommended) | ||
@@ -108,3 +114,3 @@ | ||
options: { | ||
presets: ['proposal-typescript'], | ||
presets: ['@babel/typescript', 'proposal-typescript'], | ||
}, | ||
@@ -111,0 +117,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
490
144
33056
21
+ Addedcompare-versions@^3.6.0
+ Added@babel/plugin-proposal-async-do-expressions@7.24.1(transitive)
+ Added@babel/plugin-proposal-optional-chaining@7.21.0(transitive)
+ Added@babel/plugin-proposal-record-and-tuple@7.24.1(transitive)
+ Added@babel/plugin-syntax-async-do-expressions@7.24.1(transitive)
+ Added@babel/plugin-syntax-optional-chaining@7.8.3(transitive)
+ Added@babel/plugin-syntax-record-and-tuple@7.24.1(transitive)
+ Added@bloomberg/record-tuple-polyfill@0.0.3(transitive)
+ Addedcompare-versions@3.6.0(transitive)
- Removed@babel/plugin-syntax-dynamic-import@7.8.3(transitive)
Updated@babel/plugin-proposal-private-property-in-object@^7.14.0