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): throw on any non-whitelisted lwc imports #752

Merged
merged 3 commits into from
Oct 23, 2018

Conversation

apapko
Copy link
Collaborator

@apapko apapko commented Oct 19, 2018

Details

Disallow any non-whitelisted lwc import. Current whitelist contains most the lwc api, except registerTemplate.

Whitelisted apis:

'LightningElement',
'api',
'track',
'wire',
'buildCustomElementConstructor',
'createElement',
'dangerousObjectMutation',
'getComponentDef',
'getComponentConstructor',
'isComponentConstructor',
'readonly',
'register',
'unwrap',

Any cases that should be prevented for platform users must be handled by en eslint rule.

Fixes: W-5507771

Does this PR introduce a breaking change?

  • Yes
  • No

Any existing code that imports 'registerTemplate' will result in failure.

@apapko apapko requested review from diervo and pmdartus October 19, 2018 23:48
@apapko apapko added nomerge and removed nomerge labels Oct 19, 2018
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: fb72740 | Target commit: 81039a9

lwc-engine-benchmark

table-append-1k metric base(fb72740) target(81039a9) trend
benchmark-table/append/1k duration 149.00 (±2.90 ms) 150.65 (±5.60 ms) +1.6ms (1.1%) 👌
table-clear-1k metric base(fb72740) target(81039a9) trend
benchmark-table/clear/1k duration 6.25 (±0.50 ms) 12.10 (±0.60 ms) +5.8ms (93.6%) 👎
table-create-10k metric base(fb72740) target(81039a9) trend
benchmark-table/create/10k duration 892.15 (±4.50 ms) 892.85 (±5.85 ms) +0.7ms (0.1%) 👌
table-create-1k metric base(fb72740) target(81039a9) trend
benchmark-table/create/1k duration 115.55 (±2.90 ms) 107.70 (±2.20 ms) -7.8ms (6.8%) 👍
table-update-10th-1k metric base(fb72740) target(81039a9) trend
benchmark-table/update-10th/1k duration 87.60 (±2.40 ms) 83.80 (±2.65 ms) -3.8ms (4.3%) 👌
tablecmp-append-1k metric base(fb72740) target(81039a9) trend
benchmark-table-component/append/1k duration 233.00 (±14.95 ms) 210.65 (±15.25 ms) -22.3ms (9.6%) 👍
tablecmp-clear-1k metric base(fb72740) target(81039a9) trend
benchmark-table-component/clear/1k duration 11.55 (±1.80 ms) 19.10 (±1.95 ms) +7.6ms (65.4%) 👎
tablecmp-create-10k metric base(fb72740) target(81039a9) trend
benchmark-table-component/create/10k duration 1660.90 (±9.05 ms) 1619.40 (±9.35 ms) -41.5ms (2.5%) 👍
tablecmp-create-1k metric base(fb72740) target(81039a9) trend
benchmark-table-component/create/1k duration 198.35 (±7.30 ms) 182.30 (±6.10 ms) -16.0ms (8.1%) 👍
tablecmp-update-10th-1k metric base(fb72740) target(81039a9) trend
benchmark-table-component/update-10th/1k duration 72.45 (±3.80 ms) 82.70 (±5.50 ms) +10.3ms (14.1%) 👎
wc-append-1k metric base(fb72740) target(81039a9) trend
benchmark-table-wc/append/1k duration 232.75 (±7.90 ms) 272.65 (±14.10 ms) +39.9ms (17.1%) 👎
wc-clear-1k metric base(fb72740) target(81039a9) trend
benchmark-table-wc/clear/1k duration 21.70 (±2.25 ms) 27.80 (±2.65 ms) +6.1ms (28.1%) 👎
wc-create-10k metric base(fb72740) target(81039a9) trend
benchmark-table-wc/create/10k duration 1714.75 (±37.05 ms) 2043.05 (±8.85 ms) +328.3ms (19.1%) 👎
wc-create-1k metric base(fb72740) target(81039a9) trend
benchmark-table-wc/create/1k duration 202.40 (±4.50 ms) 222.90 (±5.05 ms) +20.5ms (10.1%) 👎
wc-update-10th-1k metric base(fb72740) target(81039a9) trend
benchmark-table-wc/update-10th/1k duration 72.95 (±4.25 ms) 80.85 (±4.85 ms) +7.9ms (10.8%) 👎

