rollup-plugin-vue
Advanced tools
Comparing version 6.0.0-beta.10 to 6.0.0-beta.11
@@ -82,3 +82,3 @@ "use strict"; | ||
code: block.content, | ||
map: normalizeSourceMap(block.map), | ||
map: normalizeSourceMap(block.map, id), | ||
}; | ||
@@ -97,2 +97,5 @@ } | ||
const hasScoped = descriptor.styles.some((s) => s.scoped); | ||
if (query.src) { | ||
this.addWatchFile(query.filename); | ||
} | ||
if (query.type === 'template') { | ||
@@ -137,3 +140,3 @@ debug(`transform(${id})`); | ||
code: result.code, | ||
map: normalizeSourceMap(result.map), | ||
map: normalizeSourceMap(result.map, id), | ||
}; | ||
@@ -201,3 +204,3 @@ } | ||
code: result.code, | ||
map: normalizeSourceMap(result.map), | ||
map: normalizeSourceMap(result.map, id), | ||
}; | ||
@@ -288,3 +291,10 @@ } | ||
const hasScoped = descriptor.styles.some((s) => s.scoped); | ||
const templateImport = getTemplateCode(descriptor, resourcePath, id, hasScoped, isServer); | ||
const templateImport = !descriptor.template | ||
? '' | ||
: getTemplateCode(descriptor, resourcePath, id, hasScoped, isServer); | ||
const renderReplace = !descriptor.template | ||
? '' | ||
: isServer | ||
? `script.ssrRender = ssrRender` | ||
: `script.render = render`; | ||
const scriptImport = getScriptCode(descriptor, resourcePath); | ||
@@ -298,3 +308,3 @@ const stylesCode = getStyleCode(descriptor, resourcePath, id, options.preprocessStyles); | ||
customBlocksCode, | ||
isServer ? `script.ssrRender = ssrRender` : `script.render = render`, | ||
renderReplace, | ||
]; | ||
@@ -314,3 +324,4 @@ if (hasScoped) { | ||
function getTemplateCode(descriptor, resourcePath, id, hasScoped, isServer) { | ||
let templateImport = `const render = () => {}`; | ||
const renderFnName = isServer ? 'ssrRender' : 'render'; | ||
let templateImport = `const ${renderFnName} = () => {}`; | ||
let templateRequest; | ||
@@ -322,6 +333,6 @@ if (descriptor.template) { | ||
const srcQuery = descriptor.template.src ? `&src` : ``; | ||
const attrsQuery = attrsToQuery(descriptor.template.attrs); | ||
const attrsQuery = attrsToQuery(descriptor.template.attrs, 'js', true); | ||
const query = `?vue&type=template${idQuery}${srcQuery}${scopedQuery}${attrsQuery}`; | ||
templateRequest = _(src + query); | ||
templateImport = `import { ${isServer ? 'ssrRender' : 'render'} } from ${templateRequest}`; | ||
templateImport = `import { ${renderFnName} } from ${templateRequest}`; | ||
} | ||
@@ -447,5 +458,9 @@ return templateImport; | ||
} | ||
function normalizeSourceMap(map) { | ||
function normalizeSourceMap(map, id) { | ||
if (!map) | ||
return null; | ||
if (!id.includes('type=script')) { | ||
map.file = id; | ||
map.sources[0] = id; | ||
} | ||
return { | ||
@@ -452,0 +467,0 @@ ...map, |
{ | ||
"name": "rollup-plugin-vue", | ||
"version": "6.0.0-beta.10", | ||
"version": "6.0.0-beta.11", | ||
"license": "MIT", | ||
@@ -28,2 +28,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@types/debug": "^4.1.5", | ||
@@ -39,2 +40,3 @@ "@types/jest": "^25.2.3", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-postcss": "^3.1.8", | ||
"ts-jest": "^26.0.0", | ||
@@ -41,0 +43,0 @@ "typescript": "^3.9.3" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23687
14
5
498