Skip to content

Commit

Permalink
handle bare specifiers (#44)
Browse files Browse the repository at this point in the history
* handle bare specifiers and add specs

* fix linting

* remove console logging

* fix linting

* clarify spec label

* disable parallel mocha

* delete failing spec

* remove console log

* remove pacakge.json updates

* restore pacakge-lock.json

* restore pacakge-lock.json
  • Loading branch information
thescientist13 authored Jun 7, 2022
1 parent e9c5879 commit b582ecb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/wcc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ async function registerDependencies(moduleURL) {
sourceType: 'module'
}), {
async ImportDeclaration(node) {
const dependencyModuleURL = new URL(node.source.value, moduleURL);
const specifier = node.source.value;
const isBareSpecifier = specifier.indexOf('.') !== 0 && specifier.indexOf('/') !== 0;

await registerDependencies(dependencyModuleURL);
if (!isBareSpecifier) {
const dependencyModuleURL = new URL(node.source.value, moduleURL);

await registerDependencies(dependencyModuleURL);
}
},
async ExpressionStatement(node) {
if (isCustomElementDefinitionNode(node)) {
Expand Down
2 changes: 1 addition & 1 deletion test/cases/render-from-html/render-from-html.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('Run WCC ', function() {
});

describe(LABEL, function() {
it('should have three custom elements in the asset graph', function() {
it('should have two custom elements in the asset graph', function() {
expect(Object.keys(assetMetadata).length).to.equal(2);
});

Expand Down

0 comments on commit b582ecb

Please sign in to comment.