wc-compiler 0.2.1 → 0.2.2
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 +4 -4
- package/package.json +1 -1
- package/src/wcc.js +7 -2
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
**Web Components Compiler (WCC)** is a NodeJS package designed to make server-side rendering (SSR) of native Web Components easier. It can render (within reason 😅) your Web Component into static HTML leveraging [Declarative Shadow DOM](https://web.dev/declarative-shadow-dom/).
|
|
10
10
|
|
|
11
|
-
It is not a static site generator or framework. It is focused on producing raw HTML from Web Components with the intent of being easily _integrated_ into a site generator or framework.
|
|
11
|
+
It is not a static site generator or framework. It is focused on producing raw HTML from Web Components with the intent of being easily _integrated_ into a site generator or framework.
|
|
12
12
|
|
|
13
|
-
> _The original motivation for this project was to create a [purpose built, lighter weight
|
|
13
|
+
> _The original motivation for this project was to create a [purpose built, lighter weight alternative to puppeteer for SSR of native `HTMLElement` based Web Components](https://github.com/ProjectEvergreen/greenwood/issues/935) for the project [**Greenwood**](https://www.greenwoodjs.io/)._
|
|
14
14
|
|
|
15
|
-
In addition, WCC hopes to provide a surface area to explore patterns around [streaming](https://github.com/
|
|
15
|
+
In addition, WCC hopes to provide a surface area to explore patterns around [streaming](https://github.com/ProjectEvergreen/wcc/issues/5) and serverless rendering, as well as acting as a test bed for the [Web Components Community Groups](https://github.com/webcomponents-cg) discussions around community protocols, like [hydration](https://github.com/ProjectEvergreen/wcc/issues/3).
|
|
16
16
|
|
|
17
17
|
## Key Features
|
|
18
18
|
|
|
@@ -36,7 +36,7 @@ $ npm install wc-compiler --save-dev
|
|
|
36
36
|
|
|
37
37
|
## Usage
|
|
38
38
|
|
|
39
|
-
WCC exposes a few utilities to render your Web Components. Below is one example, with [full docs and more examples](https://
|
|
39
|
+
WCC exposes a few utilities to render your Web Components. Below is one example, with [full docs and more examples](https://merry-caramel-524e61.netlify.app/) available on the website.
|
|
40
40
|
|
|
41
41
|
1. Given a custom element like so:
|
|
42
42
|
```js
|
package/package.json
CHANGED
package/src/wcc.js
CHANGED
|
@@ -57,9 +57,14 @@ async function registerDependencies(moduleURL) {
|
|
|
57
57
|
sourceType: 'module'
|
|
58
58
|
}), {
|
|
59
59
|
async ImportDeclaration(node) {
|
|
60
|
-
const
|
|
60
|
+
const specifier = node.source.value;
|
|
61
|
+
const isBareSpecifier = specifier.indexOf('.') !== 0 && specifier.indexOf('/') !== 0;
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
if (!isBareSpecifier) {
|
|
64
|
+
const dependencyModuleURL = new URL(node.source.value, moduleURL);
|
|
65
|
+
|
|
66
|
+
await registerDependencies(dependencyModuleURL);
|
|
67
|
+
}
|
|
63
68
|
},
|
|
64
69
|
async ExpressionStatement(node) {
|
|
65
70
|
if (isCustomElementDefinitionNode(node)) {
|