Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
207a8cd
upgrade babel
aminya Jun 21, 2020
be9c21b
optional-chaining plugin
aminya Jun 21, 2020
81e2fe4
async-to-generator
aminya Jun 21, 2020
2cd409d
upgrade babel in script/package-json
aminya Jun 21, 2020
f169f61
Update babel-eslint
aminya Jun 29, 2020
c4c377a
add babel react and flow.
aminya Jun 29, 2020
4e85453
babel proposal plugins to replace the old stage-0 plugin
aminya Jun 29, 2020
93a4f0b
fix remaining 'babel-core's
aminya Jul 6, 2020
5062a9f
remove async to generator
aminya Jul 26, 2020
c979ca2
add explicit node and eslmodules target
aminya Jul 26, 2020
84eb6c5
use babel-plugin-add-module-exports
aminya Jul 30, 2020
77fabfb
use babel-preset-atomic
aminya Jul 31, 2020
cdf96a4
declare the whole `@babel` `babel-preset` packages as external
aminya Jul 31, 2020
a1bca32
declare core, cli and preset as external
aminya Jul 31, 2020
a24528d
require preset in a function
aminya Jul 31, 2020
988d8f5
remove babel cli
aminya Aug 5, 2020
4cbb110
external babel everything
aminya Aug 5, 2020
91bb420
commit things temporarily
aminya Aug 5, 2020
cfbd2ca
require babel-preset-atomic
aminya Sep 1, 2020
389d81a
require babel config lazily
aminya Sep 1, 2020
9bbb4c1
simplify babel external declaration
aminya Sep 1, 2020
eacb2e6
Include @babel/runtime in the snapshot
aminya Sep 7, 2020
5d563cd
revert @babel installation in scripts
aminya Sep 7, 2020
35849af
use babel-preset-atomic 2.4.2
aminya Sep 12, 2020
f7abb63
add 'not strict' to spec/update-process-env-spec.js
aminya Sep 12, 2020
f5b0ef3
remove all use-strict
aminya Sep 18, 2020
c0fcde3
use transformSync
aminya Sep 23, 2020
684fa16
update babel-preset-atomic to 2.5.4
aminya Oct 22, 2020
0db3075
update @babel/core to 7.12.3
aminya Oct 22, 2020
9eb177a
update babel-preset-atomic to 2.6.1
aminya Oct 31, 2020
cdd8dbd
update babel-preset-atomic to 2.7.0
aminya Oct 31, 2020
a925bb9
mak require babel.config static
aminya Oct 31, 2020
a960bc4
move not strict in update process env
aminya Oct 31, 2020
5758609
update to babel-preset-atomic 3
aminya Oct 31, 2020
f2d918a
use specific trigers
aminya Oct 31, 2020
3d6afe9
make ES transform explicit
aminya Oct 31, 2020
1774c89
Update package-lock.json
aminya Nov 26, 2020
9a77508
Merge branch 'master' into pr/67
aminya Jun 30, 2022
20a0152
fix: update babel-preset-atomic to the latest version
aminya Jun 30, 2022
eb56872
fix: exclude supports-color from the snapshot
aminya Jun 30, 2022
2f0cbde
Merge branch 'master' into pr/67
aminya Jul 1, 2022
8a19065
fix: set the options by setting the config file
aminya Jul 2, 2022
7c6559f
fix: fix the incorrect jsx comment ending
aminya Jul 2, 2022
2bb3e6f
fix: target electron 11 in babel
aminya Jul 2, 2022
fb88032
test: fix the babel spy in the spec
aminya Jul 2, 2022
adcb402
test: spy on the actual compile function instead of spying on Babel
aminya Jul 3, 2022
3177d3e
fix: update find-and-replace to v0.220.0
aminya Jul 4, 2022
7779121
Merge branch 'find-and-replace' into pr/67
aminya Jul 4, 2022
4db8e31
fix: update find-and-replace to v0.220.1
aminya Jul 4, 2022
a241502
Merge branch 'find-and-replace' into pr/67
aminya Jul 4, 2022
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
4,531 changes: 3,681 additions & 850 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"@atom/nsfw": "^1.0.28",
"@atom/source-map-support": "^0.3.4",
"@atom/watcher": "^1.3.5",
"@babel/core": "7.18.6",
"babel-preset-atomic": "^5.0.0",
"about": "file:packages/about",
"archive-view": "https://www.atom.io/api/packages/archive-view/versions/0.66.0/tarball",
"async": "3.2.0",
Expand All @@ -34,7 +36,6 @@
"autocomplete-snippets": "https://www.atom.io/api/packages/autocomplete-snippets/versions/1.12.1/tarball",
"autoflow": "file:packages/autoflow",
"autosave": "https://www.atom.io/api/packages/autosave/versions/0.24.6/tarball",
"babel-core": "5.8.38",
"background-tips": "https://www.atom.io/api/packages/background-tips/versions/0.28.0/tarball",
"base16-tomorrow-dark-theme": "file:packages/base16-tomorrow-dark-theme",
"base16-tomorrow-light-theme": "file:packages/base16-tomorrow-light-theme",
Expand All @@ -58,7 +59,7 @@
"etch": "0.14.1",
"event-kit": "^2.5.3",
"exception-reporting": "file:packages/exception-reporting",
"find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.219.8/tarball",
"find-and-replace": "https://github.com/atom-community/find-and-replace/archive/refs/tags/v0.220.1.tar.gz",
"find-parent-dir": "^0.3.0",
"first-mate": "7.4.3",
"focus-trap": "6.3.0",
Expand Down Expand Up @@ -203,7 +204,7 @@
"dev-live-reload": "file:./packages/dev-live-reload",
"encoding-selector": "0.23.9",
"exception-reporting": "file:./packages/exception-reporting",
"find-and-replace": "0.219.8",
"find-and-replace": "https://github.com/atom-community/find-and-replace/archive/refs/tags/v0.220.1.tar.gz",
"fuzzy-finder": "1.14.3",
"github": "0.36.10",
"git-diff": "file:./packages/git-diff",
Expand Down
2 changes: 1 addition & 1 deletion packages/welcome/lib/guide-view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @babel */
/** @jsx etch.dom **/
/** @jsx etch.dom */

