-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: ignore nested node modules #258
Open
andrico1234
wants to merge
5
commits into
open-wc:master
Choose a base branch
from
andrico1234:feature/handle-nested-node-modules
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"packages/analyzer/fixtures/11-nested-node-modules/01-basic", | ||
"plugins/*" | ||
] | ||
} |
112 changes: 112 additions & 0 deletions
112
packages/analyzer/fixtures/11-nested-node-modules/01-basic/fixture/custom-elements.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
"schemaVersion": "1.0.0", | ||
"readme": "", | ||
"modules": [ | ||
{ | ||
"kind": "javascript-module", | ||
"path": "my-element.js", | ||
"declarations": [ | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyElement", | ||
"members": [ | ||
{ | ||
"kind": "field", | ||
"name": "foo", | ||
"type": { | ||
"text": "string" | ||
}, | ||
"default": "'bar'" | ||
} | ||
], | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "my-element", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyWindow", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "my-window", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "anonymous_4", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "anon-1", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyEl", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "anon-2", | ||
"customElement": true | ||
} | ||
], | ||
"exports": [ | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-foo", | ||
"declaration": { | ||
"name": "MyFoo", | ||
"module": "/foo.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-bar", | ||
"declaration": { | ||
"name": "MyBar", | ||
"package": "foo" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-element", | ||
"declaration": { | ||
"name": "MyElement", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-window", | ||
"declaration": { | ||
"name": "MyWindow", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "anon-1", | ||
"declaration": { | ||
"name": "anonymous_4", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "anon-2", | ||
"declaration": { | ||
"name": "MyEl", | ||
"module": "my-element.js" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
112 changes: 112 additions & 0 deletions
112
packages/analyzer/fixtures/11-nested-node-modules/01-basic/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
"schemaVersion": "1.0.0", | ||
"readme": "", | ||
"modules": [ | ||
{ | ||
"kind": "javascript-module", | ||
"path": "my-element.js", | ||
"declarations": [ | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyElement", | ||
"members": [ | ||
{ | ||
"kind": "field", | ||
"name": "foo", | ||
"type": { | ||
"text": "string" | ||
}, | ||
"default": "'bar'" | ||
} | ||
], | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "my-element", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyWindow", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "my-window", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "anonymous_4", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "anon-1", | ||
"customElement": true | ||
}, | ||
{ | ||
"kind": "class", | ||
"description": "", | ||
"name": "MyEl", | ||
"superclass": { | ||
"name": "HTMLElement" | ||
}, | ||
"tagName": "anon-2", | ||
"customElement": true | ||
} | ||
], | ||
"exports": [ | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-foo", | ||
"declaration": { | ||
"name": "MyFoo", | ||
"module": "/foo.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-bar", | ||
"declaration": { | ||
"name": "MyBar", | ||
"package": "foo" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-element", | ||
"declaration": { | ||
"name": "MyElement", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "my-window", | ||
"declaration": { | ||
"name": "MyWindow", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "anon-1", | ||
"declaration": { | ||
"name": "anonymous_4", | ||
"module": "my-element.js" | ||
} | ||
}, | ||
{ | ||
"kind": "custom-element-definition", | ||
"name": "anon-2", | ||
"declaration": { | ||
"name": "MyEl", | ||
"module": "my-element.js" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/analyzer/fixtures/11-nested-node-modules/01-basic/package/my-element.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {MyFoo} from './foo.js'; | ||
import {MyBar} from 'foo'; | ||
|
||
class MyElement extends HTMLElement { | ||
foo = 'bar'; | ||
} | ||
class MyWindow extends HTMLElement {} | ||
|
||
customElements.define('my-foo', MyFoo); | ||
customElements.define('my-bar', MyBar); | ||
customElements.define('my-element', MyElement); | ||
window.customElements.define('my-window', MyWindow); | ||
|
||
customElements.define('anon-1', class extends HTMLElement {}); | ||
|
||
customElements.define('anon-2', class MyEl extends HTMLElement {}); |
12 changes: 12 additions & 0 deletions
12
packages/analyzer/fixtures/11-nested-node-modules/01-basic/package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "nested-node-modules-test", | ||
"version": "0.0.1", | ||
"description": "Used to generate a fixutres with nested node_module", | ||
"author": "open-wc", | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@custom-elements-manifest/to-markdown": "^0.0.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1401,19 +1401,6 @@ | |
"@babel/helper-module-imports" "^7.10.4" | ||
"@rollup/pluginutils" "^3.1.0" | ||
|
||
"@rollup/plugin-commonjs@^19.0.0": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why the yarn.lock changed when I installed the dependencies. I can revert these changes if it's a problem |
||
version "19.0.0" | ||
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-19.0.0.tgz#8c3e71f9a66908e60d70cc1be205834ef3e45f71" | ||
integrity sha512-adTpD6ATGbehdaQoZQ6ipDFhdjqsTgpOAhFiPwl+dzre4pPshsecptDPyEFb61JMJ1+mGljktaC4jI8ARMSNyw== | ||
dependencies: | ||
"@rollup/pluginutils" "^3.1.0" | ||
commondir "^1.0.1" | ||
estree-walker "^2.0.1" | ||
glob "^7.1.6" | ||
is-reference "^1.2.1" | ||
magic-string "^0.25.7" | ||
resolve "^1.17.0" | ||
|
||
"@rollup/plugin-node-resolve@^11.0.1": | ||
version "11.2.1" | ||
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz#82aa59397a29cd4e13248b106e6a4a1880362a60" | ||
|
@@ -1426,18 +1413,6 @@ | |
is-module "^1.0.0" | ||
resolve "^1.19.0" | ||
|
||
"@rollup/plugin-node-resolve@^13.0.0": | ||
version "13.0.0" | ||
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.0.tgz#352f07e430ff377809ec8ec8a6fd636547162dc4" | ||
integrity sha512-41X411HJ3oikIDivT5OKe9EZ6ud6DXudtfNrGbC4nniaxx2esiWjkLOzgnZsWq1IM8YIeL2rzRGLZLBjlhnZtQ== | ||
dependencies: | ||
"@rollup/pluginutils" "^3.1.0" | ||
"@types/resolve" "1.17.1" | ||
builtin-modules "^3.1.0" | ||
deepmerge "^4.2.2" | ||
is-module "^1.0.0" | ||
resolve "^1.19.0" | ||
|
||
"@rollup/plugin-replace@^2.4.2": | ||
version "2.4.2" | ||
resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz#a2d539314fbc77c244858faa523012825068510a" | ||
|
@@ -1534,11 +1509,6 @@ | |
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.6.tgz#0b7018723084918a865eff99249c490505df2163" | ||
integrity sha512-7fDOJFA/x8B+sO1901BmHlf5dE1cxBU8mRXj8QOEDnn16hhGJv/IHxJtZhvsabZsIMn0eLIyeOKAeqSNJJYTpA== | ||
|
||
"@types/estree@*": | ||
version "0.0.50" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" | ||
integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== | ||
|
||
"@types/[email protected]": | ||
version "0.0.39" | ||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" | ||
|
@@ -2738,11 +2708,6 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.2.4.tgz#489f3ee55dfd184a6e4bffb31baba284453cb760" | ||
integrity sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw== | ||
|
||
commondir@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" | ||
integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= | ||
|
||
[email protected]: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1" | ||
|
@@ -4375,13 +4340,6 @@ is-promise@^2.0.0: | |
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" | ||
integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== | ||
|
||
is-reference@^1.2.1: | ||
version "1.2.1" | ||
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" | ||
integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== | ||
dependencies: | ||
"@types/estree" "*" | ||
|
||
is-regex@^1.0.3: | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f" | ||
|
@@ -6587,7 +6545,7 @@ resolve-path@^1.4.0: | |
http-errors "~1.6.2" | ||
path-is-absolute "1.0.1" | ||
|
||
resolve@^1.1.6, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.19.0: | ||
resolve@^1.1.6, resolve@^1.14.2, resolve@^1.19.0: | ||
version "1.20.0" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" | ||
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== | ||
|
@@ -6670,7 +6628,7 @@ rollup-plugin-terser@^7.0.2: | |
serialize-javascript "^4.0.0" | ||
terser "^5.0.0" | ||
|
||
rollup@^2.35.1, rollup@^2.52.8: | ||
rollup@^2.35.1: | ||
version "2.53.1" | ||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.53.1.tgz#b60439efd1eb41bdb56630509bd99aae78b575d3" | ||
integrity sha512-yiTCvcYXZEulNWNlEONOQVlhXA/hgxjelFSjNcrwAAIfYx/xqjSHwqg/cCaWOyFRKr+IQBaXwt723m8tCaIUiw== | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to generate a nested node_modules folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse this test fixture instead? https://github.com/open-wc/custom-elements-manifest/blob/master/packages/analyzer/fixtures/02-inheritance/05-external-in-monorepo/monorepo/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I removed the new test case and used the existing one. Annoyingly, the test case (even after I added a node_modules directory) passes on both the old and the new regex. My previous test failed on the old regex, but passed with the new one.
I can investigate further, but again it would probably complicate the repo structure a bit, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah id prefer not to use the workspaces field for it, it muddies the water a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽 the latest change removes the changes to the workspaces
The PR's ready for review, but I couldn't quite get the 05-external-in-monorepo test case to fail on the previous regex. It passes on both. I can investigate further, but not sure if it's a blocker