@stencil/vue-output-target
Advanced tools
Comparing version 0.2.0-0 to 0.2.0
@@ -130,36 +130,4 @@ 'use strict'; | ||
await compilerCtx.fs.writeFile(outputTarget.proxiesFile, finalText); | ||
if (outputTarget.vetur) { | ||
const docsJson = await compilerCtx.fs.readFile(outputTarget.docsFile); | ||
const { veturTags, veturAttributes } = generateVetur(JSON.parse(docsJson), filteredComponents); | ||
await Promise.all([ | ||
compilerCtx.fs.writeFile(outputTarget.veturTagsFile, JSON.stringify(veturTags, null, 2)), | ||
compilerCtx.fs.writeFile(outputTarget.veturAttributesFile, JSON.stringify(veturAttributes, null, 2)) | ||
]); | ||
} | ||
await copyResources(config, outputTarget); | ||
} | ||
// TODO types | ||
function generateVetur(docsJson, components) { | ||
const tagsObject = {}; | ||
const attributesObject = {}; | ||
docsJson.components.forEach((component) => { | ||
const shouldIncludeComponent = components.find(cmp => cmp.tagName === component.tag); | ||
if (shouldIncludeComponent) { | ||
tagsObject[component.tag] = { | ||
description: component.docs, | ||
attributes: component.props.map((prop) => prop.name) | ||
}; | ||
component.props.forEach((prop) => { | ||
attributesObject[`${component.tag}/${prop.name}`] = { | ||
type: prop.type, | ||
description: prop.docs | ||
}; | ||
}); | ||
} | ||
}); | ||
return { | ||
veturTags: tagsObject, | ||
veturAttributes: attributesObject | ||
}; | ||
} | ||
function getFilteredComponents(excludeComponents = [], cmps) { | ||
@@ -248,4 +216,4 @@ return sortBy(cmps, (cmp) => cmp.tagName).filter((c) => !excludeComponents.includes(c.tagName) && !c.internal); | ||
function normalizeOutputTarget(config, outputTarget) { | ||
var _a, _b, _c; | ||
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], componentModels: outputTarget.componentModels || [], includePolyfills: (_a = outputTarget.includePolyfills) !== null && _a !== void 0 ? _a : true, includeDefineCustomElements: (_b = outputTarget.includeDefineCustomElements) !== null && _b !== void 0 ? _b : true, routerLinkComponents: outputTarget.routerLinkComponents || [], vetur: (_c = outputTarget.vetur) !== null && _c !== void 0 ? _c : false }); | ||
var _a, _b; | ||
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], componentModels: outputTarget.componentModels || [], includePolyfills: (_a = outputTarget.includePolyfills) !== null && _a !== void 0 ? _a : true, includeDefineCustomElements: (_b = outputTarget.includeDefineCustomElements) !== null && _b !== void 0 ? _b : true, routerLinkComponents: outputTarget.routerLinkComponents || [] }); | ||
if (config.rootDir == null) { | ||
@@ -257,8 +225,2 @@ throw new Error('rootDir is not set and it should be set by stencil itself'); | ||
} | ||
if (outputTarget.vetur && !outputTarget.docsFile) { | ||
throw new Error('docsFile is required when outputting Vetur files'); | ||
} | ||
if (outputTarget.vetur && (!outputTarget.veturTagsFile || !outputTarget.veturAttributesFile)) { | ||
throw new Error('veturTagsFile and veturAttributesFile are required when outputting Vetur file'); | ||
} | ||
if (outputTarget.directivesProxyFile && !path.isAbsolute(outputTarget.directivesProxyFile)) { | ||
@@ -265,0 +227,0 @@ results.proxiesFile = normalizePath(path.join(config.rootDir, outputTarget.proxiesFile)); |
{ | ||
"name": "@stencil/vue-output-target", | ||
"version": "0.2.0-0", | ||
"version": "0.2.0", | ||
"description": "Vue output target for @stencil/core components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3
38615
17
833