Skip to content

Commit

Permalink
Only when publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 18, 2023
1 parent d87cb12 commit 1169375
Show file tree
Hide file tree
Showing 108 changed files with 758 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { shouldTransform } from "./util.ts";

export default declare(api => {
api.assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.16.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.16.0"
: "^7.16.0",
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import type { NodePath } from "@babel/traverse";
import type * as t from "@babel/types";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

const noDocumentAll = api.assumption("noDocumentAll") ?? false;
const pureGetters = api.assumption("pureGetters") ?? false;
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-external-helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ export interface Options {
}

export default declare((api, options: Options) => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

const { helperVersion = "7.0.0-beta.0", whitelist = false } = options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import type * as t from "@babel/types";

export default declare(({ types: t, assertVersion }) => {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.13.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.13.0"
: "^7.13.0",
);

return {
Expand Down
14 changes: 12 additions & 2 deletions packages/babel-plugin-proposal-decorators/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ interface Options extends SyntaxOptions {
export type { Options };

export default declare((api, options: Options) => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

// Options are validated in @babel/plugin-syntax-decorators
if (!process.env.BABEL_8_BREAKING) {
Expand Down Expand Up @@ -46,7 +52,11 @@ export default declare((api, options: Options) => {
return transformer2023_05(api, options, version);
} else if (!process.env.BABEL_8_BREAKING) {
api.assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.0.2",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.0.2"
: "^7.0.2",
);
return createClassFeaturePlugin({
name: "proposal-decorators",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,20 +1188,36 @@ export default function (
): PluginObject {
if (process.env.BABEL_8_BREAKING) {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.21.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.21.0"
: "^7.21.0",
);
} else {
if (version === "2023-05" || version === "2023-01") {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.21.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.21.0"
: "^7.21.0",
);
} else if (version === "2021-12") {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.16.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.16.0"
: "^7.16.0",
);
} else {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.19.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.19.0"
: "^7.19.0",
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import type * as t from "@babel/types";

export default declare(function ({ assertVersion, assumption, types: t }) {
assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.17.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.17.0"
: "^7.17.0",
);
const {
assignmentExpression,
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-proposal-do-expressions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { declare } from "@babel/helper-plugin-utils";
import syntaxDoExpressions from "@babel/plugin-syntax-do-expressions";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "proposal-do-expressions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export interface Options {

export default declare((api, options: Options) => {
api.assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.19.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.19.0"
: "^7.19.0",
);

const { runtime } = options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const enum USING_KIND {

export default declare(api => {
api.assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.22.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.22.0"
: "^7.22.0",
);

const TOP_LEVEL_USING = new Map<t.Node, USING_KIND>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import syntaxExportDefaultFrom from "@babel/plugin-syntax-export-default-from";
import { types as t } from "@babel/core";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "proposal-export-default-from",
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-proposal-function-bind/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { types as t } from "@babel/core";
import type { Scope } from "@babel/traverse";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

function getTempId(scope: Scope) {
let id = scope.path.getData("functionBind");
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-proposal-function-sent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { types as t } from "@babel/core";
import type { Visitor } from "@babel/traverse";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

const isFunctionSent = (node: t.MetaProperty) =>
t.isIdentifier(node.meta, { name: "function" }) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import type * as t from "@babel/types";
import syntaxImportAttributes from "@babel/plugin-syntax-import-attributes";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "proposal-import-attributes-to-assertions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { types as t } from "@babel/core";
import type { Scope } from "@babel/traverse";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

/**
* a function to figure out if a call expression has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ const visitorsPerProposal = {
};

export default declare((api, options: Options) => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

const { proposal } = options;

Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-proposal-record-and-tuple/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ type Cache = Map<string, string>;
type ImportCache = WeakMap<t.Program, Cache>;

export default declare<State>((api, options: Options) => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

const polyfillModuleName = v.validateStringOption(
"polyfillModuleName",
Expand Down
6 changes: 5 additions & 1 deletion packages/babel-plugin-proposal-regexp-modifiers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { declare } from "@babel/helper-plugin-utils";

export default declare(api => {
api.assertVersion(
process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : "^7.19.0",
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: "^7.19.0"
: "^7.19.0",
);

return createRegExpFeaturePlugin({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import syntaxThrowExpressions from "@babel/plugin-syntax-throw-expressions";
import { types as t } from "@babel/core";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "proposal-throw-expressions",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { declare } from "@babel/helper-plugin-utils";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "syntax-async-do-expressions",
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-syntax-decimal/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { declare } from "@babel/helper-plugin-utils";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "syntax-decimal",
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-syntax-decorators/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ export interface Options {
}

export default declare((api, options: Options) => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

let { version } = options;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { declare } from "@babel/helper-plugin-utils";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "syntax-destructuring-private",
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-plugin-syntax-do-expressions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { declare } from "@babel/helper-plugin-utils";

export default declare(api => {
api.assertVersion(process.env.BABEL_8_BREAKING ? PACKAGE_JSON.version : 7);
api.assertVersion(
process.env.BABEL_8_BREAKING
? process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7
: 7,
);

return {
name: "syntax-do-expressions",
Expand Down
Loading

0 comments on commit 1169375

Please sign in to comment.