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(lwc-compiler): Remove old label syntax #23

Merged
merged 2 commits into from
Jan 30, 2018

Conversation

pmdartus
Copy link
Member

@pmdartus pmdartus commented Jan 22, 2018

Changes

Eliminate from the compiler the old (and hacky) way to reference a label from a component

import { Element } from 'engine';		
 		
export default class Test extends Element {
    static labels = ['MyLabel.acceptButton', 'MyLabel.cancelButton']
}

Instead, labels are now imported via using a default import via a @label prefix.

import { Element } from 'engine';
import labelAcceptButton from '@label/MyLabel.acceptButton';
import labelCancelButton from '@label/MyLabel.cancelButton';

export default class Test extends Element {
    labels = {
        accept: labelAcceptButton,
        cancel: labelCancelButton
    }
}

Note: We need to remove the field in Aura before merging.

PR Checklist

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: 0a8e11f | Target commit: 46b449e

benchmark base(0a8e11f) target(46b449e) trend
append-1k.benchmark:benchmark-table/add/1k 335.93 (± 4.24 ms) 331.44 (± 4.24 ms) 👍
clear-1k.benchmark:benchmark-table/clear/1k 51.34 (± 1.17 ms) 48.37 (± 1.17 ms) 👍
create-1k.benchmark:benchmark-table/create/1k 199.85 (± 1.53 ms) 187.12 (± 1.53 ms) 👍
update-10th-1k.benchmark:benchmark-table/update-10th/1k 182.35 (± 1.94 ms) 181.65 (± 1.94 ms) 👌

}

return {
bundleDependencies: Array.from(new Set(dependencies)),
bundleLabels: labels,
Copy link
Contributor

Choose a reason for hiding this comment

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

when this change makes it to Aura (through compiler.js artifact), we would need to update Aura server side POJO to remove the bundleLabels

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: 6d7ae13 | Target commit: f9005bd

benchmark base(6d7ae13) target(f9005bd) trend

@pmdartus pmdartus merged commit 29cb560 into master Jan 30, 2018
@pmdartus pmdartus deleted the pmdartus/remove-labels-hack branch January 30, 2018 22:45
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.

2 participants