@apapko apapko force-pushed the apapko/prevent-register-template branch from 81039a9 to 5869b72 Compare October 23, 2018 21:27
@salesforce-best-lwc-internal
Copy link

Benchmark results

Base commit: a212efd | Target commit: 5869b72

lwc-engine-benchmark

table-append-1k metric base(a212efd) target(5869b72) trend
benchmark-table/append/1k duration 151.20 (±5.10 ms) 150.65 (±4.00 ms) -0.6ms (0.4%) 👌
table-clear-1k metric base(a212efd) target(5869b72) trend
benchmark-table/clear/1k duration 6.50 (±0.50 ms) 6.20 (±0.30 ms) -0.3ms (4.6%) 👌
table-create-10k metric base(a212efd) target(5869b72) trend
benchmark-table/create/10k duration 885.20 (±4.60 ms) 873.20 (±6.10 ms) -12.0ms (1.4%) 👍
table-create-1k metric base(a212efd) target(5869b72) trend
benchmark-table/create/1k duration 114.60 (±1.80 ms) 117.15 (±2.25 ms) +2.6ms (2.2%) 👎
table-update-10th-1k metric base(a212efd) target(5869b72) trend
benchmark-table/update-10th/1k duration 76.00 (±2.95 ms) 76.05 (±2.10 ms) +0.0ms (0.1%) 👌
tablecmp-append-1k metric base(a212efd) target(5869b72) trend
benchmark-table-component/append/1k duration 243.45 (±9.00 ms) 234.05 (±14.15 ms) -9.4ms (3.9%) 👍
tablecmp-clear-1k metric base(a212efd) target(5869b72) trend
benchmark-table-component/clear/1k duration 12.55 (±1.75 ms) 12.05 (±1.90 ms) -0.5ms (4.0%) 👌
tablecmp-create-10k metric base(a212efd) target(5869b72) trend
benchmark-table-component/create/10k duration 1680.60 (±12.55 ms) 1703.20 (±11.65 ms) +22.6ms (1.3%) 👎
tablecmp-create-1k metric base(a212efd) target(5869b72) trend
benchmark-table-component/create/1k duration 200.90 (±5.00 ms) 203.40 (±4.75 ms) +2.5ms (1.2%) 👌
tablecmp-update-10th-1k metric base(a212efd) target(5869b72) trend
benchmark-table-component/update-10th/1k duration 71.25 (±6.65 ms) 72.10 (±4.55 ms) +0.8ms (1.2%) 👌
wc-append-1k metric base(a212efd) target(5869b72) trend
benchmark-table-wc/append/1k duration 235.35 (±10.30 ms) 241.40 (±11.10 ms) +6.0ms (2.6%) 👎
wc-clear-1k metric base(a212efd) target(5869b72) trend
benchmark-table-wc/clear/1k duration 23.60 (±2.55 ms) 22.95 (±1.65 ms) -0.7ms (2.8%) 👌
wc-create-10k metric base(a212efd) target(5869b72) trend
benchmark-table-wc/create/10k duration 1670.65 (±65.65 ms) 1725.60 (±21.80 ms) +54.9ms (3.3%) 👌
wc-create-1k metric base(a212efd) target(5869b72) trend
benchmark-table-wc/create/1k duration 204.25 (±4.75 ms) 206.70 (±4.65 ms) +2.4ms (1.2%) 👌
wc-update-10th-1k metric base(a212efd) target(5869b72) trend
benchmark-table-wc/update-10th/1k duration 74.25 (±4.65 ms) 73.85 (±6.45 ms) -0.4ms (0.5%) 👌

@apapko apapko merged commit 9652133 into master Oct 23, 2018
@apapko apapko deleted the apapko/prevent-register-template branch October 23, 2018 23:29
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.

3 participants