Use peerDep rather than plugin param for common APIs.

This commit is contained in:
Logan Smyth 2017-10-31 15:00:13 -07:00
parent 7dbed2170e
commit b19b66d94b
79 changed files with 141 additions and 115 deletions

View File

@ -1,7 +1,7 @@
import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding"; import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding";
import { types as t } from "@babel/core";
export default function(babel) { export default function() {
const { types: t } = babel;
return { return {
inherits: syntaxOptionalCatchBinding, inherits: syntaxOptionalCatchBinding,

View File

@ -146,7 +146,7 @@ const filterItems = (
}; };
export default function buildPreset( export default function buildPreset(
context: Object, api: Object,
opts: Object = {}, opts: Object = {},
): { plugins: Array<Plugin> } { ): { plugins: Array<Plugin> } {
const { const {

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
/** /**
* Helper function to run a statement before an expression by replacing it with a comma expression * Helper function to run a statement before an expression by replacing it with a comma expression
* and wrapping the statement in an IIFE as the first operand. * and wrapping the statement in an IIFE as the first operand.

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
pre(file) { pre(file) {
file.set("helpersNamespace", t.identifier("babelHelpers")); file.set("helpersNamespace", t.identifier("babelHelpers"));

View File

@ -1,7 +1,8 @@
import remapAsyncToGenerator from "@babel/helper-remap-async-to-generator"; import remapAsyncToGenerator from "@babel/helper-remap-async-to-generator";
import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators"; import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
const yieldStarVisitor = { const yieldStarVisitor = {
Function(path) { Function(path) {
path.skip(); path.skip();

View File

@ -10,8 +10,7 @@
], ],
"dependencies": { "dependencies": {
"@babel/helper-function-name": "7.0.0-beta.31", "@babel/helper-function-name": "7.0.0-beta.31",
"@babel/plugin-syntax-class-properties": "7.0.0-beta.31", "@babel/plugin-syntax-class-properties": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"

View File

@ -1,8 +1,8 @@
import nameFunction from "@babel/helper-function-name"; import nameFunction from "@babel/helper-function-name";
import template from "@babel/template";
import syntaxClassProperties from "@babel/plugin-syntax-class-properties"; import syntaxClassProperties from "@babel/plugin-syntax-class-properties";
import { template, types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const { loose } = options; const { loose } = options;
const findBareSupers = { const findBareSupers = {

View File

@ -12,8 +12,7 @@
"decorators" "decorators"
], ],
"dependencies": { "dependencies": {
"@babel/plugin-syntax-decorators": "7.0.0-beta.31", "@babel/plugin-syntax-decorators": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"

View File

@ -1,7 +1,7 @@
// Fork of https://github.com/loganfsmyth/babel-plugin-proposal-decorators-legacy // Fork of https://github.com/loganfsmyth/babel-plugin-proposal-decorators-legacy
import template from "@babel/template";
import syntaxDecorators from "@babel/plugin-syntax-decorators"; import syntaxDecorators from "@babel/plugin-syntax-decorators";
import { template, types as t } from "@babel/core";
const buildClassDecorator = template(` const buildClassDecorator = template(`
DECORATOR(CLASS_REF = INNER) || CLASS_REF; DECORATOR(CLASS_REF = INNER) || CLASS_REF;
@ -82,7 +82,7 @@ const buildApplyDecoratedDescriptor = template(`
} }
`); `);
export default function({ types: t }) { export default function() {
/** /**
* Add a helper to take an initial descriptor, apply some decorators to it, and optionally * Add a helper to take an initial descriptor, apply some decorators to it, and optionally
* define the property. * define the property.

View File

@ -1,6 +1,7 @@
import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions"; import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
inherits: syntaxExportExtensions, inherits: syntaxExportExtensions,

View File

@ -1,6 +1,7 @@
import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions"; import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
inherits: syntaxExportExtensions, inherits: syntaxExportExtensions,

View File

@ -1,6 +1,7 @@
import syntaxFunctionBind from "@babel/plugin-syntax-function-bind"; import syntaxFunctionBind from "@babel/plugin-syntax-function-bind";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function getTempId(scope) { function getTempId(scope) {
let id = scope.path.getData("functionBind"); let id = scope.path.getData("functionBind");
if (id) return id; if (id) return id;

View File

@ -1,7 +1,8 @@
import syntaxFunctionSent from "@babel/plugin-syntax-function-sent"; import syntaxFunctionSent from "@babel/plugin-syntax-function-sent";
import wrapFunction from "@babel/helper-wrap-function"; import wrapFunction from "@babel/helper-wrap-function";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
const isFunctionSent = node => const isFunctionSent = node =>
t.isIdentifier(node.meta, { name: "function" }) && t.isIdentifier(node.meta, { name: "function" }) &&
t.isIdentifier(node.property, { name: "sent" }); t.isIdentifier(node.property, { name: "sent" });

View File

@ -1,6 +1,7 @@
import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator"; import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator";
import { types as t } from "@babel/core";
export default function({ types: t }, { loose = false }) { export default function(api, { loose = false }) {
return { return {
inherits: syntaxNullishCoalescingOperator, inherits: syntaxNullishCoalescingOperator,

View File

@ -1,6 +1,7 @@
import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator"; import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function replaceNumberArg({ node }) { function replaceNumberArg({ node }) {
if (node.callee.name !== "Number") { if (node.callee.name !== "Number") {
return; return;

View File

@ -1,6 +1,7 @@
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function hasRestElement(path) { function hasRestElement(path) {
let foundRestElement = false; let foundRestElement = false;
path.traverse({ path.traverse({

View File

@ -1,6 +1,7 @@
import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining"; import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining";
import { types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const { loose = false } = options; const { loose = false } = options;
function optional(path, replacementPath) { function optional(path, replacementPath) {

View File

@ -1,6 +1,7 @@
import syntaxPipelineOperator from "@babel/plugin-syntax-pipeline-operator"; import syntaxPipelineOperator from "@babel/plugin-syntax-pipeline-operator";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
inherits: syntaxPipelineOperator, inherits: syntaxPipelineOperator,

View File

@ -1,6 +1,7 @@
import syntaxThrowExpressions from "@babel/plugin-syntax-throw-expressions"; import syntaxThrowExpressions from "@babel/plugin-syntax-throw-expressions";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
inherits: syntaxThrowExpressions, inherits: syntaxThrowExpressions,

View File

@ -1,6 +1,6 @@
import type NodePath from "@babel/traverse"; import type NodePath from "@babel/traverse";
export default function(babel, options) { export default function(api, options) {
const { spec } = options; const { spec } = options;
return { return {
visitor: { visitor: {

View File

@ -1,7 +1,8 @@
import remapAsyncToGenerator from "@babel/helper-remap-async-to-generator"; import remapAsyncToGenerator from "@babel/helper-remap-async-to-generator";
import { addNamed } from "@babel/helper-module-imports"; import { addNamed } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const { method, module } = options; const { method, module } = options;
if (method && module) { if (method && module) {

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
function statementList(key, path) { function statementList(key, path) {
const paths: Array = path.get(key); const paths: Array = path.get(key);

View File

@ -6,9 +6,6 @@
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"@babel/template": "7.0.0-beta.31",
"@babel/traverse": "7.0.0-beta.31",
"@babel/types": "7.0.0-beta.31",
"lodash": "^4.2.0" "lodash": "^4.2.0"
}, },
"keywords": [ "keywords": [

View File

@ -1,12 +1,10 @@
import type NodePath from "@babel/traverse"; import type NodePath from "@babel/traverse";
import type Scope from "@babel/traverse"; import type Scope from "@babel/traverse";
import type File from "../../../file"; import type File from "../../../file";
import traverse from "@babel/traverse";
import { visitor as tdzVisitor } from "./tdz"; import { visitor as tdzVisitor } from "./tdz";
import * as t from "@babel/types";
import values from "lodash/values"; import values from "lodash/values";
import extend from "lodash/extend"; import extend from "lodash/extend";
import template from "@babel/template"; import { traverse, template, types as t } from "@babel/core";
const DONE = new WeakSet(); const DONE = new WeakSet();

View File

@ -1,4 +1,4 @@
import * as t from "@babel/types"; import { types as t } from "@babel/core";
function getTDZStatus(refPath, bindingPath) { function getTDZStatus(refPath, bindingPath) {
const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath); const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath);

View File

@ -10,10 +10,7 @@
"@babel/helper-define-map": "7.0.0-beta.31", "@babel/helper-define-map": "7.0.0-beta.31",
"@babel/helper-function-name": "7.0.0-beta.31", "@babel/helper-function-name": "7.0.0-beta.31",
"@babel/helper-optimise-call-expression": "7.0.0-beta.31", "@babel/helper-optimise-call-expression": "7.0.0-beta.31",
"@babel/helper-replace-supers": "7.0.0-beta.31", "@babel/helper-replace-supers": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31",
"@babel/traverse": "7.0.0-beta.31",
"@babel/types": "7.0.0-beta.31"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"

View File

@ -2,8 +2,9 @@ import LooseTransformer from "./loose";
import VanillaTransformer from "./vanilla"; import VanillaTransformer from "./vanilla";
import annotateAsPure from "@babel/helper-annotate-as-pure"; import annotateAsPure from "@babel/helper-annotate-as-pure";
import nameFunction from "@babel/helper-function-name"; import nameFunction from "@babel/helper-function-name";
import { types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const { loose } = options; const { loose } = options;
const Constructor = loose ? LooseTransformer : VanillaTransformer; const Constructor = loose ? LooseTransformer : VanillaTransformer;

View File

@ -1,5 +1,5 @@
import type { Scope } from "@babel/traverse"; import type { Scope } from "@babel/traverse";
import * as t from "@babel/types"; import { types as t } from "@babel/core";
export default function( export default function(
decorators: Array<Object>, decorators: Array<Object>,

View File

@ -1,6 +1,6 @@
import nameFunction from "@babel/helper-function-name"; import nameFunction from "@babel/helper-function-name";
import VanillaTransformer from "./vanilla"; import VanillaTransformer from "./vanilla";
import * as t from "@babel/types"; import { types as t } from "@babel/core";
export default class LooseClassTransformer extends VanillaTransformer { export default class LooseClassTransformer extends VanillaTransformer {
constructor() { constructor() {

View File

@ -1,10 +1,8 @@
import type { NodePath } from "@babel/traverse"; import type { NodePath } from "@babel/traverse";
import { visitors } from "@babel/traverse";
import ReplaceSupers from "@babel/helper-replace-supers"; import ReplaceSupers from "@babel/helper-replace-supers";
import optimiseCall from "@babel/helper-optimise-call-expression"; import optimiseCall from "@babel/helper-optimise-call-expression";
import * as defineMap from "@babel/helper-define-map"; import * as defineMap from "@babel/helper-define-map";
import template from "@babel/template"; import { traverse, template, types as t } from "@babel/core";
import * as t from "@babel/types";
const noMethodVisitor = { const noMethodVisitor = {
"FunctionExpression|FunctionDeclaration"(path) { "FunctionExpression|FunctionDeclaration"(path) {
@ -16,7 +14,7 @@ const noMethodVisitor = {
}, },
}; };
const verifyConstructorVisitor = visitors.merge([ const verifyConstructorVisitor = traverse.visitors.merge([
noMethodVisitor, noMethodVisitor,
{ {
MemberExpression: { MemberExpression: {
@ -63,7 +61,7 @@ const verifyConstructorVisitor = visitors.merge([
}, },
]); ]);
const findThisesVisitor = visitors.merge([ const findThisesVisitor = traverse.visitors.merge([
noMethodVisitor, noMethodVisitor,
{ {
ThisExpression(path) { ThisExpression(path) {

View File

@ -8,9 +8,6 @@
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
], ],
"dependencies": {
"@babel/template": "7.0.0-beta.31"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"
}, },

View File

@ -1,4 +1,6 @@
export default function({ types: t, template }, options) { import { template, types as t } from "@babel/core";
export default function(api, options) {
const { loose } = options; const { loose } = options;
const pushComputedProps = loose const pushComputedProps = loose
? pushComputedPropsLoose ? pushComputedPropsLoose

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
/** /**
* Test if a VariableDeclaration's declarations contains any Patterns. * Test if a VariableDeclaration's declarations contains any Patterns.
*/ */

View File

@ -8,9 +8,6 @@
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
], ],
"dependencies": {
"@babel/types": "7.0.0-beta.31"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"
}, },

View File

@ -1,4 +1,4 @@
import * as t from "@babel/types"; import { types as t } from "@babel/core";
function getName(key) { function getName(key) {
if (t.isIdentifier(key)) { if (t.isIdentifier(key)) {

View File

@ -1,6 +1,7 @@
import build from "@babel/helper-builder-binary-assignment-operator-visitor"; import build from "@babel/helper-builder-binary-assignment-operator-visitor";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
visitor: build({ visitor: build({
operator: "**", operator: "**",

View File

@ -1,6 +1,7 @@
import syntaxFlow from "@babel/plugin-syntax-flow"; import syntaxFlow from "@babel/plugin-syntax-flow";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function wrapInFlowComment(path, parent) { function wrapInFlowComment(path, parent) {
let attach = path.getPrevSibling(); let attach = path.getPrevSibling();
let where = "trailing"; let where = "trailing";

View File

@ -1,6 +1,7 @@
import syntaxFlow from "@babel/plugin-syntax-flow"; import syntaxFlow from "@babel/plugin-syntax-flow";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
const FLOW_DIRECTIVE = "@flow"; const FLOW_DIRECTIVE = "@flow";
let skipStrip = false; let skipStrip = false;

View File

@ -1,4 +1,6 @@
export default function({ template, types: t }, options) { import { template, types as t } from "@babel/core";
export default function(api, options) {
const { loose } = options; const { loose } = options;
const pushComputedProps = loose const pushComputedProps = loose
? pushComputedPropsLoose ? pushComputedPropsLoose

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
BinaryExpression(path) { BinaryExpression(path) {

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
FunctionExpression: { FunctionExpression: {

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
MemberExpression: { MemberExpression: {

View File

@ -6,8 +6,7 @@
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-module-transforms": "7.0.0-beta.31", "@babel/helper-module-transforms": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"

View File

@ -1,4 +1,3 @@
import template from "@babel/template";
import { import {
isModule, isModule,
rewriteModuleStatementsAndPrepareHeader, rewriteModuleStatementsAndPrepareHeader,
@ -8,13 +7,14 @@ import {
ensureStatementsHoisted, ensureStatementsHoisted,
wrapInterop, wrapInterop,
} from "@babel/helper-module-transforms"; } from "@babel/helper-module-transforms";
import { template, types as t } from "@babel/core";
const buildWrapper = template(` const buildWrapper = template(`
define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) { define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {
}) })
`); `);
export default function({ types: t }, options) { export default function(api, options) {
const { loose, allowTopLevelThis, strict, strictMode, noInterop } = options; const { loose, allowTopLevelThis, strict, strictMode, noInterop } = options;
return { return {
visitor: { visitor: {

View File

@ -7,8 +7,9 @@ import {
wrapInterop, wrapInterop,
} from "@babel/helper-module-transforms"; } from "@babel/helper-module-transforms";
import simplifyAccess from "@babel/helper-simple-access"; import simplifyAccess from "@babel/helper-simple-access";
import { template, types as t } from "@babel/core";
export default function({ types: t, template }, options) { export default function(api, options) {
const { const {
loose, loose,
allowTopLevelThis, allowTopLevelThis,

View File

@ -6,8 +6,7 @@
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-hoist-variables": "7.0.0-beta.31", "@babel/helper-hoist-variables": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"

View File

@ -1,5 +1,5 @@
import hoistVariables from "@babel/helper-hoist-variables"; import hoistVariables from "@babel/helper-hoist-variables";
import template from "@babel/template"; import { template, types as t } from "@babel/core";
const buildTemplate = template(` const buildTemplate = template(`
SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) { SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {
@ -22,7 +22,7 @@ const buildExportAll = template(`
const TYPE_IMPORT = "Import"; const TYPE_IMPORT = "Import";
export default function({ types: t }, options) { export default function(api, options) {
const { systemGlobal = "System" } = options; const { systemGlobal = "System" } = options;
const IGNORE_REASSIGNMENT_SYMBOL = Symbol(); const IGNORE_REASSIGNMENT_SYMBOL = Symbol();

View File

@ -6,8 +6,7 @@
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-module-transforms": "7.0.0-beta.31", "@babel/helper-module-transforms": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"

View File

@ -1,5 +1,4 @@
import { basename, extname } from "path"; import { basename, extname } from "path";
import template from "@babel/template";
import { import {
isModule, isModule,
rewriteModuleStatementsAndPrepareHeader, rewriteModuleStatementsAndPrepareHeader,
@ -9,6 +8,7 @@ import {
ensureStatementsHoisted, ensureStatementsHoisted,
wrapInterop, wrapInterop,
} from "@babel/helper-module-transforms"; } from "@babel/helper-module-transforms";
import { types as t, template } from "@babel/core";
const buildPrerequisiteAssignment = template(` const buildPrerequisiteAssignment = template(`
GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}
@ -30,7 +30,7 @@ const buildWrapper = template(`
}) })
`); `);
export default function({ types: t }, options) { export default function(api, options) {
const { const {
globals, globals,
exactGlobals, exactGlobals,

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
name: "transform-new-target", name: "transform-new-target",

View File

@ -1,4 +1,5 @@
import ReplaceSupers from "@babel/helper-replace-supers"; import ReplaceSupers from "@babel/helper-replace-supers";
import { types as t } from "@babel/core";
function replacePropertySuper(path, node, scope, getObjectRef, file) { function replacePropertySuper(path, node, scope, getObjectRef, file) {
const replaceSupers = new ReplaceSupers({ const replaceSupers = new ReplaceSupers({
@ -13,7 +14,7 @@ function replacePropertySuper(path, node, scope, getObjectRef, file) {
replaceSupers.replace(); replaceSupers.replace();
} }
export default function({ types: t }) { export default function() {
return { return {
visitor: { visitor: {
ObjectExpression(path, state) { ObjectExpression(path, state) {

View File

@ -7,10 +7,7 @@
"main": "lib/index.js", "main": "lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-call-delegate": "7.0.0-beta.31", "@babel/helper-call-delegate": "7.0.0-beta.31",
"@babel/helper-get-function-arity": "7.0.0-beta.31", "@babel/helper-get-function-arity": "7.0.0-beta.31"
"@babel/template": "7.0.0-beta.31",
"@babel/traverse": "7.0.0-beta.31",
"@babel/types": "7.0.0-beta.31"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"

View File

@ -1,7 +1,7 @@
import convertFunctionParams from "./params"; import convertFunctionParams from "./params";
import convertFunctionRest from "./rest"; import convertFunctionRest from "./rest";
export default function(babel, options) { export default function(api, options) {
const { loose } = options; const { loose } = options;
return { return {
visitor: { visitor: {

View File

@ -1,6 +1,5 @@
import callDelegate from "@babel/helper-call-delegate"; import callDelegate from "@babel/helper-call-delegate";
import template from "@babel/template"; import { template, types as t } from "@babel/core";
import * as t from "@babel/types";
const buildDefaultParam = template(` const buildDefaultParam = template(`
let VARIABLE_NAME = let VARIABLE_NAME =

View File

@ -1,5 +1,4 @@
import template from "@babel/template"; import { template, types as t } from "@babel/core";
import * as t from "@babel/types";
const buildRest = template(` const buildRest = template(`
for (var LEN = ARGUMENTS.length, for (var LEN = ARGUMENTS.length,

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
ObjectProperty: { ObjectProperty: {

View File

@ -1,6 +1,7 @@
import * as defineMap from "@babel/helper-define-map"; import * as defineMap from "@babel/helper-define-map";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
visitor: { visitor: {
ObjectExpression(path, file) { ObjectExpression(path, file) {

View File

@ -1,6 +1,7 @@
import pull from "lodash/pull"; import pull from "lodash/pull";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function isProtoKey(node) { function isProtoKey(node) {
return t.isLiteral(t.toComputedKey(node, node.key), { value: "__proto__" }); return t.isLiteral(t.toComputedKey(node, node.key), { value: "__proto__" });
} }

View File

@ -1,4 +1,6 @@
export default function transformReactConstantElement({ types: t }, options) { import { types as t } from "@babel/core";
export default function transformReactConstantElement(api, options) {
const { allowMutablePropsOnTags } = options; const { allowMutablePropsOnTags } = options;
if ( if (

View File

@ -1,6 +1,7 @@
import path from "path"; import path from "path";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function addDisplayName(id, call) { function addDisplayName(id, call) {
const props = call.arguments[0].properties; const props = call.arguments[0].properties;
let safe = true; let safe = true;

View File

@ -1,6 +1,7 @@
import helper from "@babel/helper-builder-react-jsx"; import helper from "@babel/helper-builder-react-jsx";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
function hasRefOrSpread(attrs) { function hasRefOrSpread(attrs) {
for (let i = 0; i < attrs.length; i++) { for (let i = 0; i < attrs.length; i++) {
const attr = attrs[i]; const attr = attrs[i];

View File

@ -1,6 +1,7 @@
import helper from "@babel/helper-builder-react-jsx"; import helper from "@babel/helper-builder-react-jsx";
import { types as t } from "@babel/core";
export default function({ types: t }) { export default function() {
return { return {
manipulateOptions(opts, parserOpts) { manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("jsx"); parserOpts.plugins.push("jsx");

View File

@ -11,10 +11,11 @@
* *
* <sometag __self={this} /> * <sometag __self={this} />
*/ */
import { types as t } from "@babel/core";
const TRACE_ID = "__self"; const TRACE_ID = "__self";
export default function({ types: t }) { export default function() {
const visitor = { const visitor = {
JSXOpeningElement({ node }) { JSXOpeningElement({ node }) {
const id = t.jSXIdentifier(TRACE_ID); const id = t.jSXIdentifier(TRACE_ID);

View File

@ -12,11 +12,12 @@
* var __jsxFileName = 'this/file.js'; * var __jsxFileName = 'this/file.js';
* <sometag __source={{fileName: __jsxFileName, lineNumber: 10}}/> * <sometag __source={{fileName: __jsxFileName, lineNumber: 10}}/>
*/ */
import { types as t } from "@babel/core";
const TRACE_ID = "__source"; const TRACE_ID = "__source";
const FILE_NAME_VAR = "_jsxFileName"; const FILE_NAME_VAR = "_jsxFileName";
export default function({ types: t }) { export default function() {
function makeTrace(fileNameIdentifier, lineNumber) { function makeTrace(fileNameIdentifier, lineNumber) {
const fileLineLiteral = const fileLineLiteral =
lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral(); lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral();

View File

@ -1,7 +1,8 @@
import jsx from "@babel/plugin-syntax-jsx"; import jsx from "@babel/plugin-syntax-jsx";
import helper from "@babel/helper-builder-react-jsx"; import helper from "@babel/helper-builder-react-jsx";
import { types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const THROW_IF_NAMESPACE = const THROW_IF_NAMESPACE =
options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace; options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace;

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
"BindingIdentifier|ReferencedIdentifier"(path) { "BindingIdentifier|ReferencedIdentifier"(path) {

View File

@ -1,8 +1,9 @@
import { addDefault, isModule } from "@babel/helper-module-imports"; import { addDefault, isModule } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";
import definitions from "./definitions"; import definitions from "./definitions";
export default function({ types: t }, options) { export default function(api, options) {
const { const {
helpers, helpers,
moduleName = "@babel/runtime", moduleName = "@babel/runtime",

View File

@ -8,9 +8,6 @@
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
], ],
"dependencies": {
"@babel/types": "7.0.0-beta.31"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"
}, },

View File

@ -1,4 +1,4 @@
import * as t from "@babel/types"; import { types as t } from "@babel/core";
export default function() { export default function() {
return { return {

View File

@ -1,4 +1,6 @@
export default function({ types: t }, options) { import { types as t } from "@babel/core";
export default function(api, options) {
const { loose } = options; const { loose } = options;
function getSpreadLiteral(spread, scope) { function getSpreadLiteral(spread, scope) {

View File

@ -9,8 +9,7 @@
"babel-plugin" "babel-plugin"
], ],
"dependencies": { "dependencies": {
"@babel/helper-regex": "7.0.0-beta.31", "@babel/helper-regex": "7.0.0-beta.31"
"@babel/types": "7.0.0-beta.31"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"

View File

@ -1,5 +1,5 @@
import * as regex from "@babel/helper-regex"; import * as regex from "@babel/helper-regex";
import * as t from "@babel/types"; import { types as t } from "@babel/core";
export default function() { export default function() {
return { return {

View File

@ -8,9 +8,6 @@
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
], ],
"dependencies": {
"@babel/types": "7.0.0-beta.31"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "7.0.0-beta.31" "@babel/core": "7.0.0-beta.31"
}, },

View File

@ -1,4 +1,4 @@
import * as t from "@babel/types"; import { types as t } from "@babel/core";
export default function() { export default function() {
return { return {

View File

@ -1,6 +1,7 @@
import annotateAsPure from "@babel/helper-annotate-as-pure"; import annotateAsPure from "@babel/helper-annotate-as-pure";
import { types as t } from "@babel/core";
export default function({ types: t }, options) { export default function(api, options) {
const { loose } = options; const { loose } = options;
let helperName = "taggedTemplateLiteral"; let helperName = "taggedTemplateLiteral";

View File

@ -1,4 +1,6 @@
export default function({ types: t }) { import { types as t } from "@babel/core";
export default function() {
return { return {
visitor: { visitor: {
Scope({ scope }) { Scope({ scope }) {

View File

@ -1,4 +1,5 @@
import syntaxTypeScript from "@babel/plugin-syntax-typescript"; import syntaxTypeScript from "@babel/plugin-syntax-typescript";
import { types as t } from "@babel/core";
import transpileEnum from "./enum"; import transpileEnum from "./enum";
@ -18,7 +19,7 @@ interface State {
programPath: any; programPath: any;
} }
export default function({ types: t }) { export default function() {
return { return {
inherits: syntaxTypeScript, inherits: syntaxTypeScript,
visitor: { visitor: {

View File

@ -24,7 +24,7 @@ import transformES2015ModulesUMD from "@babel/plugin-transform-modules-umd";
import transformES2015Instanceof from "@babel/plugin-transform-instanceof"; import transformES2015Instanceof from "@babel/plugin-transform-instanceof";
import transformRegenerator from "@babel/plugin-transform-regenerator"; import transformRegenerator from "@babel/plugin-transform-regenerator";
export default function(context, opts = {}) { export default function(api, opts = {}) {
const moduleTypes = ["commonjs", "amd", "umd", "systemjs"]; const moduleTypes = ["commonjs", "amd", "umd", "systemjs"];
let loose = false; let loose = false;
let modules = "commonjs"; let modules = "commonjs";

View File

@ -4,7 +4,7 @@ import transformReactDisplayName from "@babel/plugin-transform-react-display-nam
import transformReactJSXSource from "@babel/plugin-transform-react-jsx-source"; import transformReactJSXSource from "@babel/plugin-transform-react-jsx-source";
import transformReactJSXSelf from "@babel/plugin-transform-react-jsx-self"; import transformReactJSXSelf from "@babel/plugin-transform-react-jsx-self";
export default function(context, opts = {}) { export default function(api, opts = {}) {
const pragma = opts.pragma || "React.createElement"; const pragma = opts.pragma || "React.createElement";
const pragmaFrag = opts.pragmaFrag || "React.Fragment"; const pragmaFrag = opts.pragmaFrag || "React.Fragment";
const throwIfNamespace = const throwIfNamespace =