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: simplify rollup package #659

Merged
merged 10 commits into from
Sep 21, 2018
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
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/acorn": "~4.0.3",
"@types/jest": "~23.0.0",
"@types/node": "8.9.4",
"es5-proxy-compat": "0.20.3",
"babel-preset-minify": "0.5.0-alpha.5a128fd5",
"commitizen": "~2.9.6",
"conventional-changelog-cli": "~1.3.5",
Expand All @@ -41,6 +42,8 @@
"jest": "~23.1.0",
"lerna": "3.0.4",
"prettier": "~1.10.2",
"rollup-plugin-compat": "0.20.4",
"rollup-plugin-replace": "^2.0.0",
"semver": "^5.5.0",
"tslint": "~5.9.1",
"typescript": "2.7.2"
Expand Down
6 changes: 2 additions & 4 deletions packages/benchmark/best.headless.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module.exports = {
projectName: 'lwc-engine-benchmark',
plugins: [
['rollup-plugin-lwc-compiler', {
rootDir: '<rootDir>/src/',
mode: 'prod',
}],
['rollup-plugin-lwc-compiler', { rootDir: '<rootDir>/src/' }],
['rollup-plugin-replace', { 'process.env.NODE_ENV': JSON.stringify('production') }]
],
benchmarkOnClient: false,
benchmarkIterations: 60,
Expand Down
11 changes: 7 additions & 4 deletions packages/benchmark/best.ie11.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
module.exports = {
projectName: 'lwc-engine-benchmark-ie11',
plugins: [
['rollup-plugin-lwc-compiler', {
rootDir: '<rootDir>/src/',
mode: 'compat',
}],
['rollup-plugin-lwc-compiler', { rootDir: '<rootDir>/src/' }],
['rollup-plugin-replace', { 'process.env.NODE_ENV': JSON.stringify('production') }],
['rollup-plugin-compat', {}]
],
benchmarkOnClient: false,
benchmarkIterations: 60,
testPathIgnorePatterns: ['**/__benchmarks__/benchmark-table-wc/*.benchmark.js'],
runnerConfig: [
{
"runner": '@best/runner-headless',
"name": "default",
},
{
"runner": "@best/runner-remote",
"name": "remote",
Expand Down
12 changes: 6 additions & 6 deletions packages/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"test": "echo 'No unit test in this package'"
},
"devDependencies": {
"@best/runner-headless": "0.6.1",
"@best/runner-remote": "0.6.1",
"@best/store-aws": "0.6.1",
"best-cli": "0.6.1"
"@best/runner-headless": "0.6.2",
"@best/runner-remote": "0.6.2",
"@best/store-aws": "0.6.2",
"best-cli": "0.6.2",
"rollup-plugin-lwc-compiler": "0.29.1"
},
"dependencies": {
"lwc-engine": "0.29.1",
"rollup-plugin-lwc-compiler": "0.29.1"
"lwc-engine": "0.29.1"
}
}
2 changes: 1 addition & 1 deletion packages/lwc-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@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.19.0",
"babel-preset-compat": "0.20.4",
"babel-preset-minify": "0.5.0-alpha.5a128fd5",
"cssnano": "^3.10.0",
"lwc-template-compiler": "0.29.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,6 @@ describe('Javascript transform', () => {
});
});

it('should throw if invalid resolveProxyCompat value is specified in compat mode', async () => {
await expect(
transform(`debugger`, 'foo.js', {
namespace: 'x',
name: 'foo',
outputConfig: {
compat: true,
resolveProxyCompat: {
badkey: 'hello',
},
},
})
).rejects.toMatchObject({
filename: 'foo.js',
message: expect.stringContaining(
'Unexpected resolveProxyCompat option, expected property "module", "global" or "independent"'
)
});
});