import etch from 'etch';

Expand Down
2 changes: 1 addition & 1 deletion packages/welcome/lib/welcome-view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @babel */
/** @jsx etch.dom **/
/** @jsx etch.dom */

import etch from 'etch';

Expand Down
10 changes: 8 additions & 2 deletions script/lib/generate-startup-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@ module.exports = function(packagedAppPath) {
'lib',
'command-event.js'
) ||
requiredModuleRelativePath ===
path.join('..', 'node_modules', 'babel-core', 'index.js') ||
(requiredModuleRelativePath.includes('@babel') &&
// GitHub package uses this in its relay dependency which is required on startup
!requiredModuleRelativePath.includes(
path.join('@babel', 'runtime')
)) ||
requiredModuleRelativePath.includes('babel-plugin') ||
requiredModuleRelativePath.includes('babel-preset') ||
requiredModuleRelativePath.includes('supports-color') ||
requiredModuleRelativePath ===
path.join('..', 'node_modules', 'debug', 'node.js') ||
requiredModuleRelativePath ===
Expand Down
8 changes: 4 additions & 4 deletions spec/compile-cache-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
path = require 'path'
temp = require('temp').track()
Babel = require 'babel-core'
babelCompiler = require '../src/babel'
CoffeeScript = require 'coffee-script'
{TypeScriptSimple} = require 'typescript-simple'
CSON = require 'season'
Expand All @@ -16,7 +16,7 @@ describe 'CompileCache', ->
CSON.setCacheDir(null)
CompileCache.resetCacheStats()

spyOn(Babel, 'transform').andReturn {code: 'the-babel-code'}
spyOn(babelCompiler, 'compile')
spyOn(CoffeeScript, 'compile').andReturn 'the-coffee-code'
spyOn(TypeScriptSimple::, 'compile').andReturn 'the-typescript-code'

Expand All @@ -36,11 +36,11 @@ describe 'CompileCache', ->
it 'compiles the file with babel and caches it', ->
CompileCache.addPathToCache(path.join(fixtures, 'babel', 'babel-comment.js'), atomHome)
expect(CompileCache.getCacheStats()['.js']).toEqual {hits: 0, misses: 1}
expect(Babel.transform.callCount).toBe 1
expect(babelCompiler.compile.callCount).toBe 1

CompileCache.addPathToCache(path.join(fixtures, 'babel', 'babel-comment.js'), atomHome)
expect(CompileCache.getCacheStats()['.js']).toEqual {hits: 1, misses: 1}
expect(Babel.transform.callCount).toBe 1
expect(babelCompiler.compile.callCount).toBe 1

describe 'when the given file is coffee-script', ->
it 'compiles the file with coffee-script and caches it', ->
Expand Down
1 change: 1 addition & 0 deletions spec/update-process-env-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @babel */
'not strict';

import path from 'path';
import childProcess from 'child_process';
Expand Down
21 changes: 21 additions & 0 deletions src/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let presets = [
[
'babel-preset-atomic',
{
// transform ES modules to commonjs
keepModules: false,
// some of the packages use non-strict JavaScript in ES6 modules! We need to add this for now. Eventually, we should fix those packages and remove these:
notStrictDirectiveTriggers: ['use babel'],
notStrictCommentTriggers: ['@babel', '@flow', '* @babel', '* @flow']
}
]
];

let plugins = [];

module.exports = {
presets: presets,
plugins: plugins,
exclude: 'node_modules/**',
sourceMap: 'inline'
};
23 changes: 9 additions & 14 deletions src/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

const crypto = require('crypto');
const path = require('path');
const defaultOptions = require('../static/babelrc.json');
const defaultOptions = require('./babel.config.js');
const configFile = path.join(__dirname, './babel.config.js');

let babel = null;
let babelVersionDirectory = null;
Expand Down Expand Up @@ -31,7 +32,7 @@ exports.shouldCompile = function(sourceCode) {

exports.getCachePath = function(sourceCode) {
if (babelVersionDirectory == null) {
const babelVersion = require('babel-core/package.json').version;
const babelVersion = require('@babel/core/package.json').version;
babelVersionDirectory = path.join(
'js',
'babel',
Expand All @@ -50,28 +51,22 @@ exports.getCachePath = function(sourceCode) {

exports.compile = function(sourceCode, filePath) {
if (!babel) {
babel = require('babel-core');
const Logger = require('babel-core/lib/transformation/file/logger');
const noop = function() {};
Logger.prototype.debug = noop;
Logger.prototype.verbose = noop;
babel = require('@babel/core');
}

if (process.platform === 'win32') {
filePath = 'file:///' + path.resolve(filePath).replace(/\\/g, '/');
}

const options = { filename: filePath };
for (const key in defaultOptions) {
options[key] = defaultOptions[key];
}
return babel.transform(sourceCode, options).code;
return babel.transformSync(sourceCode, {
filename: filePath,
configFile
}).code;
};

function createVersionAndOptionsDigest(version, options) {
return crypto
.createHash('sha1')
.update('babel-core', 'utf8')
.update('@babel/core', 'utf8')
.update('\0', 'utf8')
.update(version, 'utf8')
.update('\0', 'utf8')
Expand Down
7 changes: 0 additions & 7 deletions static/babelrc.json

This file was deleted.