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

feat(compiler): migrate referential integrity into lwc-compiler #109

Merged
merged 12 commits into from
Feb 15, 2018

Conversation

apapko
Copy link
Collaborator

@apapko apapko commented Feb 14, 2018

Details

Migrate referential integrity report from lwc-platform compiler into salesforce/lwc compiler.
Fixed the following work item, which is part of the LWC Deploy/Retrieve Epic

Does this PR introduce a breaking change?

  • Yes
  • No

"module": "es2015",
"sourceMap": true,
// TODO: turn back to true when there are no more js files in the package
// "declaration": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments are not valid JSON. One way to do this would be to add a // entry instead:

{
  "sourceMap": true,
  "//": "TODO: turn back to true when there are no more js files in the package"
  "declaration": true,
}

Copy link
Member

Choose a reason for hiding this comment

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

Ahah. I didn't know this trick, it's awesome!
That being said tsc use json5 to parse the configuration, adding comments is fine.


// Enhance Strictness
"strict": true,
"suppressImplicitAnyIndexErrors": true
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -7,16 +7,19 @@
"license": "ISC",
"scripts": {
"clean": "rimraf dist/",
"build": "babel src/ --out-dir dist/commonjs",
"build:umd": "webpack --progress",
Copy link
Member

Choose a reason for hiding this comment

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

We will probably need to keep the build:umd for now until we update the delivery mechanism of the compiler into Aura.

@@ -0,0 +1,342 @@
import { getReferences } from '../../references/css';
Copy link
Member

Choose a reason for hiding this comment

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

Collocate the test file closer to the actual implementation in packages/lwc-compiler/src/references/__tests__/css.spec.ts

@@ -0,0 +1,78 @@
import { getReferences } from '../../references/html';
Copy link
Member

Choose a reason for hiding this comment

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

Same comment than for the css.spec.ts

@@ -0,0 +1,115 @@
import { getReferences } from '../../references/javascript';
Copy link
Member

Choose a reason for hiding this comment

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

Same comment than for the css.spec.ts

import { LwcBundle } from '../lwc-bundle';

export function getBundleReferences(bundle: LwcBundle): Reference[] {
console.log("BUNDLE", bundle);
Copy link
Member

Choose a reason for hiding this comment

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

Remove console.log

"cssnano": "^3.10.0",
"lwc-template-compiler": "0.17.15",
"parse5": "^3.0.3",
Copy link
Member

Choose a reason for hiding this comment

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

Could you make sure the versions of the packages align with the other packages?
For example ts-jest is not in sync with the other package, and it causes new entries to be added in the yarn.lock

@@ -24,7 +24,7 @@
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-plugin-uglify": "3.0.0",
"ts-jest": "^21.0.1",
"ts-jest": "^22.0.4",
Copy link
Member

Choose a reason for hiding this comment

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

This PR should not update the version of ts-jest in the other packages. We should update that in another PR, there are several packages that need to be updated along with ts-jest (eg. @types/jest, jest).

Let's keep the PR scoped to lwc-compiler, and set the ts-jest to ^21.0.1 to be consistent with the other packages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using 21.2.4 as discovered during the debugging with @pmdartus

"build:umd": "webpack --progress",
"test": "jest --coverage --maxWorkers=2"
},
"devDependencies": {
"babel-cli": "^6.24.0",
"babel-jest": "^22.2.2",
Copy link
Member

Choose a reason for hiding this comment

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

Remove babel-jest

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: 304389b | Target commit: 5373a3d

benchmark base(304389b) target(5373a3d) trend
table-append-1k.benchmark:benchmark-table/append/1k 250.38 (± 4.04 ms) 255.47 (± 3.67 ms) 👎
table-clear-1k.benchmark:benchmark-table/clear/1k 12.68 (± 0.51 ms) 13.13 (± 0.59 ms) 👎
table-create-10k.benchmark:benchmark-table/create/10k 1406.72 (± 12.34 ms) 1430.47 (± 15.57 ms) 👎
table-create-1k.benchmark:benchmark-table/create/1k 149.13 (± 3.01 ms) 149.82 (± 2.21 ms) 👌
table-update-10th-1k.benchmark:benchmark-table/update-10th/1k 140.34 (± 2.52 ms) 145.81 (± 3.76 ms) 👎
tablecmp-append-1k.benchmark:benchmark-table-component/append/1k 322.15 (± 7.03 ms) 321.63 (± 13.04 ms) 👌
tablecmp-clear-1k.benchmark:benchmark-table/clear/1k 33.04 (± 1.16 ms) 32.99 (± 1.45 ms) 👌
tablecmp-create-10k.benchmark:benchmark-table-component/create/10k 2049.21 (± 30.74 ms) 2038.36 (± 20.54 ms) 👌
tablecmp-create-1k.benchmark:benchmark-table-component/create/1k 225.29 (± 5.61 ms) 232.47 (± 4.72 ms) 👎
tablecmp-update-10th-1k.benchmark:benchmark-table-component/update-10th/1k 133.97 (± 5.60 ms) 137.96 (± 4.30 ms) 👎

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: 17d0379 | Target commit: 63382ee

benchmark base(17d0379) target(63382ee) trend
table-append-1k.benchmark:benchmark-table/append/1k 244.21 (± 5.50 ms) 258.68 (± 8.79 ms) 👎
table-clear-1k.benchmark:benchmark-table/clear/1k 12.63 (± 0.52 ms) 13.47 (± 0.56 ms) 👎
table-create-10k.benchmark:benchmark-table/create/10k 1430.13 (± 34.65 ms) 1505.48 (± 43.33 ms) 👎
table-create-1k.benchmark:benchmark-table/create/1k 148.22 (± 1.70 ms) 153.67 (± 2.88 ms) 👎
table-update-10th-1k.benchmark:benchmark-table/update-10th/1k 138.31 (± 2.29 ms) 143.27 (± 2.84 ms) 👎
tablecmp-append-1k.benchmark:benchmark-table-component/append/1k 317.62 (± 5.89 ms) 324.73 (± 10.54 ms) 👎
tablecmp-clear-1k.benchmark:benchmark-table/clear/1k 29.74 (± 1.18 ms) 30.52 (± 1.18 ms) 👎
tablecmp-create-10k.benchmark:benchmark-table-component/create/10k 1987.46 (± 28.47 ms) 2027.66 (± 28.86 ms) 👎
tablecmp-create-1k.benchmark:benchmark-table-component/create/1k 222.42 (± 1.98 ms) 234.55 (± 6.21 ms) 👎
tablecmp-update-10th-1k.benchmark:benchmark-table-component/update-10th/1k 132.26 (± 3.55 ms) 144.26 (± 5.63 ms) 👎

@apapko apapko merged commit 029e879 into master Feb 15, 2018
@apapko apapko deleted the apapko/compiler-references branch February 16, 2018 00:20
];
}

function sfdcReferencesVisitor(references: Reference[], filename: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have sfdc references in this pkg?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this was going to be generic enough that can be used by sfdc and others.

@@ -0,0 +1,11 @@
export declare type ReferenceType = 'resourceUrl' | 'label' | 'apexClass' | 'apexMethod' | 'sobjectClass' | 'sobjectField' | 'component';
Copy link
Contributor

Choose a reason for hiding this comment

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

why does the compiler care about apex or resources or sobjects?

@diervo
Copy link
Contributor

diervo commented Feb 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants