Skip to content

Commit

Permalink
Only bundle in production
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Nov 18, 2021
1 parent 1684596 commit 6b1e33d
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 25 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Expand Up @@ -75,6 +75,7 @@ module.exports = {
{ json: "always", js: "always", cjs: "always", mjs: "always" },
],
"import/no-extraneous-dependencies": "off",
"no-restricted-imports": ["error", { patterns: ["**/src/**"] }],
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -18,7 +18,7 @@ NODE := $(YARN) node

.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap

build: build-bundle
build: build-no-bundle
ifneq ("$(BABEL_COVERAGE)", "true")
$(MAKE) build-standalone
endif
Expand All @@ -28,8 +28,8 @@ build-bundle: clean clean-lib
$(MAKE) build-flow-typings
$(MAKE) build-dist

build-bundle-ci: bootstrap-only
$(MAKE) build-bundle
build-ci: bootstrap-only
$(MAKE) build-no-bundle

generate-tsconfig:
$(NODE) scripts/generators/tsconfig.js
Expand All @@ -46,7 +46,7 @@ build-typescript-legacy-typings:

build-standalone: build-babel-standalone

build-standalone-ci: build-bundle-ci
build-standalone-ci: build-ci
$(MAKE) build-standalone

build-babel-standalone:
Expand Down
13 changes: 0 additions & 13 deletions jest.config.js
@@ -1,17 +1,5 @@
const supportsESM = parseInt(process.versions.node) >= 12;

// These tests files are directly importing `src` files rather than the compiled versions
const importsSrc = [
"packages/babel-parser/test/unit/tokenizer/types.js",
"packages/babel-parser/test/unit/util/identifier.js",
"packages/babel-parser/test/unit/util/location.js",
"packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/test/util.test.js",
"packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining/test/util.test.js",
"packages/babel-plugin-proposal-optional-chaining/test/util.test.js",
"packages/babel-preset-react/test/normalize-options.spec.js",
"packages/babel-preset-typescript/test/normalize-options.spec.js",
];

module.exports = {
runner: supportsESM ? "./test/jest-light-runner" : "jest-runner",

Expand All @@ -37,7 +25,6 @@ module.exports = {
"<rootDir>/build/",
"<rootDir>/.history/", // local directory for VSCode Extension - https://marketplace.visualstudio.com/items?itemName=xyz.local-history
"_browser\\.js",
...(supportsESM ? importsSrc : []),
],
testEnvironment: "node",
setupFilesAfterEnv: ["<rootDir>/test/testSetupFile.js"],
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/test/unit/tokenizer/types.js
@@ -1,4 +1,4 @@
import { tt, tokenOperatorPrecedence } from "../../../src/tokenizer/types.js";
import { tt, tokenOperatorPrecedence } from "../../../lib/tokenizer/types.js";

describe("token types", () => {
it("should check if the binOp for relational === in", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/test/unit/util/identifier.js
@@ -1,7 +1,7 @@
import {
isKeyword,
keywordRelationalOperator,
} from "../../../src/util/identifier.js";
} from "../../../lib/util/identifier.js";

describe("identifier", () => {
describe("isKeyword", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/test/unit/util/location.js
@@ -1,4 +1,4 @@
import { getLineInfo } from "../../../src/util/location.js";
import { getLineInfo } from "../../../lib/util/location.js";

describe("getLineInfo", () => {
const input = "a\nb\nc\nd\ne\nf\ng\nh\ni";
Expand Down
@@ -1,5 +1,5 @@
import { parseSync, traverse } from "@babel/core";
import { shouldTransform } from "../src/util.ts";
import { shouldTransform } from "../lib/util.js";

function getPath(input, parserOpts = {}) {
let targetPath;
Expand Down
@@ -1,5 +1,5 @@
import { parseSync, traverse } from "@babel/core";
import { shouldTransform } from "../src/util.ts";
import { shouldTransform } from "../lib/util.js";

function getPath(input, parserOpts = {}) {
let targetPath;
Expand Down
@@ -1,4 +1,4 @@
import { willPathCastToBoolean } from "../src/util.js";
import { willPathCastToBoolean } from "../lib/util.js";
import { parseSync, traverse } from "@babel/core";

function getPath(input, parserOpts) {
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-preset-react/test/normalize-options.spec.js
@@ -1,4 +1,6 @@
import normalizeOptions from "../src/normalize-options.js";
import _normalizeOptions from "../lib/normalize-options.js";
const normalizeOptions = _normalizeOptions.default;

describe("normalize options", () => {
(process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => {
it("should throw on unknown options", () => {
Expand Down
@@ -1,4 +1,6 @@
import normalizeOptions from "../src/normalize-options.js";
import _normalizeOptions from "../lib/normalize-options.js";
const normalizeOptions = _normalizeOptions.default;

describe("normalize options", () => {
(process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => {
it("should throw on unknown options", () => {
Expand Down

0 comments on commit 6b1e33d

Please sign in to comment.