wc-compiler 0.15.0 → 0.15.1
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 +1 -1
- package/dist/wcc.dist.cjs +10223 -12121
- package/package.json +6 -7
- package/src/jsx-loader.js +5 -5
- package/src/wcc.js +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wc-compiler",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Experimental native Web Components compiler.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,10 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@projectevergreen/acorn-jsx-esm": "~0.1.0",
|
|
46
|
-
"
|
|
47
|
-
"acorn": "^8.
|
|
48
|
-
"
|
|
49
|
-
"acorn-walk": "^8.2.0",
|
|
46
|
+
"acorn": "^8.14.0",
|
|
47
|
+
"acorn-walk": "^8.3.4",
|
|
48
|
+
"astring": "^1.9.0",
|
|
50
49
|
"parse5": "^6.0.1",
|
|
51
50
|
"sucrase": "^3.35.0"
|
|
52
51
|
},
|
|
@@ -57,7 +56,7 @@
|
|
|
57
56
|
"@babel/preset-react": "^7.24.1",
|
|
58
57
|
"@ls-lint/ls-lint": "^1.10.0",
|
|
59
58
|
"@mapbox/rehype-prism": "^0.8.0",
|
|
60
|
-
"@rollup/plugin-commonjs": "^
|
|
59
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
61
60
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
62
61
|
"c8": "^7.11.2",
|
|
63
62
|
"chai": "^4.3.6",
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
"remark-rehype": "^10.1.0",
|
|
80
79
|
"remark-toc": "^8.0.1",
|
|
81
80
|
"rimraf": "^3.0.2",
|
|
82
|
-
"rollup": "^
|
|
81
|
+
"rollup": "^4.26.0",
|
|
83
82
|
"simple.css": "^0.1.3",
|
|
84
83
|
"unified": "^10.1.2"
|
|
85
84
|
}
|
package/src/jsx-loader.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// https://nodejs.org/api/esm.html#esm_loaders
|
|
3
3
|
import * as acorn from 'acorn';
|
|
4
4
|
import * as walk from 'acorn-walk';
|
|
5
|
-
import { generate } from '
|
|
5
|
+
import { generate } from 'astring';
|
|
6
6
|
import fs from 'fs';
|
|
7
|
+
// ideally we can eventually adopt an ESM compatible version of this plugin
|
|
8
|
+
// https://github.com/acornjs/acorn-jsx/issues/112
|
|
7
9
|
import jsx from '@projectevergreen/acorn-jsx-esm';
|
|
8
10
|
import { parse, parseFragment, serialize } from 'parse5';
|
|
9
|
-
// Need an acorn plugin for now - https://github.com/ProjectEvergreen/greenwood/issues/1218
|
|
10
|
-
import { importAttributes } from 'acorn-import-attributes';
|
|
11
11
|
import { transform } from 'sucrase';
|
|
12
12
|
|
|
13
13
|
const jsxRegex = /\.(jsx)$/;
|
|
@@ -32,7 +32,7 @@ export function getParser(moduleURL) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
|
-
parser: acorn.Parser.extend(jsx()
|
|
35
|
+
parser: acorn.Parser.extend(jsx()),
|
|
36
36
|
config: {
|
|
37
37
|
// https://github.com/acornjs/acorn/issues/829#issuecomment-1172586171
|
|
38
38
|
...walk.base,
|
|
@@ -243,7 +243,7 @@ export function parseJsx(moduleURL) {
|
|
|
243
243
|
const hasOwnObservedAttributes = undefined;
|
|
244
244
|
let inferredObservability = false;
|
|
245
245
|
let observedAttributes = [];
|
|
246
|
-
let tree = acorn.Parser.extend(jsx()
|
|
246
|
+
let tree = acorn.Parser.extend(jsx()).parse(result.code, {
|
|
247
247
|
ecmaVersion: 'latest',
|
|
248
248
|
sourceType: 'module'
|
|
249
249
|
});
|
package/src/wcc.js
CHANGED
|
@@ -4,11 +4,9 @@ import './dom-shim.js';
|
|
|
4
4
|
|
|
5
5
|
import * as acorn from 'acorn';
|
|
6
6
|
import * as walk from 'acorn-walk';
|
|
7
|
-
import { generate } from '
|
|
7
|
+
import { generate } from 'astring';
|
|
8
8
|
import { getParser, parseJsx } from './jsx-loader.js';
|
|
9
9
|
import { parse, parseFragment, serialize } from 'parse5';
|
|
10
|
-
// Need an acorn plugin for now - https://github.com/ProjectEvergreen/greenwood/issues/1218
|
|
11
|
-
import { importAttributes } from 'acorn-import-attributes';
|
|
12
10
|
import { transform } from 'sucrase';
|
|
13
11
|
import fs from 'fs';
|
|
14
12
|
|
|
@@ -100,7 +98,7 @@ function registerDependencies(moduleURL, definitions, depth = 0) {
|
|
|
100
98
|
...walk.base
|
|
101
99
|
};
|
|
102
100
|
|
|
103
|
-
walk.simple(parser.
|
|
101
|
+
walk.simple(parser.parse(result.code, {
|
|
104
102
|
ecmaVersion: 'latest',
|
|
105
103
|
sourceType: 'module'
|
|
106
104
|
}), {
|
|
@@ -151,7 +149,7 @@ async function getTagName(moduleURL) {
|
|
|
151
149
|
};
|
|
152
150
|
let tagName;
|
|
153
151
|
|
|
154
|
-
walk.simple(parser.
|
|
152
|
+
walk.simple(parser.parse(result.code, {
|
|
155
153
|
ecmaVersion: 'latest',
|
|
156
154
|
sourceType: 'module'
|
|
157
155
|
}), {
|