vue-inbrowser-compiler
Advanced tools
Comparing version 4.53.1 to 4.54.1
# Change Log | ||
## 4.54.1 | ||
### Patch Changes | ||
- [#1397](https://github.com/vue-styleguidist/vue-styleguidist/pull/1397) [`c9cf522d`](https://github.com/vue-styleguidist/vue-styleguidist/commit/c9cf522d4a1ea574feeb751477ba4edbd247b20d) Thanks [@elevatebart](https://github.com/elevatebart)! - fix: editor sfc issues | ||
- Updated dependencies [[`c9cf522d`](https://github.com/vue-styleguidist/vue-styleguidist/commit/c9cf522d4a1ea574feeb751477ba4edbd247b20d)]: | ||
- vue-inbrowser-compiler-utils@4.54.1 | ||
## 4.53.1 | ||
@@ -4,0 +13,0 @@ |
@@ -104,9 +104,2 @@ 'use strict'; | ||
}; | ||
function getSingleFileComponentParts(code) { | ||
const parts = vueInbrowserCompilerUtils.parseComponent(code); | ||
if (parts.script) { | ||
parts.script = parts.script.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, '$1'); | ||
} | ||
return parts; | ||
} | ||
function parseScriptCode(code) { | ||
@@ -191,8 +184,9 @@ let preprocessing = ''; | ||
function normalizeSfcComponent(code) { | ||
const parts = getSingleFileComponentParts(code); | ||
const { preprocessing = '', component = '', postprocessing = '' } = parts.script ? parseScriptCode(parts.script) : {}; | ||
var _a; | ||
const parts = vueInbrowserCompilerUtils.parseComponent(code); | ||
const { preprocessing = '', component = '', postprocessing = '' } = parts.script ? parseScriptCode(parts.script.content) : {}; | ||
return { | ||
template: parts.template, | ||
template: (_a = parts.template) === null || _a === void 0 ? void 0 : _a.content, | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(parts.styles) | ||
style: buildStyles(parts.styles.map(styleBlock => styleBlock.content)) | ||
}; | ||
@@ -199,0 +193,0 @@ } |
@@ -96,9 +96,2 @@ import { isVue3, parseComponent, compileTemplateForEval, isCodeVueSfc } from 'vue-inbrowser-compiler-utils'; | ||
}; | ||
function getSingleFileComponentParts(code) { | ||
const parts = parseComponent(code); | ||
if (parts.script) { | ||
parts.script = parts.script.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, '$1'); | ||
} | ||
return parts; | ||
} | ||
function parseScriptCode(code) { | ||
@@ -183,8 +176,9 @@ let preprocessing = ''; | ||
function normalizeSfcComponent(code) { | ||
const parts = getSingleFileComponentParts(code); | ||
const { preprocessing = '', component = '', postprocessing = '' } = parts.script ? parseScriptCode(parts.script) : {}; | ||
var _a; | ||
const parts = parseComponent(code); | ||
const { preprocessing = '', component = '', postprocessing = '' } = parts.script ? parseScriptCode(parts.script.content) : {}; | ||
return { | ||
template: parts.template, | ||
template: (_a = parts.template) === null || _a === void 0 ? void 0 : _a.content, | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(parts.styles) | ||
style: buildStyles(parts.styles.map(styleBlock => styleBlock.content)) | ||
}; | ||
@@ -191,0 +185,0 @@ } |
{ | ||
"name": "vue-inbrowser-compiler", | ||
"version": "4.53.1", | ||
"version": "4.54.1", | ||
"description": "compile vue single file components right in your browser", | ||
@@ -22,3 +22,3 @@ "module": "lib/vue-inbrowser-compiler.esm.js", | ||
"detect-browser": "^5.2.0", | ||
"vue-inbrowser-compiler-utils": "^4.53.1", | ||
"vue-inbrowser-compiler-utils": "^4.54.1", | ||
"walkes": "^0.2.1" | ||
@@ -25,0 +25,0 @@ }, |
@@ -137,3 +137,3 @@ /* eslint-disable no-new-func */ | ||
`) | ||
).toThrowErrorMatchingInlineSnapshot(`"Unexpected token (8:11)"`) | ||
).toThrowErrorMatchingInlineSnapshot('"Unexpected token (2:11)"') | ||
}) | ||
@@ -160,5 +160,2 @@ | ||
const comp = (function() { | ||
@@ -165,0 +162,0 @@ return { |
@@ -21,10 +21,2 @@ import walkes from 'walkes' | ||
function getSingleFileComponentParts(code: string) { | ||
const parts = parseComponent(code) | ||
if (parts.script) { | ||
parts.script = parts.script.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, '$1') | ||
} | ||
return parts | ||
} | ||
export function parseScriptCode(code: string): { | ||
@@ -129,3 +121,3 @@ preprocessing?: string | ||
} { | ||
const parts = getSingleFileComponentParts(code) | ||
const parts = parseComponent(code) | ||
const { | ||
@@ -135,8 +127,8 @@ preprocessing = '', | ||
postprocessing = '' | ||
} = parts.script ? parseScriptCode(parts.script) : {} | ||
} = parts.script ? parseScriptCode(parts.script.content) : {} | ||
return { | ||
template: parts.template, | ||
template: parts.template?.content, | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(parts.styles) | ||
style: buildStyles(parts.styles.map(styleBlock => styleBlock.content)) | ||
} | ||
} |
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
81335
1852