text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>sole.warn(
`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`
)
}
<|fim_prefix|>const hasWarned: Record<string, boolean> = {}
export function warnO<|fim_middle|>nce(msg: string) {
const isNodeProd =
typeof process !== 'undefined' && process.env.NODE_ENV === 'production'
if ... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { BindingTypes } from '../src/types'
import { compile, assertCode } from './util'
describe('SFC compile <script setup>', () => {
test('should expose top level declarations', () => {
const { content, bindings } = compile(`
<script setup>
import { x } from './x'
let a = 1
... | fim | vuejs/vue | typescript |
<|fim_suffix|> () => async (result: any) => result
)
]
})
expect(result.errors).toHaveLength(1)
})
test('async postcss plugin', async () => {
const promise = compileStyleAsync({
id: 'v-scope-xxx',
filename: 'example.vue',
source: '.foo { color: red }',
scoped: false,
postcssPlugi... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { parse } from '../src/parse'
import { SFCBlock } from '../src/parseComponent'
import { compileTemplate } from '../src/compileTemplate'
import Vue from 'vue'
function mockRender(code: string, mocks: Record<string, any> = {}) {
const fn = new Function(
`<|fim_suffix|>pect(result.errors.length... | fim | vuejs/vue | typescript |
<|fim_suffix|>mpile(
`<script setup>
let a = 100
let b = 200
let foo = 300
</script>\n` +
`<style>
p{
width: calc(v-bind(foo) - 3px);
height: calc(v-bind('foo') - 3px);
top: calc(v-bind(foo + 'px') - 3px);
}
... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { WarningMessage } from 'types/compiler'
import { parseComponent } from '../src/parseComponent'
describe('Single File Component parser', () => {
it('should parse', () => {
const res = parseComponent(
`
<template>
<div>hi</div>
</template>
<style src="./test.cs... | fim | vuejs/vue | typescript |
<|fim_suffix|> "
`)
})
it('setup bindings', () => {
const { render } = compile(`<div @click="count++">{{ count }}</div>`)
const result = format(
prefixIdentifiers(toFn(render), false, false, undefined, {
count: BindingTypes.SETUP_REF
}),
{
semi: false,
parser: 'babel'
}
)
... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { rewriteDefault } from '../src'
describe('compiler sfc: rewriteDefault', () => {
test('without export default', () => {
expect(rewriteDefault(`export a = {}`, 'script')).toMatchInlineSnapshot(`
"export a = {}
const script = {}"
`)
})
test('rewrite export default', () ... | fim | vuejs/vue | typescript |
<|fim_suffix|>:selection {')
})
test('spaces before pseudo element', () => {
const { code } = compileStyle({
source: '.abc, ::selection { color: red; }',
filename: 'test.css',
id: 'test'
})
expect(code).toContain('.abc[test],')
expect(code).toContain('[test]::selection {')
})
<|fim_prefix|>import ... | fim | vuejs/vue | typescript |
<|fim_suffix|> from '@babel/parser'
export const mockId = 'xxxxxxxx'
export function compile(
source: string,
options?: Partial<SFCScriptCompileOptions>,
parseOptions?: Partial<SFCParseOptions>
) {
const sfc = parse({
...parseOptions,
source
})
return compileScript(sfc, { id: mockId, ...options })... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { WebpackPlugin } from './types<|fim_suffix|>lugin'
declare const Plugin: WebpackPlugin
export = Plugin
<|fim_middle|>/p<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>try {
var vueVersion = require('vue').version
} catch (e) {}
var packageName = require('./package.json').name
var packageVersion = require('./package.json').version
if (vueVersion && vueVersion !== packageVersion) {
throw new Error(
'\n\nVue packages version mismatch:\n\n' +
'- vue@' +
... | fim | vuejs/vue | javascript |
<|fim_suffix|> const Plugin: WebpackPlugin
export = Plugin
<|fim_prefix|>import { WebpackPlugin } from './types/plug<|fim_middle|>in'
declare<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>import { createPromiseCallback } from '../util'
import { createBundleRunner } from './create-bundle-runner'
import type { Renderer, RenderOptions } from '../create-renderer'
import {
createSourceMapConsumers,
rewriteErrorTrace
} from './source-map-support'
const fs = require('fs')
const path = requir... | fim | vuejs/vue | typescript |
<|fim_suffix|>if (runInNewContext !== false && runInNewContext !== 'once') {
// new context mode: creates a fresh context and re-evaluate the bundle
// on each render. Ensures entire application state is fresh for each
// render, but incurs extra evaluation cost.
return (userContext = {}) =>
new P... | fim | vuejs/vue | typescript |
<|fim_prefix|>const SourceMapConsumer = require('source-map').SourceMapConsumer
const filenameRE = /\(([^)]+\.js):(\d+):(\d+)\)$/
export function createSourceMapConsumers(rawMaps: Object) {
const maps = {}
Object.keys(rawMaps).forEach(file => {
maps[file] = new SourceMapConsumer(rawMaps[file])
})
retu<|fi... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { baseOptions } from 'web/compiler/options'
import { createCompiler } from 'server/optimizing-compiler/in<|fim_suffix|>s)
export { compile as ssrCompile, compileToFunctions as ssrCompileToFunctions }
<|fim_middle|>dex'
const { compile, compileToFunctions } = createCompiler(baseOption<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>import { createWriteFunction } from './write'
import { createRenderFunction } from './render<|fim_suffix|> } from 'types/component'
export function createBasicRenderer({
modules = [],
directives = {},
isUnaryTag = () => false,
cache
}: RenderOptions = {}) {
const render = createRenderFunction(m... | fim | vuejs/vue | typescript |
import RenderStream from './render-stream'
import { createWriteFunction } from './write'
import { createRenderFunction } from './render'
import { createPromiseCallback } from './util'
import TemplateRenderer from './template-renderer/index'
import type { ClientManifest } from './template-renderer/index'
import type { C... | fim | vuejs/vue | typescript |
<|fim_prefix|>import show fro<|fim_suffix|>import model from './model'
export default {
show,
model
}
<|fim_middle|>m './show'
<|endoftext|> | fim | vuejs/vue | typescript |
import { looseEqual, looseIndexOf } from 'shared/util'
import type { VNodeDirective, VNodeWithData } from 'types/vnode'
// this is only applied for <select v-model> because it is the only edge case
// that must be done at runtime instead of compile time.
export default function model(node: VNodeWithData, dir: VNodeDir... | fim | vuejs/vue | typescript |
<|fim_suffix|>st style: any = node.data.style || (node.data.style = {})
if (Array.isArray(style)) {
style.push({ display: 'none' })
} else {
style.display = 'none'
}
}
}
<|fim_prefix|>import type { VNodeDirective, VNodeWithData } from 'types/vnode'
export defaul<|fim_middle|>t function show(n... | fim | vuejs/vue | typescript |
<|fim_suffix|>dex'
import directives from './directives/index'
import { isUnaryTag, canBeLeftOpenTag } from 'web/compiler/util'
import { createBasicRenderer } from 'server/create-basic-renderer'
export default createBasicRenderer({
// @ts-expect-error
modules,
directives,
isUnaryTag,
canBeLeftOpenTag
})
<|fi... | fim | vuejs/vue | typescript |
<|fim_suffix|>import {
createRenderer as _createRenderer,
Renderer,
RenderOptions
} from 'server/create-renderer'
import { createBundleRendererCreator } from 'server/bundle-renderer/create-bundle-renderer'
export function createRenderer(
options: RenderOptions | undefined = {}
): Renderer {
return _createRen... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { escape } from '../util'
import { isDef, isUndef, extend } from 'shared/util'
import {
isBooleanAttr,
isEnumeratedAttr,
isFalsyAttrValue,
convertEnumeratedValue
} from 'web/util/attrs'
import { isSSRUnsafeAttr } from '../util'
import type { VNodeWithData } from 'types/vnode'
export def... | fim | vuejs/vue | typescript |
<|fim_suffix|>lassList !== '') {
return ` class="${escape(classList)}"`
}
}
<|fim_prefix|>import { escape } from '../util'
import { genClass<|fim_middle|>ForVnode } from 'web/util/index'
import type { VNodeWithData } from 'types/vnode'
export default function renderClass(node: VNodeWithData): string | undefined ... | fim | vuejs/vue | typescript |
<|fim_suffix|>d, undefined, undefined, text)
child.raw = raw
node.children = [child]
}
<|fim_prefix|>import VNode from 'core/vdom/vnode'
import { renderAttr } from './attrs'
import { isDef, isUndef, extend, toString } from 'shared/util'
import { propsToAttrMap, isRenderableAttr } from '../util'
import type { VNodeW... | fim | vuejs/vue | typescript |
<|fim_prefix|>import attrs from './attrs'
import domProps from './dom-props'
import<|fim_suffix|>omProps, klass, style]
<|fim_middle|> klass from './class'
import style from './style'
export default [attrs, d<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_suffix|>g, value: any): string {
if (
typeof value === 'string' ||
(typeof value === 'number' && noUnitNumericStyleProps[key]) ||
value === 0
) {
return `${key}:${value};`
} else {
// invalid values
return ``
}
}
export default function renderStyle(vnode: VNodeWithData): string | ... | fim | vuejs/vue | typescript |
<|fim_prefix|>// The SSR codegen is essentially extending the default codegen to handle
// SSR-optimizable nodes and turn them into string render fns. In cases where
// a node is not optimizable it simply falls back to the default codegen.
import {
genIf,
genFor,
genData,
genText,
genElement,
genChildren,
... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { parse } from 'compiler/parser/index'
import { generate } from './codegen'
import { optimize } from './optimizer'
import { createCompilerCreator } from 'compiler/create-compiler'
import { CompiledResult, CompilerOptions } from 'types/compiler'
export const createCompiler = createCompilerCreator(f... | fim | vuejs/vue | typescript |
<|fim_suffix|>urn [{ type: RAW, value: ` style=${JSON.stringify(staticStyle)}` }]
} else {
return [
{
type: EXPRESSION,
value: `_ssrStyle(${parsedStaticStyle || 'null'},${
styleBinding || 'null'
}, ${
vShowExpression
? `{ display: (${vShowExpression}) ... | fim | vuejs/vue | typescript |
<|fim_prefix|>/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than stati... | fim | vuejs/vue | typescript |
<|fim_prefix|>import {
escape,
isSSRUnsafeAttr,
propsToAttrMap,
isRenderableAttr
} from '../util'
import { isObject, extend } from 'shared/util'
import { renderAttr } from '../modules/attrs'
import { renderClass } from 'web/util/class'
import { genStyle } from '../modules/style'
import { normalizeStyleBinding }... | fim | vuejs/vue | typescript |
<|fim_prefix|>import VNode from 'core/vdom/vnode'
import { isUndef } from 'shared/util'
import { Component } from 'types/component'
type RenderState =
| {
type: 'Element'
rendered: number
total: number
children: Array<VNode>
endTag: string
}
| {
type: 'Fragment'
render... | fim | vuejs/vue | typescript |
<|fim_suffix|>: number) {
this.expectedSize = n
// it's possible that the last chunk added bumped the buffer up to > 2 * n,
// which means we will need to go through multiple read calls to drain it
// down to < n.
if (isTrue(this.done)) {
this.push(null)
return
}
if (this.buffer.... | fim | vuejs/vue | typescript |
<|fim_suffix|>.activeInstance
))
normalizeRender(child)
const resolve = () => {
const childNode = child._render()
childNode.parent = node
context.renderStates.push({
type: 'Component',
prevActive
})
if (isDef(node.data) && isDef(node.data.directives)) {
childNode.data = chil... | fim | vuejs/vue | typescript |
<|fim_suffix|>fileIndices.forEach(index => {
const file = clientManifest.all[index]
// only include async files or non-js, non-css assets
if (
file &&
(clientManifest.async.indexOf(file) > -1 ||
!/\.(js|css)($|\?)/.test(file))
) {
files.push(file)
}
})... | fim | vuejs/vue | typescript |
<|fim_prefix|>const path = require('path')
const serialize = require('serialize-javascript')
import { isJS, isCSS } from '../util'
import TemplateStream from './template-stream'
import { parseTemplate } from './parse-template'
import { createMapper } from './create-async-file-mapper'
import type { ParsedTemplate } fro... | fim | vuejs/vue | typescript |
<|fim_prefix|>const compile = require('lodash.template')
const compileOptions = {
escape: /{{([^{][\s\S]+?[^}])}}/g,
<|fim_suffix|>n template.`)
}
if (i < 0) {
i = template.indexOf('<body>')
if (i < 0) {
i = j
}
}
return {
head: compile(template.slice(0, i), compileOptions),
neck... | fim | vuejs/vue | typescript |
// const Transform = require("stream").Transform;
import type TemplateRenderer from './index'
import type { ParsedTemplate } from './parse-template'
import { Transform } from 'stream'
export default class TemplateStream extends Transform {
started: boolean
renderer: TemplateRenderer
template: ParsedTemplate
co... | fim | vuejs/vue | typescript |
<|fim_suffix|>): boolean => {
return (
isAttr(name) || name.indexOf('data-') === 0 || name.indexOf('aria-') === 0
)
}
export { isRenderableAttr }
export const propsToAttrMap = {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
}
const ESC = {
'<': '<',
... | fim | vuejs/vue | typescript |
<|fim_suffix|> assetModules.forEach(m => {
if (m.chunks.some(id => id === cid)) {
files.push.apply(files, m.assets.map(fileToIndex))
}
})
}
})
const json = JSON.stringify(manifest, null, 2)
//@ts-expect-error no type on options
compi... | fim | vuejs/vue | typescript |
import { validate, isJS, getAssetName, onEmit } from './util'
export default class VueSSRServerPlugin {
constructor(options = {}) {
//@ts-expect-error
this.options = Object.assign(
{
filename: 'vue-ssr-server-bundle.json'
},
options
)
}
apply(compiler) {
validate(compil... | fim | vuejs/vue | typescript |
<|fim_suffix|>bpack5) {
// Webpack >= 5.0.0
compiler.hooks.compilation.tap(name, compilation => {
if (compilation.compiler !== compiler) {
// Ignore child compilers
return
}
const stage = webpack.Compilation[stageName]
compilation.hooks.processAssets.tapAsync(
{ n... | fim | vuejs/vue | typescript |
<|fim_prefix|>const MAX_STACK_DEPTH = 800
const noop = _ => _
const defer =
typeof process !== 'undefined' && process.nextTick
? process.nextTick
: typeof Promise !== 'undefined'
? f<|fim_suffix|>
const waitForNext = write(text, next)
if (waitForNext !== true) {
if (stackDepth >= MAX_STACK_... | fim | vuejs/vue | typescript |
<|fim_prefix|>const hash = require('hash-sum')
module.exports = function (code) {
const id = hash(this.request) // simulat<|fim_suffix|>('__MODULE_ID__', id)
}
<|fim_middle|>ing vue-loader module id injection
return code.replace<|endoftext|> | fim | vuejs/vue | javascript |
<|fim_prefix|>import path from 'path'
import webpack from 'webpack'
import MemoryFS from 'memory-fs'
import { RenderOptions } from 'server/create-renderer'
import { createBundleRenderer } from 'server/index'
import VueSSRServerPlugin from 'server/webpack-plugin/server'
export function compileWithWebpack(
file: strin... | fim | vuejs/vue | typescript |
<|fim_suffix|> return h('div', context.url)
}
})
)
})
}
<|fim_prefix|>import Vue from '../../../../dist/vue.runtime.common<|fim_middle|>.js'
export default context => {
return new Promise(resolve => {
context.msg = 'hello'
resolve(
new Vue({
render(h) {
<|endoftext|... | fim | vuejs/vue | javascript |
<|fim_suffix|>turn h('div', 'async bar')
}
}
<|fim_prefix|>module.exports = {
beforeCreate() {
this.$vnode.ssrContext._registeredC<|fim_middle|>omponents.add('__MODULE_ID__')
},
render(h) {
re<|endoftext|> | fim | vuejs/vue | javascript |
<|fim_prefix|>// import image and font
import './test.css'
import font from './test.woff2'
import image from './test.png'
export default {
beforeCreate() {
this.$vnode.ssrContext._registeredComponents.add('__MODU<|fim_suffix|>,
render(h) {
return h('div', `async ${font} ${image}`)
}
}
<|fim_middle|>LE_ID... | fim | vuejs/vue | javascript |
<|fim_suffix|> props: { id: 1 } })
})
)
}
<|fim_prefix|>import Vue from '../../../../dist/vue.runtime.common.js'
const app = {
name: 'app',
props: ['id'],
serverCacheKey: props => (props.id === 1 ? false : props.id),
render(h) {
return h('div', '/test')
}
}
export default () => {
r<|fim_middle|>... | fim | vuejs/vue | javascript |
<|fim_prefix|>import Vue from '../../../../dist/vue.runtime.common.js'
const app = {
name: 'app',
props: ['id'],
serverCacheKey: props => props.id,
render(h) {
return h('div', '/test')
}
}
export default () =<|fim_suffix|>olve(
new Vue({
render: h => h(app, { props: { id: 1 } })
})
)
}
<... | fim | vuejs/vue | javascript |
<|fim_suffix|>r('foo')
<|fim_prefix|>throw new<|fim_middle|> Erro<|endoftext|> | fim | vuejs/vue | javascript |
<|fim_suffix|>rn Promise.resolve(
new Vue({
render: h => h(app, { props: { id: 1 } })
})
)
}
<|fim_prefix|>import Vue from '../../../../dist/vue.runtime.common.js'
function createRegisterFn(id) {
return function (context) {
context = context || this.$vnode.ssrContext
context.registered.push(i... | fim | vuejs/vue | javascript |
<|fim_suffix|>foo'))
}
<|fim_prefix|>export default () => {
return Promise.reject(new Error(<|fim_middle|>'<|endoftext|> | fim | vuejs/vue | javascript |
<|fim_suffix|>e render sync
Foo.resolved = Vue.extend(comp.default)
resolve(vm)
})
})
}
<|fim_prefix|>import Vue from '../../../../dist/vue.runtime.common.js'
// async component!
const Foo = () => import('./async-foo')
const Bar = () => import('./async-bar') // eslint-disable-line
export default con... | fim | vuejs/vue | javascript |
<|fim_suffix|>ect(err).toBeNull()
expect(ssrContext).toBeUndefined()
done()
}
)
})
})
<|fim_prefix|>// @vitest-environment node
import Vue from 'vue'
import renderToString from 'server/index-basic'
import { _it } from './utils'
describe('SSR: basicRenderer', () => {
_it('should work', do... | fim | vuejs/vue | typescript |
<|fim_suffix|>ct(setArgs[1].html).toBe(expected)
expect(cache[key].html).toBe(expected)
const res2 = await renderer.renderToString()
expect(res2).toBe(expected)
expect(get.mock.calls.length).toBe(2)
expect(set.mock.calls.length).toBe(1)
})
it('render with cache (get/set/has)', async () => {
... | fim | vuejs/vue | typescript |
<|fim_suffix|> mockNt
})
return {
test
}
}
})
await nextTick()
expect(
`"RangeError: Maximum call stack size exceeded"`
).not.toHaveBeenWarned()
})
it('should work on objects sets with set()', () => {
const state = ref<any>({})
set(state.v... | fim | vuejs/vue | typescript |
<|fim_suffix|>ents', done => {
const padding = new Array(20000).join('x')
const component1 = new Vue({
template: `<div>${padding}<div></div></div>`,
_scopeId: '_component1'
})
const component2 = new Vue({
template: `<div></div>`,
_scopeId: '_component2'
})
const stream1 =... | fim | vuejs/vue | typescript |
<|fim_prefix|>// @vitest-environment node
import Vue from 'vue'
import VM from 'vm'
import { createRenderer } from 'server/index'
import { _it } from './utils'
const { renderToString } = createRenderer()
describe('SSR: renderToString', () => {
_it('static attributes', done => {
renderVmWithOptions(
{
... | fim | vuejs/vue | typescript |
<|fim_prefix|>// @vitest-environment node
import Vue from 'vue'
import {
compileWithWebpack,
createWebpackBundleRenderer
} from './compile-with-webpack'
import { createRenderer } from 'server/index'
import VueSSRClientPlugin from 'server/webpack-plugin/client'
import { RenderOptions } from 'server/create-renderer'... | fim | vuejs/vue | typescript |
<|fim_prefix|>/**
* Async callback style it for compatibility with old tests.
*/
export function _it(
desc: string,
runner: (d<|fim_suffix|>se<any>
) {
it(desc, async () => {
if (runner.length === 0) {
return runner(() => {})
}
await new Promise<void>((resolve, reject) => {
const res = r... | fim | vuejs/vue | typescript |
<|fim_prefix|>import Vue, { VNode, VNodeDirective } from 'vue'
import { Readable } from 'stream'
export declare function createRenderer(options?: RendererOptions): Renderer
export declare function createBundleRenderer(
bundle: string | object,
options?: BundleRendererOptions
): BundleRenderer
type RenderCallback... | fim | vuejs/vue | typescript |
import { DefinePlugin } from 'webpack'
interface WebpackPluginOptions {
filename?: string
}
export interface WebpackPlugin {
// NOTE NOT SURE ABOUT THIS
// TODO DOUBLE CHECK HERE
new (options?: WebpackPluginOptions): DefinePlugin
}
<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>import Vue, { VNode, VNodeDirective } from '../../../types/index'
import VueSSRClientPlugin from '../client-plugin'
import VueSSRServerPlugin from '../server-plugin'
import webpack from 'webpack'
import { readFileSync } from 'fs'
import { createRenderer, createBundleRenderer } from '.'
function createApp... | fim | vuejs/vue | typescript |
<|fim_prefix|>try {
var vueVersion = require('vue').version
} catch (e) {}
var packageName = require('./package.json').name
var packageVersion = require('./package.json').version
if (vueVersion && vueVersion !== packageVersion) {
var vuePath = require.resolv<|fim_suffix|> packageVersion +
' (' +
pac... | fim | vuejs/vue | javascript |
import { VNode } from 'vue'
/*
* Template compilation options / results
*/
interface CompilerOptions {
modules?: ModuleOptions[]
directives?: Record<string, DirectiveFunction>
preserveWhitespace?: boolean
whitespace?: 'preserve' | 'condense'
outputSourceRange?: any
}
interface CompilerOptionsWithSourceRan... | fim | vuejs/vue | typescript |
<|fim_prefix|>import Vue, { VNode } from 'vue'
import {
compile,
compileToFunctions,
ssrCompile,
ssrCompileToFunctions,
par<|fim_suffix|>s3 } = compile(`foo`, {
outputSourceRange: false
})
errors3.forEach(e => {
console.log(e.length)
})
const compiledFns = compileToFunctions('<div>hi</div>')
// can be p... | fim | vuejs/vue | typescript |
<|fim_prefix|>const path = require('path')
const resolve = p => path.resolve(__dirname, '../', p)
module.exports = {
vue: resolve('src/platforms/web/entry-runtime-with-compiler'),
compiler: resolve('src/compiler'),
core: resolve('src/core'),
<|fim_suffix|>ms/web'),
server: resolve('packages/server-renderer/sr... | fim | vuejs/vue | javascript |
<|fim_prefix|>const fs = require('fs')
const path = require('path')
const zlib = require('zlib')
const rollup = require('rollup')
const terser = require('terser')
if (!fs.existsSync('dist')) {
fs.mkdirSync('dist')
}
let builds = require('./config').getAllBuilds()
// filter builds via command line arg
if (process.a... | fim | vuejs/vue | javascript |
<|fim_suffix|> // Runtime+compiler development build (Browser)
'full-dev': {
entry: resolve('web/entry-runtime-with-compiler.ts'),
dest: resolve('dist/vue.js'),
format: 'umd',
env: 'development',
alias: { he: './entity-decoder' },
banner
},
// Runtime+compiler production build (Browser)
... | fim | vuejs/vue | javascript |
<|fim_suffix|>ND: false
}
<|fim_prefix|>module.exports = {
NEW_S<|fim_middle|>LOT_SYNTAX: true,
VBIND_PROP_SHORTHA<|endoftext|> | fim | vuejs/vue | javascript |
const version = process.argv[2] || process.env.VERSION
const cc = require('conventional-changelog')
const file = `./RELEASE_NOTE${version ? `_${version}` : ``}.md`
const fileStream = require('fs').createWriteStream(file)
cc({
preset: 'angular',
pkg: {
transform (pkg) {
pkg.version = `v${version}`
r... | fim | vuejs/vue | javascript |
<|fim_prefix|>const args = require('minimist')(process.argv.slice(2))
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const semver = require('semver')
const currentVersion = require('../package.json').version
const { prompt } = require('enquirer')
const execa = require('execa')
con... | fim | vuejs/vue | javascript |
<|fim_prefix|>const chalk = require('chalk')
const msgPath = process.env.GIT_PARAMS
const msg = require('fs').readFileSync(msgPath, 'utf-8').trim()
const commitRE =
/^(revert: )?(wip|release|feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/
if (!commitRE.test(msg)) {
... | fim | vuejs/vue | javascript |
<|fim_suffix|>
// push underline
const pad = start - (count - lineLength) + 1
const length = end > count ? lineLength - pad : end - start
res.push(` | ` + repeat(` `, pad) + repeat(`^`, length))
} else if (j > i) {
if (end > count) {
const length ... | fim | vuejs/vue | typescript |
<|fim_suffix|>icHandlers += `"${name}":${handlerCode},`
}
}
staticHandlers = `{${staticHandlers.slice(0, -1)}}`
if (dynamicHandlers) {
return prefix + `_d(${staticHandlers},[${dynamicHandlers.slice(0, -1)}])`
} else {
return prefix + staticHandlers
}
}
function genHandler(
handler: ASTElementHa... | fim | vuejs/vue | typescript |
<|fim_suffix|> if (parent.if) {
needsKey = true
}
parent = parent.parent
}
}
const generatedSlots = Object.keys(slots)
.map(key => genScopedSlot(slots[key], state))
.join(',')
return `scopedSlots:_u([${generatedSlots}]${
needsForceUpdate ? `,null,true` : ``
}${
!nee... | fim | vuejs/vue | typescript |
<|fim_suffix|> $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)![0].length
warn = (
msg: WarningMessage | string,
range: { start: number; end: number },
tip: string
) => {
const data: WarningMessage = typeof msg === 'stri... | fim | vuejs/vue | typescript |
<|fim_suffix|>odifiers && dir.modifiers.sync ? ',true' : ''})`
}
}
<|fim_prefix|>import { ASTDirective, ASTElement } fr<|fim_middle|>om 'types/compiler'
export default function bind(el: ASTElement, dir: ASTDirective) {
el.wrapData = (code: string) => {
return `_b(${code},'${el.tag}',${dir.value},${
dir.m... | fim | vuejs/vue | typescript |
<|fim_suffix|>ult {
on,
bind,
cloak: noop
}
<|fim_prefix|>import on from './on'
import bind from './bind'
import { noop } from 'shared/util'
<|fim_middle|>
export defa<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>import { ASTElement, ASTModifiers } from 'types/compiler'
/**
* Cross-platform code generation for component v-model
*/
export function genComponentModel(
el: ASTElement,
value: string,
modifiers: ASTModifiers | null
): void {
const { number, trim } = modifiers || {}
const baseValueExpressio... | fim | vuejs/vue | typescript |
<|fim_suffix|>ment does not support modifiers.`)
}
el.wrapListeners = (code: string) => `_g(${code},${dir.value})`
}
<|fim_prefix|>import { warn } from 'core/util/index'
import { ASTDi<|fim_middle|>rective, ASTElement } from 'types/compiler'
export default function on(el: ASTElement, dir: ASTDirective) {
if (__D... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { ASTElement, ASTNode } from 'types/compiler'
import { dirRE, onRE } from './parser/index'
type Range = { start?: number; end?: number }
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
const prohibitedKeywordRE = new RegExp(
'\... | fim | vuejs/vue | typescript |
import { emptyObject } from 'shared/util'
import { ASTElement, ASTModifiers } from 'types/compiler'
import { parseFilters } from './parser/filter-parser'
type Range = { start?: number; end?: number }
/* eslint-disable no-unused-vars */
export function baseWarn(msg: string, range?: Range) {
console.error(`[Vue compi... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { parse } from './parser/index'
import { optimize } from './<|fim_suffix|>`createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
export const createCompil... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { makeMap, isBuiltInTag, cached, no } from 'shared/util'
import { ASTElement, CompilerOptions, ASTNode } from 'types/compiler'
let isStaticKey
let isPlatformReservedTag
con<|fim_suffix|>vedTag = options.isReservedTag || no
// first pass: mark all non-static nodes.
markStatic(root)
// second... | fim | vuejs/vue | typescript |
let decoder
export default {
decode(html: string): string {
decoder = decoder || document.createElement('div')
decoder.innerHTML = html
return decoder.textContent
}
}
<|endoftext|> | fim | vuejs/vue | typescript |
const validDivisionCharRE = /[\w).+\-_$\]]/
export function parseFilters(exp: string): string {
let inSingle = false
let inDouble = false
let inTemplateString = false
let inRegex = false
let curly = 0
let square = 0
let paren = 0
let lastFilterIndex = 0
let c, prev, i, expression, filters
for (i =... | fim | vuejs/vue | typescript |
/**
* Not type-checking this file because it's mostly vendor code.
*/
/*!
* HTML Parser By John Resig (ejohn.org)
* Modified by Juriy "kangax" Zaytsev
* Original code by Erik Arvidsson (MPL-1.1 OR Apache-2.0 OR GPL-2.0-or-later)
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*/
import { makeMap, no... | fim | vuejs/vue | typescript |
import he from 'he'
import { parseHTML } from './html-parser'
import { parseText } from './text-parser'
import { parseFilters } from './filter-parser'
import { genAssignmentCode } from '../directives/model'
import { extend, cached, no, camelize, hyphenate } from 'shared/util'
import { isIE, isEdge, isServerRendering } ... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { cached } from 'shared/util'
import { parseFilters } from './filter-parser'
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
const buildRegex = cached(delimiters => {
const open = delimiters[0].replace(regexEscapeRE, '\\$&')
const close = delimit... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { noop, extend } from 'shared/util'
import { warn as baseWarn, tip } from 'core/util/debug'
import { generateCodeFrame } from './codeframe'
import type { Component } from 'types/component'
import { CompilerOptions } from 'types/compiler'
type CompiledFunctionResult = {
render: Function
staticR... | fim | vuejs/vue | typescript |
<|fim_prefix|>import Kee<|fim_suffix|>xport default {
KeepAlive
}
<|fim_middle|>pAlive from './keep-alive'
e<|endoftext|> | fim | vuejs/vue | typescript |
<|fim_prefix|>import { isRegExp, isArray, remove } from 'shared/util'
import { getFirstComponentChild } from 'core/vdom/helpers/index'
import type VNode from 'core/vdom/vnode'
import type { VNodeComponentOptions } from 'types/vnode'
import type { Component } from 'types/component'
import { getComponentName } from '../v... | fim | vuejs/vue | typescript |
<|fim_prefix|>import { no, noop, identity } from 'shared/util'
import { LIFECYCLE_HOOKS } from 'shared/constants'
import type { Component } from 'types/component'
/**
* @internal
*/
export interface Config {
// user
optionMergeStrategies: { [key: string]: Function }
silent: boolean
productionTip: boolean
... | fim | vuejs/vue | typescript |
<|fim_suffix|>pdate: definition }
}
this.options[type + 's'][id] = definition
return definition
}
}
})
}
<|fim_prefix|>import { ASSET_TYPES } from 'shared/constants'
import type { GlobalAPI } from 'types/global-api'
import { isFunction, isPlainObject, validateComponentName } from '..... | fim | vuejs/vue | typescript |
<|fim_suffix|>f Component) {
const computed = Comp.options.computed
for (const key in computed) {
defineComputed(Comp.prototype, key, computed[key])
}
}
<|fim_prefix|>import { ASSET_TYPES } from 'shared/constants'
import type { Component } from 'types/component'
import type { GlobalAPI } from 'types/global-ap... | fim | vuejs/vue | typescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.