Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: open-wc/custom-elements-manifest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ac5227b54ba2182610f1b4ee198d84a7c5d0f06a
Choose a base ref
...
head repository: open-wc/custom-elements-manifest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a61e373ffcadd2632119c0f396150da2437d61bd
Choose a head ref
  • 1 commit
  • 9 files changed
  • 1 contributor

Commits on May 7, 2024

  1. fix: mark fields and methods starting with # as private

    thepassle committed May 7, 2024
    Copy the full SHA
    a61e373 View commit details
3 changes: 3 additions & 0 deletions packages/analyzer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Release 0.10.2
- Mark fields and methods starting with `#` as `private`

## Release 0.10.1
- Escape newlines and whitespaces from object output

3 changes: 3 additions & 0 deletions packages/analyzer/browser/index.js
Original file line number Diff line number Diff line change
@@ -203730,6 +203730,9 @@ function handleModifiers(doc, node) {
break;
}
});
if (node.name?.text.startsWith("#")) {
doc.privacy = "private";
}
return doc;
}
function handleJsDoc(doc, node) {
9 changes: 3 additions & 6 deletions packages/analyzer/custom-elements.json
Original file line number Diff line number Diff line change
@@ -12,12 +12,9 @@
"name": "Foo",
"members": [
{
"kind": "field",
"name": "foo",
"type": {
"text": "object"
},
"default": "{ foo: 'bar' }"
"kind": "method",
"name": "#foo",
"privacy": "private"
}
],
"superclass": {
7 changes: 1 addition & 6 deletions packages/analyzer/fixtures/01-class/-default/package/bar.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

export class Foo extends HTMLElement{
constructor() {
super();
this.foo = {
foo: 'bar'
};
}
#foo() {}
}
Original file line number Diff line number Diff line change
@@ -253,6 +253,20 @@
"kind": "field",
"name": "arrowfn"
},
{
"kind": "field",
"name": "#truePrivateField",
"privacy": "private",
"type": {
"text": "number"
},
"default": "1"
},
{
"kind": "method",
"name": "#truePrivateMethod",
"privacy": "private"
},
{
"kind": "field",
"name": "commaprop1",
14 changes: 14 additions & 0 deletions packages/analyzer/fixtures/01-class/01-fields/output.json
Original file line number Diff line number Diff line change
@@ -253,6 +253,20 @@
"kind": "field",
"name": "arrowfn"
},
{
"kind": "field",
"name": "#truePrivateField",
"privacy": "private",
"type": {
"text": "number"
},
"default": "1"
},
{
"kind": "method",
"name": "#truePrivateMethod",
"privacy": "private"
},
{
"kind": "field",
"name": "commaprop1",
Original file line number Diff line number Diff line change
@@ -74,6 +74,9 @@ class MyEl extends HTMLElement {
console.log('dont output me')
}

#truePrivateField = 1;
#truePrivateMethod() {}

constructor() {
super();
this.prop2 = 'default';
2 changes: 1 addition & 1 deletion packages/analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@custom-elements-manifest/analyzer",
"version": "0.10.1",
"version": "0.10.2",
"description": "",
"license": "MIT",
"type": "module",
Original file line number Diff line number Diff line change
@@ -34,6 +34,10 @@ export function handleModifiers(doc, node) {
}
});

if (node.name?.text.startsWith('#')) {
doc.privacy = 'private';
}

return doc;
}