vue-inbrowser-compiler
Advanced tools
Comparing version 4.60.0 to 4.62.0
# Change Log | ||
## 4.62.0 | ||
### Minor Changes | ||
- [#1498](https://github.com/vue-styleguidist/vue-styleguidist/pull/1498) [`1990d7f8`](https://github.com/vue-styleguidist/vue-styleguidist/commit/1990d7f8c4601a2af5160aff9e29d12e3e57f727) Thanks [@elevatebart](https://github.com/elevatebart)! - resolve setup imported components | ||
### Patch Changes | ||
- Updated dependencies [[`1990d7f8`](https://github.com/vue-styleguidist/vue-styleguidist/commit/1990d7f8c4601a2af5160aff9e29d12e3e57f727)]: | ||
- vue-inbrowser-compiler-utils@4.62.0 | ||
## 4.60.0 | ||
@@ -4,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { parseComponent } from 'vue-inbrowser-compiler-utils'; | ||
import { parseComponent, EvaluableComponent } from 'vue-inbrowser-compiler-utils'; | ||
export declare function parseScriptCode(code: string): { | ||
@@ -16,6 +16,2 @@ preprocessing?: string; | ||
*/ | ||
export default function normalizeSfcComponent(code: string, _parseComponent?: typeof parseComponent): { | ||
script: string; | ||
style?: string; | ||
template?: string; | ||
}; | ||
export default function normalizeSfcComponent(code: string, _parseComponent?: typeof parseComponent): EvaluableComponent; |
@@ -187,3 +187,4 @@ 'use strict'; | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)) | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)), | ||
setup: !!scriptSetup | ||
}; | ||
@@ -230,2 +231,8 @@ } | ||
vueInbrowserCompilerUtils.compileTemplateForEval(compiledComponent); | ||
if (nonCompiledComponent.setup && vueInbrowserCompilerUtils.isVue3) { | ||
vueInbrowserCompilerUtils.compileTemplateForEvalSetup(compiledComponent, code); | ||
} | ||
else { | ||
vueInbrowserCompilerUtils.compileTemplateForEval(compiledComponent); | ||
} | ||
return Object.assign(Object.assign({}, compiledComponent), { raw: nonCompiledComponent }); | ||
@@ -251,3 +258,4 @@ } | ||
return { | ||
script: `${preprocessing};return {${component}};${postprocessing}` | ||
script: `${preprocessing};return {${component}};${postprocessing}`, | ||
setup: false | ||
}; | ||
@@ -325,3 +333,4 @@ } | ||
style, | ||
template: vueInbrowserCompilerUtils.isVue3 || !template ? template : `<div>${template}</div>` | ||
template: vueInbrowserCompilerUtils.isVue3 || !template ? template : `<div>${template}</div>`, | ||
setup: false | ||
}; | ||
@@ -328,0 +337,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { isVue3, parseComponent, transformOneImport, compileTemplateForEval, isCodeVueSfc } from 'vue-inbrowser-compiler-utils'; | ||
import { isVue3, parseComponent, transformOneImport, compileTemplateForEval, compileTemplateForEvalSetup, isCodeVueSfc } from 'vue-inbrowser-compiler-utils'; | ||
export { adaptCreateElement, addScopedStyle, compileTemplateForEval, concatenate, isCodeVueSfc, parseComponent } from 'vue-inbrowser-compiler-utils'; | ||
@@ -179,3 +179,4 @@ import walkes from 'walkes'; | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)) | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)), | ||
setup: !!scriptSetup | ||
}; | ||
@@ -222,2 +223,8 @@ } | ||
compileTemplateForEval(compiledComponent); | ||
if (nonCompiledComponent.setup && isVue3) { | ||
compileTemplateForEvalSetup(compiledComponent, code); | ||
} | ||
else { | ||
compileTemplateForEval(compiledComponent); | ||
} | ||
return Object.assign(Object.assign({}, compiledComponent), { raw: nonCompiledComponent }); | ||
@@ -243,3 +250,4 @@ } | ||
return { | ||
script: `${preprocessing};return {${component}};${postprocessing}` | ||
script: `${preprocessing};return {${component}};${postprocessing}`, | ||
setup: false | ||
}; | ||
@@ -317,3 +325,4 @@ } | ||
style, | ||
template: isVue3 || !template ? template : `<div>${template}</div>` | ||
template: isVue3 || !template ? template : `<div>${template}</div>`, | ||
setup: false | ||
}; | ||
@@ -320,0 +329,0 @@ } |
{ | ||
"name": "vue-inbrowser-compiler", | ||
"version": "4.60.0", | ||
"version": "4.62.0", | ||
"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.56.5", | ||
"vue-inbrowser-compiler-utils": "^4.62.0", | ||
"walkes": "^0.2.1" | ||
@@ -25,0 +25,0 @@ }, |
@@ -8,3 +8,4 @@ import { transform, TransformOptions } from 'buble' | ||
compileTemplateForEval, | ||
transformOneImport | ||
transformOneImport, | ||
compileTemplateForEvalSetup | ||
} from 'vue-inbrowser-compiler-utils' | ||
@@ -51,2 +52,8 @@ import normalizeSfcComponent, { | ||
if(nonCompiledComponent.setup && isVue3) { | ||
compileTemplateForEvalSetup(compiledComponent, code) | ||
} else { | ||
compileTemplateForEval(compiledComponent) | ||
} | ||
return { | ||
@@ -78,3 +85,4 @@ ...compiledComponent, | ||
return { | ||
script: `${preprocessing};return {${component}};${postprocessing}` | ||
script: `${preprocessing};return {${component}};${postprocessing}`, | ||
setup: false | ||
} | ||
@@ -160,4 +168,5 @@ } | ||
style, | ||
template: isVue3 || !template ? template : `<div>${template}</div>` | ||
template: isVue3 || !template ? template : `<div>${template}</div>`, | ||
setup: false | ||
} | ||
} |
import walkes from 'walkes' | ||
import { parseComponent, isVue3, transformOneImport } from 'vue-inbrowser-compiler-utils' | ||
import { parseComponent, isVue3, transformOneImport, EvaluableComponent } from 'vue-inbrowser-compiler-utils' | ||
import getAst from './getAst' | ||
@@ -151,7 +151,3 @@ | ||
*/ | ||
export default function normalizeSfcComponent(code: string, _parseComponent = parseComponent): { | ||
script: string | ||
style?: string | ||
template?: string | ||
} { | ||
export default function normalizeSfcComponent(code: string, _parseComponent = parseComponent): EvaluableComponent { | ||
const { script, scriptSetup, template, styles } = _parseComponent(code) | ||
@@ -175,4 +171,5 @@ | ||
script: [preprocessing, `return {${component}}`, postprocessing].join('\n'), | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)) | ||
style: buildStyles(styles.map(styleBlock => styleBlock.content)), | ||
setup: !!scriptSetup | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
84074
1867