@lwc/babel-plugin-component 2.42.0 → 2.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +37 -0
  2. package/dist/index.cjs.js +1145 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.js +1143 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +25 -8
  7. package/types/compiler-version-number.d.ts +3 -0
  8. package/types/component.d.ts +3 -0
  9. package/types/constants.d.ts +26 -0
  10. package/types/decorators/api/index.d.ts +8 -0
  11. package/types/decorators/api/shared.d.ts +3 -0
  12. package/types/decorators/api/transform.d.ts +6 -0
  13. package/types/decorators/api/validate.d.ts +2 -0
  14. package/types/decorators/index.d.ts +21 -0
  15. package/types/decorators/track/index.d.ts +10 -0
  16. package/types/decorators/types.d.ts +20 -0
  17. package/types/decorators/wire/index.d.ts +8 -0
  18. package/types/decorators/wire/shared.d.ts +3 -0
  19. package/types/decorators/wire/transform.d.ts +4 -0
  20. package/types/decorators/wire/validate.d.ts +2 -0
  21. package/types/dedupe-imports.d.ts +4 -0
  22. package/types/dynamic-imports.d.ts +3 -0
  23. package/types/index.d.ts +9 -0
  24. package/types/scope-css-imports.d.ts +3 -0
  25. package/types/types.d.ts +18 -0
  26. package/types/utils.d.ts +21 -0
  27. package/src/compiler-version-number.js +0 -33
  28. package/src/component.js +0 -89
  29. package/src/constants.js +0 -67
  30. package/src/decorators/api/index.js +0 -18
  31. package/src/decorators/api/shared.js +0 -17
  32. package/src/decorators/api/transform.js +0 -95
  33. package/src/decorators/api/validate.js +0 -160
  34. package/src/decorators/index.js +0 -271
  35. package/src/decorators/track/index.js +0 -49
  36. package/src/decorators/wire/index.js +0 -18
  37. package/src/decorators/wire/shared.js +0 -17
  38. package/src/decorators/wire/transform.js +0 -261
  39. package/src/decorators/wire/validate.js +0 -100
  40. package/src/dedupe-imports.js +0 -56
  41. package/src/dynamic-imports.js +0 -70
  42. package/src/index.d.ts +0 -10
  43. package/src/index.js +0 -77
  44. package/src/scope-css-imports.js +0 -23
  45. package/src/utils.js +0 -116
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @lwc/babel-plugin-component
2
2
 
3
+ ## Summary
4
+
3
5
  This babel plugin does the following transform:
4
6
 
5
7
  - Global decorator transform:
@@ -11,3 +13,38 @@ This babel plugin does the following transform:
11
13
  - Import and inject `render` from a collocated template if a component class doesn't already implement a `render` method.
12
14
  - Optimization:
13
15
  - If the compiler inject the default template a component, it will also wire the template style to the component.
16
+
17
+ ## Installation
18
+
19
+ npm install babel @lwc/babel-plugin-component
20
+
21
+ ## Usage
22
+
23
+ ```js
24
+ const babel = require('@babel/core');
25
+ const lwcPlugin = require('@lwc/babel-plugin-component');
26
+
27
+ const source = `
28
+ import { LightningElement } from 'lwc';
29
+ export default class extends LightningElement {}`;
30
+
31
+ const { code } = babel.transformSync(source, {
32
+ plugins: [
33
+ [
34
+ lwcPlugin,
35
+ {
36
+ /* options */
37
+ },
38
+ ],
39
+ ],
40
+ });
41
+ ```
42
+
43
+ ## Options
44
+
45
+ - `name` (type: `string`, optional) - name of the component, e.g. `foo` in `x/foo`.
46
+ - `namespace` (type: `string`, optional) - namepace of the component, e.g. `x` in `x/foo`.
47
+ - `isExplicitImport` (type: `boolean`, optional) - true if this is an explicit import.
48
+ - `dynamicImports` (type: `object`, optional) - see below:
49
+ - `loader` (type: `string`, optional) - loader to use at runtime.
50
+ - `strictSpecifier` (type: `boolean`, optional) - true if a strict specifier should be used.