@lwc/babel-plugin-component 2.41.3 → 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.
- package/README.md +37 -0
- package/dist/index.cjs.js +1145 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.js +1143 -0
- package/dist/index.js.map +1 -0
- package/package.json +25 -8
- package/types/compiler-version-number.d.ts +3 -0
- package/types/component.d.ts +3 -0
- package/types/constants.d.ts +26 -0
- package/types/decorators/api/index.d.ts +8 -0
- package/types/decorators/api/shared.d.ts +3 -0
- package/types/decorators/api/transform.d.ts +6 -0
- package/types/decorators/api/validate.d.ts +2 -0
- package/types/decorators/index.d.ts +21 -0
- package/types/decorators/track/index.d.ts +10 -0
- package/types/decorators/types.d.ts +20 -0
- package/types/decorators/wire/index.d.ts +8 -0
- package/types/decorators/wire/shared.d.ts +3 -0
- package/types/decorators/wire/transform.d.ts +4 -0
- package/types/decorators/wire/validate.d.ts +2 -0
- package/types/dedupe-imports.d.ts +4 -0
- package/types/dynamic-imports.d.ts +3 -0
- package/types/index.d.ts +9 -0
- package/types/scope-css-imports.d.ts +3 -0
- package/types/types.d.ts +18 -0
- package/types/utils.d.ts +21 -0
- package/src/compiler-version-number.js +0 -33
- package/src/component.js +0 -89
- package/src/constants.js +0 -67
- package/src/decorators/api/index.js +0 -18
- package/src/decorators/api/shared.js +0 -17
- package/src/decorators/api/transform.js +0 -95
- package/src/decorators/api/validate.js +0 -160
- package/src/decorators/index.js +0 -271
- package/src/decorators/track/index.js +0 -49
- package/src/decorators/wire/index.js +0 -18
- package/src/decorators/wire/shared.js +0 -17
- package/src/decorators/wire/transform.js +0 -261
- package/src/decorators/wire/validate.js +0 -100
- package/src/dedupe-imports.js +0 -56
- package/src/dynamic-imports.js +0 -70
- package/src/index.d.ts +0 -10
- package/src/index.js +0 -77
- package/src/scope-css-imports.js +0 -23
- 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.
|