it('allows dynamic imports', async () => {
const actual = `
export function test() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ function rollupConfig(config) {

module.exports = [
rollupConfig({ format:'es', target:'es2017' }),
rollupConfig({ format:'es', target:'es5' }),

rollupConfig({ format:'cjs', target:'es2017' }),
rollupConfig({ format: 'cjs', target: 'es5' }),
];
10 changes: 6 additions & 4 deletions packages/lwc-engine/src/shared/fields.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { defineProperty } from "./language";

/**
* In IE11, symbols that we plan to apply everywhere are expensive
* due to the nature of the symbol polyfill. This method abstract the
* In IE11, symbols are expensive.
* Due to the nature of the symbol polyfill. This method abstract the
* creation of symbols, so we can fallback to string when native symbols
* are not supported.
* are not supported. Note that we can't use typeof since it will fail when tranpiling.
*/
const hasNativeSymbolsSupport = Symbol('x').toString() === 'Symbol(x)';

export function createFieldName(key: string): symbol {
// @ts-ignore: using a string as a symbol for perf reasons
return typeof Symbol() === 'symbol' ? Symbol(key) : `$$lwc-${key}$$`;
return hasNativeSymbolsSupport ? Symbol(key) : `$$lwc-${key}$$`;
}

export function setInternalField(o: object, fieldName: symbol, value: any) {
Expand Down
6 changes: 2 additions & 4 deletions packages/lwc-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@
"sauce:prod_compat": "MODE=prod_compat yarn build:prod_compat && MODE=prod_compat wdio ./scripts/wdio.sauce.conf.js"
},
"devDependencies": {
"babel-preset-compat": "0.19.0",
"compat-polyfills": "0.19.0",
"babel-preset-compat": "0.20.4",
"compat-polyfills": "0.20.4",
"deepmerge": "^1.5.2",
"dotenv": "^4.0.0",
"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.19.0",
"rollup-plugin-lwc-compiler": "0.29.1",
"wdio-junit-reporter": "^0.4.3",
"wdio-mocha-framework": "~0.5.13",
Expand Down
14 changes: 5 additions & 9 deletions packages/lwc-integration/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const babel = require('@babel/core');
const rollup = require('rollup');
const templates = require('../src/shared/templates.js');
const rollupLwcCompilerPlugin = require('rollup-plugin-lwc-compiler');
const rollupCompatPlugin = require('rollup-plugin-compat').default;
const babelPresetCompat = require('babel-preset-compat');
const rollupCompatPlugin = require('rollup-plugin-compat');
const rollupReplacePlugin = require('rollup-plugin-replace');
const compatPolyfills = require('compat-polyfills');

// -- Build Config -------------------------------------------
Expand Down Expand Up @@ -89,15 +89,11 @@ const baseInputConfig = {
plugins: [
entryPointResolverPlugin(),
rollupLwcCompilerPlugin({
mode,
exclude: `**/*${testSufix}`,
resolveFromPackages: false,
compat: {
// In order to build faster we manually add compat artifacts later
downgrade: false,
polyfills: false
}
resolveFromPackages: false
}),
isCompat && rollupCompatPlugin({ polyfills: false }),
isProd && rollupReplacePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
testCaseComponentResolverPlugin(),
].filter(Boolean)
};
Expand Down
5 changes: 1 addition & 4 deletions packages/lwc-wire-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@
"concurrently": "^3.4.0",
"cross-env": "^3.1.4",
"deasync": "0.1.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.19.0",
"rollup-plugin-lwc-compiler": "0.29.1",
"rollup-plugin-replace": "^2.0.0"
"rollup-plugin-lwc-compiler": "0.29.1"
},
"lwc": {
"modules": {
Expand Down
4 changes: 2 additions & 2 deletions packages/lwc-wire-service/rollup.config.es-and-cjs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */

const path = require('path');
const rollupCompatPlugin = require('rollup-plugin-compat').default;
const rollupCompatPlugin = require('rollup-plugin-compat');
const typescript = require('rollup-plugin-typescript');
const { version } = require('./package.json');
const { generateTargetName } = require('./rollup.config.util');
Expand All @@ -10,7 +10,7 @@ const entry = path.resolve(__dirname, 'src/index.ts');
const commonJSDirectory = path.resolve(__dirname, 'dist/commonjs');
const modulesDirectory = path.resolve(__dirname, 'dist/modules');

const banner = (`/**\n * Copyright (C) 2017 salesforce.com, inc.\n */`);
const banner = (`/**\n * Copyright (C) 2018 salesforce.com, inc.\n */`);
const footer = `/** version: ${version} */`;

function rollupConfig(config) {
Expand Down
2 changes: 1 addition & 1 deletion packages/lwc-wire-service/rollup.config.umd.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require('path');
const rollupReplacePlugin = require('rollup-plugin-replace');
const typescript = require('rollup-plugin-typescript');
const rollupCompatPlugin = require('rollup-plugin-compat').default;
const rollupCompatPlugin = require('rollup-plugin-compat');
const { version } = require('./package.json');
const { generateTargetName } = require('./rollup.config.util');

Expand Down
2 changes: 1 addition & 1 deletion packages/lwc-wire-service/rollup.config.umd.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const babel = require("@babel/core");
const minify = require("babel-preset-minify");
const typescript = require('rollup-plugin-typescript');
const rollupReplacePlugin = require('rollup-plugin-replace');
const rollupCompatPlugin = require('rollup-plugin-compat').default;
const rollupCompatPlugin = require('rollup-plugin-compat');

const { version } = require('./package.json');
const { generateTargetName } = require('./rollup.config.util');
Expand Down
4 changes: 1 addition & 3 deletions packages/rollup-plugin-lwc-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
},
"devDependencies": {
"lwc-compiler": "0.29.1",
"lwc-engine": "0.29.1",
"rollup-plugin-compat": "0.19.0"
"lwc-engine": "0.29.1"
},
"dependencies": {
"es5-proxy-compat": "0.19.0",
"glob": "^7.1.2",
"lwc-module-resolver": "0.29.1",
"rollup-pluginutils": "^2.0.1"
Expand Down
Loading