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

Update Babel to latest. #300

Merged
merged 1 commit into from
Jul 20, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const MergeTrees = require('broccoli-merge-trees');
const Babel = require('broccoli-babel-transpiler');
const Concat = require('broccoli-concat');
const typescript = require('broccoli-typescript-compiler').default;
const ensurePosix = require('ensure-posix-path');
const moduleResolver = require('amd-name-resolver').resolveModules({
throwOnRootAccess: false,
});

function findLib(name, libPath) {
let packagePath = path.join(name, 'package');
Expand All @@ -22,21 +26,24 @@ function getLibPath(packagePath) {
return path.dirname(packageJson['module'] || packageJson['main']);
}

function getRelativeModulePath(modulePath) {
return ensurePosix(path.relative(process.cwd(), modulePath));
}
getRelativeModulePath.baseDir = () => __dirname;

function resolveRelativeModulePath(name, child) {
return moduleResolver(name, getRelativeModulePath(child));
}
resolveRelativeModulePath.baseDir = () => __dirname;

function toAMD(tree) {
return new Babel(tree, {
presets: [
[
'env',
{
modules: 'amd',
targets: {
browsers: ['ie 9'],
},
},
],
],
resolveModuleSource: require('amd-name-resolver').moduleResolve,
moduleIds: true,
getModuleId: getRelativeModulePath,
plugins: [
['module-resolver', { resolvePath: resolveRelativeModulePath }],
['@babel/plugin-transform-modules-amd', { noInterop: true }],
],
});
}

Expand All @@ -49,17 +56,7 @@ module.exports = function () {
let amd = toAMD(eslatest);

let cjs = new Babel(eslatest, {
presets: [
[
'env',
{
modules: 'commonjs',
targets: {
node: 4,
},
},
],
],
plugins: [['@babel/plugin-transform-modules-commonjs']],
});

let trees = [
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@
],
"dependencies": {},
"devDependencies": {
"@babel/plugin-transform-modules-amd": "^7.10.5",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@types/node": "^12.7.5",
"@types/qunit": "^2.9.1",
"@typescript-eslint/eslint-plugin": "^3.7.0",
"@typescript-eslint/parser": "^3.7.0",
"babel-preset-env": "^1.7.0",
"backburner.js": "^2.6.0",
"broccoli-babel-transpiler": "^6.1.2",
"broccoli-babel-transpiler": "^7.6.0",
"broccoli-concat": "^4.2.4",
"broccoli-funnel": "^3.0.3",
"broccoli-merge-trees": "^4.2.0",
"broccoli-typescript-compiler": "^6.0.0",
"ember-cli": "~3.19.0",
"ensure-posix-path": "^1.1.1",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"ember-cli": "~3.19.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"prettier": "2.0.5",
Expand Down
Loading