babel-preset-kyt-core
Advanced tools
Comparing version 1.0.0-alpha.a38d57b8 to 1.0.0-alpha.acd59c56
/* eslint-disable global-require */ | ||
jest.setMock('babel-preset-env', 'env'); | ||
jest.setMock('babel-plugin-transform-runtime', 'runtime'); | ||
jest.setMock('babel-plugin-transform-es2015-modules-commonjs', 'commonjs'); | ||
jest.setMock('babel-plugin-syntax-dynamic-import', 'import'); | ||
jest.setMock('@babel/preset-env', 'env'); | ||
jest.setMock('@babel/plugin-transform-runtime', 'runtime'); | ||
jest.setMock('@babel/plugin-syntax-dynamic-import', 'import'); | ||
jest.setMock('babel-plugin-dynamic-import-node', 'import-node'); | ||
describe('babel-preset-kyt-core', () => { | ||
it('should load default presets and plugins', () => { | ||
const presetKytCore = require('../index.js'); | ||
const presetKytCore = require('..'); | ||
expect(presetKytCore()).toMatchSnapshot(); | ||
@@ -16,3 +16,3 @@ }); | ||
process.env.KYT_ENV_TYPE = 'server'; | ||
const presetKytCore = require('../index.js'); | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore(); | ||
@@ -24,3 +24,3 @@ expect(config.presets[0][1].targets.node).toEqual('current'); | ||
process.env.KYT_ENV_TYPE = 'client'; | ||
const presetKytCore = require('../index.js'); | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore( | ||
@@ -37,3 +37,3 @@ {}, | ||
process.env.KYT_ENV_TYPE = 'server'; | ||
const presetKytCore = require('../index.js'); | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore({}, { envOptions: { server: { targets: { node: false } } } }); | ||
@@ -44,6 +44,19 @@ expect(config.presets[0][1].targets.node).toEqual(false); | ||
it('should support an `includeRuntime` option', () => { | ||
const presetKytCore = require('../index.js'); | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore({}, { includeRuntime: true }); | ||
expect(config.plugins[0]).toEqual('runtime'); | ||
}); | ||
it('should include a dynamic import plugin', () => { | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore(); | ||
expect(config.plugins[0]).toEqual('import'); | ||
}); | ||
it('should include a import node plugin when KYT_ENV_TYPE=test', () => { | ||
process.env.KYT_ENV_TYPE = 'test'; | ||
const presetKytCore = require('..'); | ||
const config = presetKytCore(); | ||
expect(config.plugins[1]).toEqual('import-node'); | ||
}); | ||
}); |
/* eslint-disable vars-on-top */ | ||
var babelPresetEnv = require('babel-preset-env'); | ||
var babelTransformRuntime = require('babel-plugin-transform-runtime'); | ||
var babelSyntaxDynamicImport = require('babel-plugin-syntax-dynamic-import'); | ||
var babelTransformModules = require('babel-plugin-transform-es2015-modules-commonjs'); | ||
var babelPresetEnv = require('@babel/preset-env'); | ||
var babelTransformRuntime = require('@babel/plugin-transform-runtime'); | ||
var babelSyntaxDynamicImport = require('@babel/plugin-syntax-dynamic-import'); | ||
var babelDynamicImportNode = require('babel-plugin-dynamic-import-node'); | ||
var merge = require('lodash.merge'); | ||
@@ -15,6 +15,5 @@ | ||
var clientEnvOptions = { | ||
modules: false, | ||
useBuiltIns: true, | ||
useBuiltIns: 'entry', | ||
forceAllTransforms: true, | ||
targets: { | ||
uglify: true, | ||
browsers: ['>1%', 'last 4 versions', 'not ie < 11'], | ||
@@ -25,4 +24,3 @@ }, | ||
var serverEnvOptions = { | ||
modules: false, | ||
useBuiltIns: true, | ||
useBuiltIns: 'entry', | ||
targets: { | ||
@@ -65,11 +63,5 @@ node: 'current', | ||
opts.includeRuntime === true && babelTransformRuntime, | ||
babelSyntaxDynamicImport, | ||
process.env.KYT_ENV_TYPE === 'test' ? babelDynamicImportNode : babelSyntaxDynamicImport, | ||
].filter(Boolean), | ||
env: { | ||
test: { | ||
plugins: [[babelTransformModules, { loose: true }]], | ||
}, | ||
}, | ||
}; | ||
}; |
{ | ||
"name": "babel-preset-kyt-core", | ||
"version": "1.0.0-alpha.a38d57b8", | ||
"version": "1.0.0-alpha.acd59c56", | ||
"description": "An opinionated babel preset, best used with kyt", | ||
@@ -12,6 +12,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-plugin-syntax-dynamic-import": "6.18.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0", | ||
"babel-plugin-transform-runtime": "6.23.0", | ||
"babel-preset-env": "1.6.0" | ||
"@babel/plugin-syntax-dynamic-import": "7.2.0", | ||
"@babel/plugin-transform-runtime": "7.2.0", | ||
"@babel/preset-env": "7.2.3", | ||
"babel-plugin-dynamic-import-node": "2.2.0" | ||
}, | ||
@@ -18,0 +18,0 @@ "keywords": [ |
@@ -11,15 +11,16 @@ ## babel-preset-kyt-core | ||
To install: | ||
1. `npm install babel-preset-kyt-core --save` | ||
2. In babelrc: | ||
``` | ||
{ | ||
presets: [ | ||
"babel-preset-kyt-core" | ||
] | ||
} | ||
``` | ||
``` | ||
{ | ||
presets: [ | ||
"babel-preset-kyt-core" | ||
] | ||
} | ||
``` | ||
## Options | ||
*(see [documentation](https://babeljs.io/docs/plugins/#plugin-preset-options) for Babel preset options)* | ||
_(see [documentation](https://babeljs.io/docs/plugins/#plugin-preset-options) for Babel preset options)_ | ||
@@ -31,5 +32,5 @@ - `envOptions` (`Object`) - extend the default babel-preset-env options. The type of options, `client`, `server`, and `test`, are dependent on the value of `process.env.KYT_ENV_TYPE` which, when undefined, defaults to `client`. kyt will automatically set the `KYT_ENV_TYPE` when it runs commands. For debugging purposes, use `"debug": true` to see what the plugin is targeting. The following are the default babel-preset-env configurations used by kyt-core: | ||
modules: false, | ||
useBuiltIns: true, | ||
useBuiltIns: 'entry', | ||
forceAllTransforms: true, | ||
targets: { | ||
uglify: true, | ||
browsers: ['>1%', 'last 4 versions', 'not ie < 11'], | ||
@@ -41,3 +42,3 @@ }, | ||
modules: false, | ||
useBuiltIns: true, | ||
useBuiltIns: 'entry', | ||
targets: { | ||
@@ -72,2 +73,3 @@ node: 'current' | ||
``` | ||
You can find additional options to configure babel-preset-env [here](https://github.com/babel/babel/tree/master/experimental/babel-preset-env#options). | ||
@@ -74,0 +76,0 @@ |
Sorry, the diff of this file is not supported yet
9081
107
88
9
+ Added@babel/preset-env@7.2.3
+ Added@ampproject/remapping@2.3.0(transitive)
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/compat-data@7.26.5(transitive)
+ Added@babel/core@7.26.0(transitive)
+ Added@babel/generator@7.26.5(transitive)
+ Added@babel/helper-annotate-as-pure@7.25.9(transitive)
+ Added@babel/helper-compilation-targets@7.26.5(transitive)
+ Added@babel/helper-create-regexp-features-plugin@7.26.3(transitive)
+ Added@babel/helper-environment-visitor@7.24.7(transitive)
+ Added@babel/helper-member-expression-to-functions@7.25.9(transitive)
+ Added@babel/helper-module-imports@7.25.9(transitive)
+ Added@babel/helper-module-transforms@7.26.0(transitive)
+ Added@babel/helper-optimise-call-expression@7.25.9(transitive)
+ Added@babel/helper-plugin-utils@7.26.5(transitive)
+ Added@babel/helper-remap-async-to-generator@7.25.9(transitive)
+ Added@babel/helper-replace-supers@7.26.5(transitive)
+ Added@babel/helper-skip-transparent-expression-wrappers@7.25.9(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/helper-validator-option@7.25.9(transitive)
+ Added@babel/helper-wrap-function@7.25.9(transitive)
+ Added@babel/helpers@7.26.0(transitive)
+ Added@babel/parser@7.26.5(transitive)
+ Added@babel/plugin-proposal-async-generator-functions@7.20.7(transitive)
+ Added@babel/plugin-proposal-json-strings@7.18.6(transitive)
+ Added@babel/plugin-proposal-object-rest-spread@7.20.7(transitive)
+ Added@babel/plugin-proposal-optional-catch-binding@7.18.6(transitive)
+ Added@babel/plugin-proposal-unicode-property-regex@7.18.6(transitive)
+ Added@babel/plugin-syntax-async-generators@7.8.4(transitive)
+ Added@babel/plugin-syntax-dynamic-import@7.2.0(transitive)
+ Added@babel/plugin-syntax-json-strings@7.8.3(transitive)
+ Added@babel/plugin-syntax-object-rest-spread@7.8.3(transitive)
+ Added@babel/plugin-syntax-optional-catch-binding@7.8.3(transitive)
+ Added@babel/plugin-transform-arrow-functions@7.25.9(transitive)
+ Added@babel/plugin-transform-async-to-generator@7.25.9(transitive)
+ Added@babel/plugin-transform-block-scoped-functions@7.26.5(transitive)
+ Added@babel/plugin-transform-block-scoping@7.25.9(transitive)
+ Added@babel/plugin-transform-classes@7.25.9(transitive)
+ Added@babel/plugin-transform-computed-properties@7.25.9(transitive)
+ Added@babel/plugin-transform-destructuring@7.25.9(transitive)
+ Added@babel/plugin-transform-dotall-regex@7.25.9(transitive)
+ Added@babel/plugin-transform-duplicate-keys@7.25.9(transitive)
+ Added@babel/plugin-transform-exponentiation-operator@7.26.3(transitive)
+ Added@babel/plugin-transform-for-of@7.25.9(transitive)
+ Added@babel/plugin-transform-function-name@7.25.9(transitive)
+ Added@babel/plugin-transform-literals@7.25.9(transitive)
+ Added@babel/plugin-transform-modules-amd@7.25.9(transitive)
+ Added@babel/plugin-transform-modules-commonjs@7.26.3(transitive)
+ Added@babel/plugin-transform-modules-systemjs@7.25.9(transitive)
+ Added@babel/plugin-transform-modules-umd@7.25.9(transitive)
+ Added@babel/plugin-transform-new-target@7.25.9(transitive)
+ Added@babel/plugin-transform-object-super@7.25.9(transitive)
+ Added@babel/plugin-transform-parameters@7.25.9(transitive)
+ Added@babel/plugin-transform-regenerator@7.25.9(transitive)
+ Added@babel/plugin-transform-runtime@7.2.0(transitive)
+ Added@babel/plugin-transform-shorthand-properties@7.25.9(transitive)
+ Added@babel/plugin-transform-spread@7.25.9(transitive)
+ Added@babel/plugin-transform-sticky-regex@7.25.9(transitive)
+ Added@babel/plugin-transform-template-literals@7.25.9(transitive)
+ Added@babel/plugin-transform-typeof-symbol@7.25.9(transitive)
+ Added@babel/plugin-transform-unicode-regex@7.25.9(transitive)
+ Added@babel/preset-env@7.2.3(transitive)
+ Added@babel/runtime@7.26.0(transitive)
+ Added@babel/template@7.25.9(transitive)
+ Added@babel/traverse@7.26.5(transitive)
+ Added@babel/types@7.26.5(transitive)
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Addedbabel-plugin-dynamic-import-node@2.2.0(transitive)
+ Addedbrowserslist@4.24.4(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedconvert-source-map@2.0.0(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedelectron-to-chromium@1.5.84(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgensync@1.0.0-beta.2(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedjs-levenshtein@1.1.6(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsesc@3.0.23.1.0(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedregenerate-unicode-properties@10.2.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedregenerator-transform@0.15.2(transitive)
+ Addedregexpu-core@6.2.0(transitive)
+ Addedregjsgen@0.8.0(transitive)
+ Addedregjsparser@0.12.0(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedunicode-canonical-property-names-ecmascript@2.0.1(transitive)
+ Addedunicode-match-property-ecmascript@2.0.0(transitive)
+ Addedunicode-match-property-value-ecmascript@2.2.0(transitive)
+ Addedunicode-property-aliases-ecmascript@2.1.0(transitive)
+ Addedupdate-browserslist-db@1.1.2(transitive)
+ Addedyallist@3.1.1(transitive)
- Removedbabel-plugin-transform-es2015-modules-commonjs@6.26.0
- Removedbabel-preset-env@1.6.0
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedbabel-code-frame@6.26.0(transitive)
- Removedbabel-helper-builder-binary-assignment-operator-visitor@6.24.1(transitive)
- Removedbabel-helper-call-delegate@6.24.1(transitive)
- Removedbabel-helper-define-map@6.26.0(transitive)
- Removedbabel-helper-explode-assignable-expression@6.24.1(transitive)
- Removedbabel-helper-function-name@6.24.1(transitive)
- Removedbabel-helper-get-function-arity@6.24.1(transitive)
- Removedbabel-helper-hoist-variables@6.24.1(transitive)
- Removedbabel-helper-optimise-call-expression@6.24.1(transitive)
- Removedbabel-helper-regex@6.26.0(transitive)
- Removedbabel-helper-remap-async-to-generator@6.24.1(transitive)
- Removedbabel-helper-replace-supers@6.24.1(transitive)
- Removedbabel-messages@6.23.0(transitive)
- Removedbabel-plugin-check-es2015-constants@6.22.0(transitive)
- Removedbabel-plugin-syntax-async-functions@6.13.0(transitive)
- Removedbabel-plugin-syntax-dynamic-import@6.18.0(transitive)
- Removedbabel-plugin-syntax-exponentiation-operator@6.13.0(transitive)
- Removedbabel-plugin-syntax-trailing-function-commas@6.22.0(transitive)
- Removedbabel-plugin-transform-async-to-generator@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-arrow-functions@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-block-scoped-functions@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-block-scoping@6.26.0(transitive)
- Removedbabel-plugin-transform-es2015-classes@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-computed-properties@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-destructuring@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-duplicate-keys@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-for-of@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-function-name@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-literals@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-modules-amd@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-modules-commonjs@6.26.0(transitive)
- Removedbabel-plugin-transform-es2015-modules-systemjs@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-modules-umd@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-object-super@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-parameters@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-shorthand-properties@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-spread@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-sticky-regex@6.24.1(transitive)
- Removedbabel-plugin-transform-es2015-template-literals@6.22.0(transitive)
- Removedbabel-plugin-transform-es2015-typeof-symbol@6.23.0(transitive)
- Removedbabel-plugin-transform-es2015-unicode-regex@6.24.1(transitive)
- Removedbabel-plugin-transform-exponentiation-operator@6.24.1(transitive)
- Removedbabel-plugin-transform-regenerator@6.26.0(transitive)
- Removedbabel-plugin-transform-runtime@6.23.0(transitive)
- Removedbabel-plugin-transform-strict-mode@6.24.1(transitive)
- Removedbabel-preset-env@1.6.0(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbabel-template@6.26.0(transitive)
- Removedbabel-traverse@6.26.0(transitive)
- Removedbabel-types@6.26.0(transitive)
- Removedbabylon@6.18.0(transitive)
- Removedbrowserslist@2.11.3(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@2.6.9(transitive)
- Removedelectron-to-chromium@1.5.83(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesutils@2.0.3(transitive)
- Removedglobals@9.18.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedjs-tokens@3.0.2(transitive)
- Removedjsesc@0.5.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedms@2.0.0(transitive)
- Removedprivate@0.1.8(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedregenerator-transform@0.10.1(transitive)
- Removedregexpu-core@2.0.0(transitive)
- Removedregjsgen@0.2.0(transitive)
- Removedregjsparser@0.1.5(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedto-fast-properties@1.0.3(transitive)