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

fix: upgrading babel #653

Merged
merged 3 commits into from
Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"url": "https://github.com/salesforce/lwc.git"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.49",
"@babel/core": "7.1.0",
"@babel/plugin-transform-modules-commonjs": "7.1.0",
"@commitlint/cli": "^6.2.0",
"@commitlint/config-conventional": "^6.1.3",
"@types/acorn": "~4.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-transform-lwc-class/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test": "DIR=`pwd` && cd ../../ && yarn test $DIR"
},
"dependencies": {
"@babel/helper-module-imports": "7.0.0-beta.49",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.49"
"@babel/helper-module-imports": "7.0.0",
"@babel/plugin-proposal-class-properties": "7.1.0"
},
"devDependencies": {
"common-tags": "^1.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const scopedReferenceLookup = scope => name => {
module.exports = function transform(t, klass, decorators) {
const metadata = [];
const wiredValues = decorators.filter(isWireDecorator).map(({path}) => {
const [id, config] = path.get('arguments');
const [id, config] = path.get('expression.arguments');

const propertyName = path.parentPath.get('key.name').node;
const isClassMethod = path.parentPath.isClassMethod({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { isWireDecorator } = require('./shared');
const { LWC_PACKAGE_EXPORTS: { WIRE_DECORATOR, TRACK_DECORATOR, API_DECORATOR } } = require('../../constants');

function validateWireParameters(path) {
const [id, config] = path.get('arguments');
const [id, config] = path.get('expression.arguments');

if (!id) {
throw path.buildCodeFrameError(
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-plugin-transform-lwc-class/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ module.exports = function LwcClassTransform(api, config) {

return {
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push('decorators');
parserOpts.plugins.push(['decorators', { decoratorsBeforeExport: true }]);
parserOpts.plugins.push('classProperties');
parserOpts.plugins.push('dynamicImport');
},
visitor: mergeVisitors(visitors),
};
Expand Down
5 changes: 3 additions & 2 deletions packages/babel-plugin-transform-lwc-class/src/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ module.exports = function () {
function extractLWCDecorator(node) {
if (node.decorators) {
for (const decorator of node.decorators) {
if (isLWCDecorator(decorator.callee.name)) {
return decorator.callee.name;
const name = decorator.expression.name || decorator.expression.callee.name;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apapko this was the issue

if (isLWCDecorator(name)) {
return name;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/lwc-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"test": "DIR=`pwd` && cd ../../ && yarn test $DIR"
},
"dependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.49",
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.49",
"@babel/core": "7.1.0",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
"@types/chokidar": "^1.7.5",
"babel-plugin-transform-lwc-class": "0.29.1",
"babel-preset-compat": "0.18.12",
"babel-preset-compat": "0.19.0",
"babel-preset-minify": "0.5.0-alpha.5a128fd5",
"cssnano": "^3.10.0",
"lwc-template-compiler": "0.29.1",
Expand All @@ -31,7 +31,7 @@
"rollup-plugin-replace": "^2.0.0"
},
"devDependencies": {
"@types/babel-core": "^6.25.3",
"@types/babel-core": "~6.25.3",
"awesome-typescript-loader": "^5.0.0",
"magic-string": "^0.22.4",
"string-replace-webpack-plugin": "^0.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import __iterableKey from 'proxy-compat/iterableKey';
import __callKey2 from 'proxy-compat/callKey2';
import __callKey0 from 'proxy-compat/callKey0';
import __callKey3 from 'proxy-compat/callKey3';
import _regeneratorRuntime from 'babel-compat/regenerator';
import _asyncToGenerator from 'babel-compat/helpers/asyncToGenerator';
import _createClass from 'babel-compat/helpers/createClass';
import _typeof from 'babel-compat/helpers/typeof';
import _taggedTemplateLiteral from 'babel-compat/helpers/taggedTemplateLiteral';
import _toConsumableArray from 'babel-compat/helpers/toConsumableArray';
import _slicedToArray from 'babel-compat/helpers/slicedToArray';
import _defineProperty2 from 'babel-compat/helpers/defineProperty';
import _classCallCheck from 'babel-compat/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-compat/helpers/possibleConstructorReturn';
import _getPrototypeOf from 'babel-compat/helpers/getPrototypeOf';
import _inherits from 'babel-compat/helpers/inherits';
import _regeneratorRuntime from '@babel/runtime/regenerator';
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
import _createClass from '@babel/runtime/helpers/createClass';
import _typeof from '@babel/runtime/helpers/typeof';
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _defineProperty2 from '@babel/runtime/helpers/defineProperty';
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
import _inherits from '@babel/runtime/helpers/inherits';

function _templateObject3() {
var data = _taggedTemplateLiteral(["wow\naB", " ", ""], ["wow\\naB", " ", ""]);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if (style) {
}
class Metadata extends LightningElement {
constructor(...args) {
var _temp;
return _temp = super(...args), this.publicProp = void 0, this.wiredProp = void 0, _temp;
super(...args);
this.publicProp = void 0;
this.wiredProp = void 0;
}
publicMethod(name) {
return "hello" + name;
Expand Down
7 changes: 6 additions & 1 deletion packages/lwc-compiler/src/babel-plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ import transformObjectRestSpread from '@babel/plugin-proposal-object-rest-spread
export const BABEL_CONFIG_BASE = {
babelrc: false,
sourceMaps: true,
parserOpts: { plugins: ['dynamicImport', 'decorators'] },
parserOpts: {
plugins: [
['dynamicImport', {}], // we add this non standard since its already implemented in most browsers
['decorators', { decoratorsBeforeExport: true }]
]
},
presets: [],
};

Expand Down
8 changes: 4 additions & 4 deletions packages/lwc-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"sauce:prod_compat": "MODE=prod_compat yarn build:prod_compat && MODE=prod_compat wdio ./scripts/wdio.sauce.conf.js"
},
"devDependencies": {
"babel-preset-compat": "0.18.12",
"compat-polyfills": "0.18.12",
"babel-preset-compat": "0.19.0",
"compat-polyfills": "0.19.0",
"deepmerge": "^1.5.2",
"dotenv": "^4.0.0",
"es5-proxy-compat": "0.18.12",
"es5-proxy-compat": "0.19.0",
"fs-extra": "^4.0.2",
"http-server": "^0.10.0",
"lwc-compiler": "0.29.1",
"lwc-engine": "0.29.1",
"minimist": "^1.2.0",
"rollup-plugin-compat": "0.18.12",
"rollup-plugin-compat": "0.19.0",
"rollup-plugin-lwc-compiler": "0.29.1",
"wdio-junit-reporter": "^0.4.3",
"wdio-mocha-framework": "~0.5.13",
Expand Down
6 changes: 3 additions & 3 deletions packages/lwc-jest-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"lwc"
],
"dependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.49",
"@babel/template": "7.0.0-beta.49",
"@babel/core": "7.1.0",
"@babel/plugin-transform-modules-commonjs": "7.1.0",
"@babel/template": "7.1.0",
"deasync": "0.1.12"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ afterEach(() => {
});

describe('example-labels', () => {
it.only('default snapshot', () => {
it('default snapshot', () => {
const element = createElement('example-labels', { is: Labels });
document.body.appendChild(element);
expect(element).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ const baseConfig = {
babelrc: false,
filename: 'test.js',
parserOpts: {
plugins: ['*'],
plugins: [
['asyncGenerators', {}],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['classProperties', {}],
['dynamicImport', {}],
['decorators', { decoratorsBeforeExport: true }]
],
},
};

Expand Down
4 changes: 2 additions & 2 deletions packages/lwc-wire-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"concurrently": "^3.4.0",
"cross-env": "^3.1.4",
"deasync": "0.1.12",
"es5-proxy-compat": "0.18.12",
"es5-proxy-compat": "0.19.0",
"eslint": "~4.13.0",
"eslint-plugin-lwc": "^0.2.4",
"express": "^4.15.2",
"lwc-compiler": "0.29.1",
"lwc-engine": "0.29.1",
"lwc-jest-transformer": "0.17.15",
"rollup": "0.60.1",
"rollup-plugin-compat": "0.18.12",
"rollup-plugin-compat": "0.19.0",
"rollup-plugin-lwc-compiler": "0.29.1",
"rollup-plugin-replace": "^2.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/rollup-plugin-lwc-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"devDependencies": {
"lwc-compiler": "0.29.1",
"lwc-engine": "0.29.1",
"rollup-plugin-compat": "0.18.12"
"rollup-plugin-compat": "0.19.0"
},
"dependencies": {
"es5-proxy-compat": "0.18.12",
"es5-proxy-compat": "0.19.0",
"glob": "^7.1.2",
"lwc-module-resolver": "0.29.1",
"rollup-pluginutils": "^2.0.1"
Expand Down
Loading