@anolilab/babel-preset
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -0,1 +1,12 @@ | ||
## @anolilab/babel-preset [2.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/babel-preset@1.1.1...@anolilab/babel-preset@2.0.0) (2021-04-19) | ||
### ⚠ BREAKING CHANGES | ||
* upgraded node version to v12 and es modules | ||
### Features | ||
* added more tests ([0535ce4](https://github.com/anolilab/javascript-style-guide/commit/0535ce477766e80286e7f6aecf10bae33b5be594)) | ||
### @anolilab/babel-preset [1.1.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/babel-preset@1.1.0...@anolilab/babel-preset@1.1.1) (2021-04-14) | ||
@@ -2,0 +13,0 @@ |
90
index.js
@@ -1,11 +0,11 @@ | ||
const { declare } = require("@babel/helper-plugin-utils"); | ||
const isModuleAvailable = require('./lib/is-module-available'); | ||
const missing = require('./lib/missing'); | ||
import { declare } from '@babel/helper-plugin-utils'; | ||
import isModuleAvailable from './lib/is-module-available.js'; | ||
import missing from './lib/missing.js'; | ||
module.exports = declare((api, options) => { | ||
const bable = declare((api, options) => { | ||
// see docs about api at https://babeljs.io/docs/en/config-files#apicache | ||
api.assertVersion("^7.0.0"); | ||
api.assertVersion('^7.13'); | ||
const { | ||
modules = "auto", | ||
modules = 'auto', | ||
targets = null, | ||
@@ -24,3 +24,3 @@ removePropTypes = false, | ||
if (typeof modules !== "undefined" && typeof modules !== "boolean" && modules !== "auto") { | ||
if (typeof modules !== 'undefined' && typeof modules !== 'boolean' && modules !== 'auto') { | ||
throw new TypeError( | ||
@@ -32,3 +32,3 @@ '@anolilab/babel-preset only accepts `true`, `false`, or `"auto"` as the value of the "modules" option', | ||
if (removePropTypes && !react) { | ||
throw new Error('"removePropTypes" can\'t be enabled if react is disabled.') | ||
throw new Error('removePropTypes can\'t be enabled if react is disabled.') | ||
} | ||
@@ -66,7 +66,7 @@ | ||
const debug = typeof options.debug === "boolean" ? options.debug : false; | ||
const debug = typeof options.debug === 'boolean' ? options.debug : false; | ||
const development = | ||
typeof options.development === "boolean" | ||
typeof options.development === 'boolean' | ||
? options.development | ||
: api.cache.using(() => process.env.NODE_ENV === "development"); | ||
: process.env.NODE_ENV === 'development'; | ||
@@ -76,7 +76,7 @@ return { | ||
[ | ||
require("@babel/preset-env"), | ||
'@babel/preset-env', | ||
{ | ||
debug, | ||
exclude: ["transform-async-to-generator", "transform-regenerator"], | ||
modules: modules === false ? false : "auto", | ||
exclude: ['transform-async-to-generator', 'transform-regenerator'], | ||
modules: modules === false ? false : 'auto', | ||
targets: targets, | ||
@@ -87,3 +87,3 @@ }, | ||
? [ | ||
require("@babel/preset-typescript"), | ||
'@babel/preset-typescript', | ||
{ | ||
@@ -95,3 +95,3 @@ allExtensions: true, | ||
: null, | ||
react ? [require("@babel/preset-react"), { development }] : null, | ||
react ? ['@babel/preset-react', { development }] : null, | ||
].filter(Boolean), | ||
@@ -103,3 +103,3 @@ plugins: [ | ||
[ | ||
require("@babel/plugin-proposal-class-properties"), | ||
'@babel/plugin-proposal-class-properties', | ||
{ | ||
@@ -111,3 +111,3 @@ loose: true, | ||
? [ | ||
require("@babel/plugin-transform-classes"), | ||
'@babel/plugin-transform-classes', | ||
{ | ||
@@ -119,3 +119,3 @@ loose: true, | ||
[ | ||
require("@babel/plugin-proposal-decorators"), | ||
'@babel/plugin-proposal-decorators', | ||
{ | ||
@@ -128,3 +128,3 @@ legacy: true, | ||
? [ | ||
require("@babel/plugin-transform-computed-properties"), | ||
'@babel/plugin-transform-computed-properties', | ||
{ | ||
@@ -138,3 +138,3 @@ loose: true, | ||
? [ | ||
require("@babel/plugin-transform-parameters"), | ||
'@babel/plugin-transform-parameters', | ||
{ | ||
@@ -148,3 +148,3 @@ loose: true, | ||
? [ | ||
require("@babel/plugin-transform-template-literals"), | ||
'@babel/plugin-transform-template-literals', | ||
{ | ||
@@ -157,7 +157,7 @@ loose: false, | ||
? [ | ||
require("babel-plugin-transform-react-remove-prop-types"), | ||
'babel-plugin-transform-react-remove-prop-types', | ||
Object.assign( | ||
{ | ||
mode: "wrap", | ||
ignoreFilenames: ["node_modules"], | ||
mode: 'wrap', | ||
ignoreFilenames: ['node_modules'], | ||
}, | ||
@@ -168,7 +168,7 @@ removePropTypes, | ||
: null, | ||
require('@babel/plugin-proposal-export-namespace-from'), | ||
typescript ? require("@babel/plugin-transform-typescript") : null, | ||
'@babel/plugin-proposal-export-namespace-from', | ||
typescript ? '@babel/plugin-transform-typescript' : null, | ||
// Transform dynamic import to require | ||
[ | ||
require("babel-plugin-dynamic-import-node"), | ||
'babel-plugin-dynamic-import-node', | ||
{ | ||
@@ -178,16 +178,15 @@ noInterop: true, | ||
], | ||
typescript ? require('@babel/plugin-syntax-jsx') : null, | ||
typescript ? '@babel/plugin-syntax-jsx' : null, | ||
// Adds syntax support for import() | ||
require("@babel/plugin-syntax-dynamic-import"), | ||
require("@babel/plugin-transform-property-mutators"), | ||
require("@babel/plugin-transform-member-expression-literals"), | ||
require("@babel/plugin-transform-property-literals"), | ||
require("@babel/plugin-proposal-nullish-coalescing-operator"), | ||
require("@babel/plugin-proposal-numeric-separator"), | ||
require("@babel/plugin-syntax-bigin"), | ||
require("@babel/plugin-proposal-optional-catch-binding"), | ||
require("@babel/plugin-proposal-optional-chaining"), | ||
require("@babel/plugin-syntax-bigint"), | ||
'@babel/plugin-syntax-dynamic-import', | ||
'@babel/plugin-transform-property-mutators', | ||
'@babel/plugin-transform-member-expression-literals', | ||
'@babel/plugin-transform-property-literals', | ||
'@babel/plugin-proposal-nullish-coalescing-operator', | ||
'@babel/plugin-proposal-numeric-separator', | ||
'@babel/plugin-proposal-optional-catch-binding', | ||
'@babel/plugin-proposal-optional-chaining', | ||
'@babel/plugin-syntax-bigint', | ||
[ | ||
require("@babel/plugin-proposal-object-rest-spread"), | ||
'@babel/plugin-proposal-object-rest-spread', | ||
{ | ||
@@ -198,12 +197,9 @@ useBuiltIns: true, | ||
// https://babeljs.io/docs/en/babel-plugin-syntax-async-generators | ||
require("@babel/plugin-syntax-async-generators"), | ||
// fast-async is a Babel plugin that implements the ES7 keywords async and await | ||
// using syntax transformation at compile-time, rather than generators. | ||
require("fast-async"), | ||
'@babel/plugin-syntax-async-generators', | ||
// Experimental macros support. Will be documented after it's had some time | ||
// in the wild. | ||
require("babel-plugin-macros"), | ||
'babel-plugin-macros', | ||
transformRuntime | ||
? [ | ||
require("@babel/plugin-transform-runtime"), | ||
'@babel/plugin-transform-runtime', | ||
{ | ||
@@ -222,1 +218,3 @@ absoluteRuntime: false, | ||
}); | ||
export default bable |
@@ -1,2 +0,2 @@ | ||
module.exports = function isModuleAvailable(name) { | ||
export default function isModuleAvailable(name) { | ||
try { | ||
@@ -3,0 +3,0 @@ require.resolve(name); |
@@ -12,3 +12,3 @@ const atLatest = (pkg) => { | ||
*/ | ||
module.exports = function (notInstalled) { | ||
export default function missing (notInstalled) { | ||
const s = notInstalled.length === 1 ? '' : 's'; | ||
@@ -15,0 +15,0 @@ |
@@ -7,18 +7,18 @@ #!/usr/bin/env node | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { promisify } = require("util"); | ||
import { writeFile, existsSync } from 'fs'; | ||
import { resolve, join } from 'path'; | ||
import { promisify } from 'util'; | ||
const writeFileAsync = promisify(fs.writeFile); | ||
const writeFileAsync = promisify(writeFile); | ||
// get the path to the host project. | ||
const projectPath = path.resolve(process.cwd(), "..", "..", ".."); | ||
const projectPath = resolve(process.cwd(), '..', '..', '..'); | ||
console.log("Configuring @anolilab/babel-preset", projectPath, "\n"); | ||
console.log('Configuring @anolilab/babel-preset', projectPath, '\n'); | ||
/** | ||
* Writes .babelrc.js if it doesn't exist. Warns if it exists. | ||
* Writes babel.config.cjs if it doesn't exist. Warns if it exists. | ||
*/ | ||
const writeBabelRc = () => { | ||
const eslintPath = path.join(projectPath, ".babelrc.js"); | ||
const eslintPath = join(projectPath, 'babel.config.cjs'); | ||
const content = `module.exports = { | ||
@@ -29,4 +29,4 @@ presets: ["@anolilab/babel-preset"] | ||
if (fs.existsSync(eslintPath)) { | ||
console.warn(`⚠️ .babelrc.js already exists; | ||
if (existsSync(eslintPath)) { | ||
console.warn(`⚠️ babel.config.cjs already exists; | ||
Make sure that it includes the following for @anolilab/babel-preset' | ||
@@ -33,0 +33,0 @@ to work as it should: { presets: ["@anolilab/babel-preset"] }.`); |
{ | ||
"name": "@anolilab/babel-preset", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "A babel preset for transforming your JavaScript for Anolilab.", | ||
@@ -20,2 +20,3 @@ "keywords": [ | ||
}, | ||
"type": "module", | ||
"main": "index.js", | ||
@@ -33,29 +34,29 @@ "files": [ | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.10.4", | ||
"@babel/plugin-proposal-class-properties": "^7.12.1", | ||
"@babel/plugin-proposal-decorators": "^7.12.12", | ||
"@babel/helper-plugin-utils": "^7.13.0", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/plugin-proposal-decorators": "^7.13.15", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.12.13", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", | ||
"@babel/plugin-proposal-numeric-separator": "^7.8.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1", | ||
"@babel/plugin-proposal-optional-catch-binding": "^7.8.3", | ||
"@babel/plugin-proposal-optional-chaining": "^7.9.0", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", | ||
"@babel/plugin-proposal-numeric-separator": "^7.12.13", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.13.8", | ||
"@babel/plugin-proposal-optional-catch-binding": "^7.13.8", | ||
"@babel/plugin-proposal-optional-chaining": "^7.13.12", | ||
"@babel/plugin-syntax-async-generators": "^7.8.4", | ||
"@babel/plugin-syntax-bigint": "^7.8.3", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/plugin-transform-classes": "^7.12.1", | ||
"@babel/plugin-transform-computed-properties": "^7.12.1", | ||
"@babel/plugin-transform-exponentiation-operator": "^7.12.1", | ||
"@babel/plugin-transform-jscript": "^7.12.1", | ||
"@babel/plugin-transform-member-expression-literals": "^7.12.1", | ||
"@babel/plugin-transform-parameters": "^7.12.1", | ||
"@babel/plugin-transform-property-literals": "^7.12.1", | ||
"@babel/plugin-transform-property-mutators": "^7.12.1", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@babel/plugin-transform-template-literals": "^7.12.1", | ||
"@babel/preset-env": "^7.12.11", | ||
"babel-plugin-dynamic-import-node": "^2.3.3", | ||
"fast-async": "^7.0.6" | ||
"@babel/plugin-transform-classes": "^7.13.0", | ||
"@babel/plugin-transform-computed-properties": "^7.13.0", | ||
"@babel/plugin-transform-exponentiation-operator": "^7.12.13", | ||
"@babel/plugin-transform-jscript": "^7.12.13", | ||
"@babel/plugin-transform-member-expression-literals": "^7.12.13", | ||
"@babel/plugin-transform-parameters": "^7.13.0", | ||
"@babel/plugin-transform-property-literals": "^7.12.13", | ||
"@babel/plugin-transform-property-mutators": "^7.12.13", | ||
"@babel/plugin-transform-runtime": "^7.13.15", | ||
"@babel/plugin-transform-template-literals": "^7.13.0", | ||
"@babel/preset-env": "^7.13.15", | ||
"babel-plugin-dynamic-import-node": "^2.3.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.14", | ||
"@babel/core": "7.13.15", | ||
@@ -70,12 +71,15 @@ "@babel/plugin-syntax-jsx": "7.12.13", | ||
"peerDependencies": { | ||
"@babel/core": "^7.12.10", | ||
"@babel/runtime": "^7.12.13" | ||
"@babel/core": "^7.13.15", | ||
"@babel/runtime": "^7.13.10" | ||
}, | ||
"optionalDependencies": { | ||
"@babel/plugin-syntax-jsx": "^7.12.13", | ||
"@babel/plugin-transform-typescript": "^7.12.1", | ||
"@babel/preset-react": "^7.12.10", | ||
"@babel/preset-typescript": "^7.12.7", | ||
"@babel/plugin-transform-typescript": "^7.13.0", | ||
"@babel/preset-react": "^7.13.13", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24" | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"publishConfig": { | ||
@@ -82,0 +86,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
31
Yes
23021
8
257
- Removedfast-async@^7.0.6
- Removedbabylon@7.0.0-beta.47(transitive)
- Removedfast-async@7.0.6(transitive)
- Removednodent-runtime@3.2.1(transitive)
- Removednodent-transform@3.2.9(transitive)
Updated@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8
Updated@babel/plugin-proposal-optional-catch-binding@^7.13.8
Updated@babel/plugin-transform-exponentiation-operator@^7.12.13
Updated@babel/plugin-transform-member-expression-literals@^7.12.13
Updated@babel/preset-env@^7.13.15