wc-compiler
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "wc-compiler", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Experimental native Web Components compiler.", | ||
@@ -30,3 +30,3 @@ "repository": { | ||
"clean": "rimraf ./dist", | ||
"lint": "eslint \"*.*js\" \"./src/**/**/*.js*\" \"./test/**/**/*.js*\"", | ||
"lint": "ls-lint && eslint \"*.*js\" \"./src/**/**/*.js*\" \"./docs/**/*.md\" \"./test/**/**/*.js*\"", | ||
"develop": "concurrently \"nodemon --watch src --watch docs -e js,md,css,html,jsx ./build.js\" \"http-server ./dist --open\"", | ||
@@ -51,2 +51,3 @@ "build": "node ./build.js", | ||
"devDependencies": { | ||
"@ls-lint/ls-lint": "^1.10.0", | ||
"@mapbox/rehype-prism": "^0.8.0", | ||
@@ -60,2 +61,4 @@ "@rollup/plugin-commonjs": "^22.0.0", | ||
"eslint": "^8.14.0", | ||
"eslint-plugin-markdown": "^3.0.0", | ||
"eslint-plugin-no-only-tests": "^2.6.0", | ||
"http-server": "^14.1.0", | ||
@@ -62,0 +65,0 @@ "jsdom": "^19.0.0", |
@@ -10,3 +10,2 @@ /* eslint-disable max-depth, complexity */ | ||
const baseURL = new URL(`file://${process.cwd()}/`); | ||
const jsxRegex = /\.(jsx)$/; | ||
@@ -216,3 +215,3 @@ | ||
const { init, id } = declaration; | ||
if (init.object && init.object.type === 'ThisExpression') { | ||
@@ -368,7 +367,8 @@ // const { description } = this.todo; | ||
export function resolve(specifier, context, defaultResolve) { | ||
const { parentURL = baseURL } = context; | ||
const { parentURL } = context; | ||
if (jsxRegex.test(specifier)) { | ||
return { | ||
url: new URL(specifier, parentURL).href | ||
url: new URL(specifier, parentURL).href, | ||
shortCircuit: true | ||
}; | ||
@@ -375,0 +375,0 @@ } |
@@ -163,5 +163,5 @@ /* eslint-disable max-depth */ | ||
async function renderToString(elementURL) { | ||
async function renderToString(elementURL, wrappingEntryTag = true) { | ||
const definitions = []; | ||
const elementTagName = await getTagName(elementURL); | ||
const elementTagName = wrappingEntryTag && await getTagName(elementURL); | ||
const isEntry = !!elementTagName; | ||
@@ -175,3 +175,3 @@ const elementInstance = await initializeCustomElement(elementURL, undefined, undefined, definitions, isEntry); | ||
const finalTree = await renderComponentRoots(elementTree, definitions); | ||
const html = elementTagName ? ` | ||
const html = wrappingEntryTag && elementTagName ? ` | ||
<${elementTagName}> | ||
@@ -178,0 +178,0 @@ ${serialize(finalTree)} |
Sorry, the diff of this file is not supported yet
1123550
28
25628