Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[internal] Keep the .cjs extension when compiling source files #12820

Merged
merged 2 commits into from Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gulpfile.mjs
Expand Up @@ -11,6 +11,7 @@ import babel from "gulp-babel";
import camelCase from "lodash/camelCase.js";
import fancyLog from "fancy-log";
import filter from "gulp-filter";
import revertPath from "gulp-revert-path";
import gulp from "gulp";
import { rollup } from "rollup";
import { babel as rollupBabel } from "@rollup/plugin-babel";
Expand Down Expand Up @@ -229,6 +230,10 @@ function buildBabel(exclude) {
},
})
)
.pipe(
// gulp-babel always converts the extension to .js, but we want to keep the original one
revertPath()
)
.pipe(
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -54,6 +54,7 @@
"gulp-filter": "^5.1.0",
"gulp-newer": "^1.0.0",
"gulp-plumber": "^1.2.1",
"gulp-revert-path": "^2.0.0",
"husky": "^3.0.0",
"jest": "^26.6.1",
"lint-staged": "^9.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/config/pattern-to-regex.js
Expand Up @@ -2,7 +2,7 @@
import path from "path";

// $FlowIgnore
import escapeRegExp from "./helpers/escape-regexp";
import escapeRegExp from "./helpers/escape-regexp.cjs";

const sep = `\\${path.sep}`;
const endSep = `(?:${sep}|$)`;
Expand Down
Expand Up @@ -15,7 +15,7 @@ import path from "path";
import vm from "vm";
import checkDuplicatedNodes from "babel-check-duplicated-nodes";
import QuickLRU from "quick-lru";
import escapeRegExp from "./escape-regexp";
import escapeRegExp from "./escape-regexp.cjs";

const cachedScripts = new QuickLRU({ maxSize: 10 });
const contextModuleCache = new WeakMap();
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-register/src/node.js
Expand Up @@ -7,7 +7,7 @@ import { addHook } from "pirates";
import fs from "fs";
import path from "path";
import Module from "module";
import escapeRegExp from "./escape-regexp";
import escapeRegExp from "./escape-regexp.cjs";

const maps = {};
let transformOpts = {};
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Expand Up @@ -4851,6 +4851,7 @@ __metadata:
gulp-filter: ^5.1.0
gulp-newer: ^1.0.0
gulp-plumber: ^1.2.1
gulp-revert-path: ^2.0.0
husky: ^3.0.0
jest: ^26.6.1
lint-staged: ^9.2.0
Expand Down Expand Up @@ -7722,6 +7723,15 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"gulp-revert-path@npm:^2.0.0":
version: 2.0.0
resolution: "gulp-revert-path@npm:2.0.0"
dependencies:
through2: ^2.0.0
checksum: c2b01db2942c084f8cb11cecff22663a3ab894cdf43daed601bdaa9c713797e11739415b46f18342171fb0c65c1fe57d18dd40f93da403002e99f453b5661d77
languageName: node
linkType: hard

"gulp@npm:^4.0.2":
version: 4.0.2
resolution: "gulp@npm:4.0.2"
Expand Down