Skip to content

Commit

Permalink
remove bad vue template compiler option (#1101)
Browse files Browse the repository at this point in the history
fix #1100

Co-authored-by: Zhang Visper <[email protected]>
  • Loading branch information
coolzjy and Zhang Visper authored Sep 21, 2020
1 parent 20388e4 commit 4329d56
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
1 change: 0 additions & 1 deletion plugins/plugin-vue/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ module.exports = function plugin(snowpackConfig) {
preprocessLang: descriptor.template.lang,
compilerOptions: {
scopeId: descriptor.styles.some((s) => s.scoped) ? `data-v-${id}` : null,
runtimeModuleName: '/web_modules/vue.js',
},
});
if (js.errors && js.errors.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const defaultExport = defineComponent({
const name = \\"VueContentTs\\";
}
});
import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"/web_modules/vue.js\\"
import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) {
return (_openBlock(), _createBlock(\\"h1\\", null, \\"Vue Content Ts\\"))
Expand Down
6 changes: 3 additions & 3 deletions plugins/plugin-vue/test/__snapshots__/plugin.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const defaultExport = {
}
};
import { createVNode as _createVNode, createTextVNode as _createTextVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createBlock as _createBlock } from \\"/web_modules/vue.js\\"
import { createVNode as _createVNode, createTextVNode as _createTextVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
const _hoisted_1 = { class: \\"App\\" }
const _hoisted_2 = { class: \\"App-header\\" }
Expand Down Expand Up @@ -93,7 +93,7 @@ Object {
},
".js": Object {
"code": "const defaultExport = {};
import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"/web_modules/vue.js\\"
import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
export function render(_ctx, _cache) {
return (_openBlock(), _createBlock(\\"h1\\", null, \\"Vue Content Only Tpl\\"))
Expand Down Expand Up @@ -153,7 +153,7 @@ const defaultExport = {
}
};
import { createVNode as _createVNode, createTextVNode as _createTextVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createBlock as _createBlock } from \\"/web_modules/vue.js\\"
import { createVNode as _createVNode, createTextVNode as _createTextVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\"
const _hoisted_1 = { class: \\"App\\" }
const _hoisted_2 = { class: \\"App-header\\" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9512,6 +9512,36 @@ function normalizeClass(value) {
}
return res.trim();
}
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
const toDisplayString = (val) => {
return val == null
? ''
: isObject(val)
? JSON.stringify(val, replacer, 2)
: String(val);
};
const replacer = (_key, val) => {
if (val instanceof Map) {
return {
[\`Map(\${val.size})\`]: [...val.entries()].reduce((entries, [key, val]) => {
entries[\`\${key} =>\`] = val;
return entries;
}, {})
};
}
else if (val instanceof Set) {
return {
[\`Set(\${val.size})\`]: [...val.values()]
};
}
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => { };
Expand Down Expand Up @@ -9544,6 +9574,7 @@ const toTypeString = (value) => objectToString.call(value);
const toRawType = (value) => {
return toTypeString(value).slice(8, -1);
};
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
const isIntegerKey = (key) => isString(key) && key[0] !== '-' && '' + parseInt(key, 10) === key;
const isReservedProp = /*#__PURE__*/ makeMap('key,ref,' +
'onVnodeBeforeMount,onVnodeMounted,' +
Expand Down Expand Up @@ -10881,6 +10912,26 @@ function closeBlock() {
blockStack.pop();
currentBlock = blockStack[blockStack.length - 1] || null;
}
/**
* Create a block root vnode. Takes the same exact arguments as \`createVNode\`.
* A block root keeps track of dynamic nodes within the block in the
* \`dynamicChildren\` array.
*
* @private
*/
function createBlock(type, props, children, patchFlag, dynamicProps) {
const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);
// save current block children on the block vnode
vnode.dynamicChildren = currentBlock || EMPTY_ARR;
// close block
closeBlock();
// a block is always going to be patched, so track it as a child of its
// parent block
if ( currentBlock) {
currentBlock.push(vnode);
}
return vnode;
}
function isVNode(value) {
return value ? value.__v_isVNode === true : false;
}
Expand Down Expand Up @@ -14186,5 +14237,5 @@ function normalizeContainer(container) {
}
return container;
}
export { createApp };"
export { createApp, createBlock, createTextVNode, createVNode, openBlock, toDisplayString };"
`;

1 comment on commit 4329d56

@vercel
Copy link

@vercel vercel bot commented on 4329d56 Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.