repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/util.ts | packages/server-renderer/src/util.ts | import { makeMap } from 'shared/util'
const isAttr = makeMap(
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
'checked,cite,class,code,codebase,color,cols,colspan,content,' +
'contenteditable,contextmenu,c... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/index-basic.ts | packages/server-renderer/src/index-basic.ts | import modules from './modules/index'
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,
canBe... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/render-context.ts | packages/server-renderer/src/render-context.ts | 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'
rendered: number
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/index.ts | packages/server-renderer/src/index.ts | process.env.VUE_ENV = 'server'
import { extend } from 'shared/util'
import modules from './modules/index'
import baseDirectives from './directives/index'
import { isUnaryTag, canBeLeftOpenTag } from 'web/compiler/util'
import {
createRenderer as _createRenderer,
Renderer,
RenderOptions
} from 'server/create-ren... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/compiler.ts | packages/server-renderer/src/compiler.ts | import { baseOptions } from 'web/compiler/options'
import { createCompiler } from 'server/optimizing-compiler/index'
const { compile, compileToFunctions } = createCompiler(baseOptions)
export { compile as ssrCompile, compileToFunctions as ssrCompileToFunctions }
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/write.ts | packages/server-renderer/src/write.ts | const MAX_STACK_DEPTH = 800
const noop = _ => _
const defer =
typeof process !== 'undefined' && process.nextTick
? process.nextTick
: typeof Promise !== 'undefined'
? fn => Promise.resolve().then(fn)
: typeof setTimeout !== 'undefined'
? setTimeout
: noop
if (defer === noop) {
throw new Er... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/render-stream.ts | packages/server-renderer/src/render-stream.ts | /**
* Original RenderStream implementation by Sasha Aickin (@aickin)
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Modified by Evan You (@yyx990803)
*/
// const stream = require('stream')
import { Readable } from 'stream'
import { isTrue, isUndef } from 'share... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/optimizing-compiler/modules.ts | packages/server-renderer/src/optimizing-compiler/modules.ts | import {
RAW,
// INTERPOLATION,
EXPRESSION
} from './codegen'
import { propsToAttrMap, isRenderableAttr } from '../util'
import { isBooleanAttr, isEnumeratedAttr } from 'web/util/attrs'
import type { StringSegment } from './codegen'
import type { CodegenState } from 'compiler/codegen/index'
import { ASTAttr, A... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/optimizing-compiler/codegen.ts | packages/server-renderer/src/optimizing-compiler/codegen.ts | // 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,
CodegenState... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/optimizing-compiler/runtime-helpers.ts | packages/server-renderer/src/optimizing-compiler/runtime-helpers.ts | 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 } from 'web/uti... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/optimizing-compiler/index.ts | packages/server-renderer/src/optimizing-compiler/index.ts | 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(function baseCo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/optimizing-compiler/optimizer.ts | packages/server-renderer/src/optimizing-compiler/optimizer.ts | /**
* 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 static tree
* dete... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/webpack-plugin/client.ts | packages/server-renderer/src/webpack-plugin/client.ts | const hash = require('hash-sum')
const uniq = require('lodash.uniq')
import { isJS, isCSS, getAssetName, onEmit, stripModuleIdHash } from './util'
export default class VueSSRClientPlugin {
constructor(options = {}) {
//@ts-expect-error no type on options
this.options = Object.assign(
{
filename... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/webpack-plugin/util.ts | packages/server-renderer/src/webpack-plugin/util.ts | const { red, yellow } = require('chalk')
const webpack = require('webpack')
const prefix = `[vue-server-renderer-webpack-plugin]`
const warn = (exports.warn = msg => console.error(red(`${prefix} ${msg}\n`)))
const tip = (exports.tip = msg => console.log(yellow(`${prefix} ${msg}\n`)))
const isWebpack5 = !!(webpack.ver... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/webpack-plugin/server.ts | packages/server-renderer/src/webpack-plugin/server.ts | 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... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/modules/dom-props.ts | packages/server-renderer/src/modules/dom-props.ts | 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 { VNodeWithData } from 'types/vnode'
export default function renderDOMProps(node: VNodeWithData): string {
let... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/modules/class.ts | packages/server-renderer/src/modules/class.ts | import { escape } from '../util'
import { genClassForVnode } from 'web/util/index'
import type { VNodeWithData } from 'types/vnode'
export default function renderClass(node: VNodeWithData): string | undefined {
const classList = genClassForVnode(node)
if (classList !== '') {
return ` class="${escape(classList)... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/modules/attrs.ts | packages/server-renderer/src/modules/attrs.ts | 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 default function ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/modules/index.ts | packages/server-renderer/src/modules/index.ts | import attrs from './attrs'
import domProps from './dom-props'
import klass from './class'
import style from './style'
export default [attrs, domProps, klass, style]
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/modules/style.ts | packages/server-renderer/src/modules/style.ts | import { escape, noUnitNumericStyleProps } from '../util'
import { hyphenate } from 'shared/util'
import { getStyle } from 'web/util/style'
import type { VNodeWithData } from 'types/vnode'
export function genStyle(style: Object): string {
let styleText = ''
for (const key in style) {
const value = style[key]
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/template-renderer/create-async-file-mapper.ts | packages/server-renderer/src/template-renderer/create-async-file-mapper.ts | /**
* Creates a mapper that maps components used during a server-side render
* to async chunk files in the client-side build, so that we can inline them
* directly in the rendered HTML to avoid waterfall requests.
*/
import type { ClientManifest } from './index'
export type AsyncFileMapper = (files: Array<string>... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/template-renderer/parse-template.ts | packages/server-renderer/src/template-renderer/parse-template.ts | const compile = require('lodash.template')
const compileOptions = {
escape: /{{([^{][\s\S]+?[^}])}}/g,
interpolate: /{{{([\s\S]+?)}}}/g
}
export type ParsedTemplate = {
head: (data: any) => string
neck: (data: any) => string
tail: (data: any) => string
}
export function parseTemplate(
template: string,
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/template-renderer/template-stream.ts | packages/server-renderer/src/template-renderer/template-stream.ts | // 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... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/template-renderer/index.ts | packages/server-renderer/src/template-renderer/index.ts | 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 } from './parse-tem... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/bundle-renderer/create-bundle-renderer.ts | packages/server-renderer/src/bundle-renderer/create-bundle-renderer.ts | 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 = require('path')
cons... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/bundle-renderer/create-bundle-runner.ts | packages/server-renderer/src/bundle-renderer/create-bundle-runner.ts | import { isPlainObject } from 'shared/util'
const vm = require('vm')
const path = require('path')
const resolve = require('resolve')
const NativeModule = require('module')
function createSandbox(context?: any) {
const sandbox = {
Buffer,
console,
process,
setTimeout,
setInterval,
setImmediat... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/bundle-renderer/source-map-support.ts | packages/server-renderer/src/bundle-renderer/source-map-support.ts | 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])
})
return maps
}
export ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/directives/model.ts | packages/server-renderer/src/directives/model.ts | 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... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/directives/show.ts | packages/server-renderer/src/directives/show.ts | import type { VNodeDirective, VNodeWithData } from 'types/vnode'
export default function show(node: VNodeWithData, dir: VNodeDirective) {
if (!dir.value) {
const style: any = node.data.style || (node.data.style = {})
if (Array.isArray(style)) {
style.push({ display: 'none' })
} else {
style.d... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/directives/index.ts | packages/server-renderer/src/directives/index.ts | import show from './show'
import model from './model'
export default {
show,
model
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-template.spec.ts | packages/server-renderer/test/ssr-template.spec.ts | // @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'
const defaul... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/utils.ts | packages/server-renderer/test/utils.ts | /**
* Async callback style it for compatibility with old tests.
*/
export function _it(
desc: string,
runner: (done: (err?: Error) => void) => void | Promise<any>
) {
it(desc, async () => {
if (runner.length === 0) {
return runner(() => {})
}
await new Promise<void>((resolve, reject) => {
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/compile-with-webpack.ts | packages/server-renderer/test/compile-with-webpack.ts | 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: string,
extraConf... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-string.spec.ts | packages/server-renderer/test/ssr-string.spec.ts | // @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(
{
template:... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | true |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-stream.spec.ts | packages/server-renderer/test/ssr-stream.spec.ts | // @vitest-environment node
import Vue from 'vue'
import { createRenderer } from 'server/index'
import { _it } from './utils'
const { renderToStream } = createRenderer()
describe('SSR: renderToStream', () => {
_it('should render to a stream', done => {
const stream = renderToStream(
new Vue({
tem... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-reactivity.spec.ts | packages/server-renderer/test/ssr-reactivity.spec.ts | // @vitest-environment node
import Vue from 'vue'
import {
reactive,
ref,
isReactive,
shallowRef,
isRef,
set,
nextTick,
getCurrentInstance
} from 'v3'
import { createRenderer } from '../src'
describe('SSR Reactive', () => {
beforeEach(() => {
// force SSR env
global.process.env.VUE_ENV = 'se... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-basic-renderer.spec.ts | packages/server-renderer/test/ssr-basic-renderer.spec.ts | // @vitest-environment node
import Vue from 'vue'
import renderToString from 'server/index-basic'
import { _it } from './utils'
describe('SSR: basicRenderer', () => {
_it('should work', done => {
renderToString(
new Vue({
template: `
<div>
<p class="hi">yoyo</p>
<div id... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/test/ssr-bundle-render.spec.ts | packages/server-renderer/test/ssr-bundle-render.spec.ts | // @vitest-environment node
import { createWebpackBundleRenderer } from './compile-with-webpack'
describe('SSR: bundle renderer', () => {
createAssertions(true)
// createAssertions(false)
})
function createAssertions(runInNewContext) {
it('renderToString', async () => {
const renderer = await createWebpack... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/types/test.ts | packages/server-renderer/types/test.ts | 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(context: any)... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/types/plugin.d.ts | packages/server-renderer/types/plugin.d.ts | import { DefinePlugin } from 'webpack'
interface WebpackPluginOptions {
filename?: string
}
export interface WebpackPlugin {
// NOTE NOT SURE ABOUT THIS
// TODO DOUBLE CHECK HERE
new (options?: WebpackPluginOptions): DefinePlugin
}
| typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/types/index.d.ts | packages/server-renderer/types/index.d.ts | 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 = (err: Error... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/template-compiler/types/test.ts | packages/template-compiler/types/test.ts | import Vue, { VNode } from 'vue'
import {
compile,
compileToFunctions,
ssrCompile,
ssrCompileToFunctions,
parseComponent,
generateCodeFrame
} from '.'
// check compile options
const compiled = compile('<div>hi</div>', {
outputSourceRange: true,
preserveWhitespace: false,
whitespace: 'condense',
mod... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/template-compiler/types/index.d.ts | packages/template-compiler/types/index.d.ts | 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... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/babelUtils.ts | packages/compiler-sfc/src/babelUtils.ts | // https://github.com/vuejs/core/blob/main/packages/compiler-core/src/babelUtils.ts
// should only use types from @babel/types
// do not import runtime methods
import type {
Identifier,
Node,
Function,
ObjectProperty,
BlockStatement,
Program
} from '@babel/types'
import { walk } from 'estree-walker'
expor... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/cssVars.ts | packages/compiler-sfc/src/cssVars.ts | import { BindingMetadata } from './types'
import { SFCDescriptor } from './parseComponent'
import { PluginCreator } from 'postcss'
import hash from 'hash-sum'
import { prefixIdentifiers } from './prefixIdentifiers'
export const CSS_VARS_HELPER = `useCssVars`
export function genCssVarsFromList(
vars: string[],
id:... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/parse.ts | packages/compiler-sfc/src/parse.ts | import { SourceMapGenerator } from 'source-map'
import { RawSourceMap, TemplateCompiler } from './types'
import {
parseComponent,
VueTemplateCompilerParseOptions,
SFCDescriptor,
DEFAULT_FILENAME
} from './parseComponent'
import hash from 'hash-sum'
import LRU from 'lru-cache'
import { hmrShouldReload } from '.... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/parseComponent.ts | packages/compiler-sfc/src/parseComponent.ts | import deindent from 'de-indent'
import { parseHTML } from 'compiler/parser/html-parser'
import { makeMap } from 'shared/util'
import { ASTAttr, WarningMessage } from 'types/compiler'
import { BindingMetadata, RawSourceMap } from './types'
import type { ImportBinding } from './compileScript'
export const DEFAULT_FILEN... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/compileTemplate.ts | packages/compiler-sfc/src/compileTemplate.ts | import { BindingMetadata, TemplateCompiler } from './types'
import assetUrlsModule, {
AssetURLOptions,
TransformAssetUrlsOptions
} from './templateCompilerModules/assetUrl'
import srcsetModule from './templateCompilerModules/srcset'
import consolidate from '@vue/consolidate'
import * as _compiler from 'web/entry-co... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/compileStyle.ts | packages/compiler-sfc/src/compileStyle.ts | const postcss = require('postcss')
import { ProcessOptions, LazyResult } from 'postcss'
import trimPlugin from './stylePlugins/trim'
import scopedPlugin from './stylePlugins/scoped'
import {
processors,
StylePreprocessor,
StylePreprocessorResults
} from './stylePreprocessors'
import { cssVarsPlugin } from './cssV... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/compileScript.ts | packages/compiler-sfc/src/compileScript.ts | import MagicString from 'magic-string'
import LRU from 'lru-cache'
import { walkIdentifiers, isFunctionType } from './babelUtils'
import { BindingMetadata, BindingTypes } from './types'
import { SFCDescriptor, SFCScriptBlock } from './parseComponent'
import {
parse as _parse,
parseExpression,
ParserOptions,
Par... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | true |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/types.ts | packages/compiler-sfc/src/types.ts | import { CompilerOptions, CompiledResult } from 'types/compiler'
import { SFCDescriptor } from './parseComponent'
export interface StartOfSourceMap {
file?: string
sourceRoot?: string
}
export interface RawSourceMap extends StartOfSourceMap {
version: string
sources: string[]
names: string[]
sourcesConten... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/index.ts | packages/compiler-sfc/src/index.ts | // API
export { parse } from './parse'
export { compileTemplate } from './compileTemplate'
export { compileStyle, compileStyleAsync } from './compileStyle'
export { compileScript } from './compileScript'
export { generateCodeFrame } from 'compiler/codeframe'
export { rewriteDefault } from './rewriteDefault'
// For bac... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/stylePreprocessors.ts | packages/compiler-sfc/src/stylePreprocessors.ts | import merge from 'merge-source-map'
import { RawSourceMap } from 'source-map'
import { isFunction } from 'shared/util'
export type StylePreprocessor = (
source: string,
map: RawSourceMap | undefined,
options: {
[key: string]: any
additionalData?: string | ((source: string, filename: string) => string)
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/warn.ts | packages/compiler-sfc/src/warn.ts | const hasWarned: Record<string, boolean> = {}
export function warnOnce(msg: string) {
const isNodeProd =
typeof process !== 'undefined' && process.env.NODE_ENV === 'production'
if (!isNodeProd && !hasWarned[msg]) {
hasWarned[msg] = true
warn(msg)
}
}
export function warn(msg: string) {
console.war... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/rewriteDefault.ts | packages/compiler-sfc/src/rewriteDefault.ts | import { parse, ParserPlugin } from '@babel/parser'
import MagicString from 'magic-string'
const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/
const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)(?:as)?(\s*)default/s
const exportDefaultClassRE =
/((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
/**
*... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/prefixIdentifiers.ts | packages/compiler-sfc/src/prefixIdentifiers.ts | import MagicString from 'magic-string'
import { parseExpression, ParserOptions, ParserPlugin } from '@babel/parser'
import { makeMap } from 'shared/util'
import { isStaticProperty, walkIdentifiers } from './babelUtils'
import { BindingMetadata } from './types'
const doNotPrefix = makeMap(
'Infinity,undefined,NaN,isF... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/stylePlugins/scoped.ts | packages/compiler-sfc/src/stylePlugins/scoped.ts | import { PluginCreator, Rule, AtRule } from 'postcss'
import selectorParser from 'postcss-selector-parser'
const animationNameRE = /^(-\w+-)?animation-name$/
const animationRE = /^(-\w+-)?animation$/
const scopedPlugin: PluginCreator<string> = (id = '') => {
const keyframes = Object.create(null)
const shortId = i... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/stylePlugins/trim.ts | packages/compiler-sfc/src/stylePlugins/trim.ts | import { PluginCreator } from 'postcss'
const trimPlugin: PluginCreator<{}> = () => {
return {
postcssPlugin: 'vue-sfc-trim',
Once(root) {
root.walk(({ type, raws }) => {
if (type === 'rule' || type === 'atrule') {
if (raws.before) raws.before = '\n'
if ('after' in raws && r... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/templateCompilerModules/utils.ts | packages/compiler-sfc/src/templateCompilerModules/utils.ts | import { TransformAssetUrlsOptions } from './assetUrl'
import { UrlWithStringQuery, parse as uriParse } from 'url'
import path from 'path'
export function urlToRequire(
url: string,
transformAssetUrlsOption: TransformAssetUrlsOptions = {}
): string {
const returnValue = `"${url}"`
// same logic as in transform... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/templateCompilerModules/srcset.ts | packages/compiler-sfc/src/templateCompilerModules/srcset.ts | // vue compiler module for transforming `img:srcset` to a number of `require`s
import { urlToRequire } from './utils'
import { TransformAssetUrlsOptions } from './assetUrl'
import { ASTNode } from 'types/compiler'
interface ImageCandidate {
require: string
descriptor: string
}
export default (transformAssetUrlsO... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/src/templateCompilerModules/assetUrl.ts | packages/compiler-sfc/src/templateCompilerModules/assetUrl.ts | // vue compiler module for transforming `<tag>:<attribute>` to `require`
import { urlToRequire } from './utils'
import { ASTNode, ASTAttr } from 'types/compiler'
export interface AssetURLOptions {
[name: string]: string | string[]
}
export interface TransformAssetUrlsOptions {
/**
* If base is provided, inste... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/util.ts | packages/compiler-sfc/test/util.ts | import {
parse,
compileScript,
type SFCParseOptions,
type SFCScriptCompileOptions
} from '../src'
import { parse as babelParse } from '@babel/parser'
export const mockId = 'xxxxxxxx'
export function compile(
source: string,
options?: Partial<SFCScriptCompileOptions>,
parseOptions?: Partial<SFCParseOptio... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/prefixIdentifiers.spec.ts | packages/compiler-sfc/test/prefixIdentifiers.spec.ts | import { prefixIdentifiers } from '../src/prefixIdentifiers'
import { compile } from 'web/entry-compiler'
import { format } from 'prettier'
import { BindingTypes } from '../src/types'
const toFn = (source: string) => `function render(){${source}\n}`
it('should work', () => {
const { render } = compile(`<div id="app... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/cssVars.spec.ts | packages/compiler-sfc/test/cssVars.spec.ts | import { compileStyle, parse } from '../src'
import { mockId, compile, assertCode } from './util'
describe('CSS vars injection', () => {
test('generating correct code for nested paths', () => {
const { content } = compile(
`<script>const a = 1</script>\n` +
`<style>div{
color: v-bind(colo... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/stylePluginScoped.spec.ts | packages/compiler-sfc/test/stylePluginScoped.spec.ts | import { compileStyle } from '../src/compileStyle'
// vue-loader/#1370
test('spaces after selector', () => {
const { code } = compileStyle({
source: `.foo , .bar { color: red; }`,
filename: 'test.css',
id: 'test'
})
expect(code).toMatch(`.foo[test], .bar[test] { color: red;`)
})
test('leading deep ... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/compileTemplate.spec.ts | packages/compiler-sfc/test/compileTemplate.spec.ts | 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(
`require`,
`${code}; return { render, staticRender... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/compileStyle.spec.ts | packages/compiler-sfc/test/compileStyle.spec.ts | import { parse } from '../src/parse'
import { compileStyle, compileStyleAsync } from '../src/compileStyle'
test('preprocess less', () => {
const style = parse({
source:
'<style lang="less">\n' +
'@red: rgb(255, 0, 0);\n' +
'.color { color: @red; }\n' +
'</style>\n',
filename: 'example... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/rewriteDefault.spec.ts | packages/compiler-sfc/test/rewriteDefault.spec.ts | 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', () => {
expec... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/parseComponent.spec.ts | packages/compiler-sfc/test/parseComponent.spec.ts | 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.css"></style>
... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | false |
vuejs/vue | https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/compiler-sfc/test/compileScript.spec.ts | packages/compiler-sfc/test/compileScript.spec.ts | 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
const b = 2... | typescript | MIT | 9e88707940088cb1f4cd7dd210c9168a50dc347c | 2026-01-04T15:25:31.454261Z | true |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/generate-keybindings-doc.ts | scripts/generate-keybindings-doc.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { readFile, writeFile } from 'node:fs/promises';
import type { KeyBinding } from '../packages/cli/src/config/keyBindings.js';
import {
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/generate-settings-schema.ts | scripts/generate-settings-schema.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import {
getSettingsSchema,
type SettingCollectionDefinition,
type Setting... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/generate-settings-doc.ts | scripts/generate-settings-doc.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { readFile, writeFile } from 'node:fs/promises';
import { generateSettingsSchema } from './generate-settings-schema.js';
import {
escap... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/generate-settings-doc.test.ts | scripts/tests/generate-settings-doc.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import { main as generateDocs } from '../generate-settings-doc.ts';
vi.mock('fs', () => ({
readFileSync: vi.fn().mockReturnValue(''),
createWriteStream: vi.fn(() => ({
wri... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/vitest.config.ts | scripts/tests/vitest.config.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['scripts/tests/**/*.test.{js,ts}'],
setupFiles: ['scripts/tests/test-setup.ts'],
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/generate-settings-schema.test.ts | scripts/tests/generate-settings-schema.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it, vi } from 'vitest';
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { main as generateSchema } from '../generat... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/test-setup.ts | scripts/tests/test-setup.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { vi } from 'vitest';
vi.mock('fs', () => ({
...vi.importActual('fs'),
appendFileSync: vi.fn(),
}));
| typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/generate-keybindings-doc.test.ts | scripts/tests/generate-keybindings-doc.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import {
main as generateKeybindingDocs,
renderDocumentation,
type KeybindingDocSection,
} from '../generate-keybindings-doc.ts';
describe('generate-keybindings-doc', () => {
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/autogen.test.ts | scripts/tests/autogen.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { formatDefaultValue } from '../utils/autogen.js';
describe('formatDefaultValue', () => {
it('returns "undefined" for undefined', () => {
expect(formatDefaultValue(undefi... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/tests/telemetry_gcp.test.ts | scripts/tests/telemetry_gcp.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
const mockSpawn = vi.fn(() => ({ on: vi.fn(), pid: 123 }));
vi.mock('node:child_process', () => ({
spawn: mockSpawn,
execSync: vi.fn(),
}));
vi.mock('... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/scripts/utils/autogen.ts | scripts/utils/autogen.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import prettier from 'prettier';
export async function formatWithPrettier(content: string, filePath: string) {
const options = await prettier.resolveConfig(filePath);
return prettier.format(content, {
...options,
filep... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/vitest.config.ts | integration-tests/vitest.config.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
testTimeout: 300000, // 5 minutes
globalSetup: './globalSetup.ts',
reporters: ['default'],
include: ['**/*.test.ts'],
retry:... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/file-system.test.ts | integration-tests/file-system.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { existsSync } from 'node:fs';
import * as path from 'node:path';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
descri... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/run_shell_command.test.ts | integration-tests/run_shell_command.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
import { getShellConfiguration } from '../packages/core/src/utils/shell-utils.js... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/ripgrep-real.test.ts | integration-tests/ripgrep-real.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import * as path from 'node:path';
import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import { RipGrepTool } from '../packages/core/src/tools/r... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/read_many_files.test.ts | integration-tests/read_many_files.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
describe('read_many_files', () => {
let rig: TestRig;
beforeEach(() => {
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/ctrl-c-exit.test.ts | integration-tests/ctrl-c-exit.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as os from 'node:os';
import { TestRig } from './test-helper.js';
describe('Ctrl+C exit', () => {
let rig: TestRig;
beforeEach(() => {
rig = n... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/save_memory.test.ts | integration-tests/save_memory.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
describe('save_memory', () => {
let rig: TestRig;
beforeEach(() => {
r... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/hooks-system.test.ts | integration-tests/hooks-system.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, poll } from './test-helper.js';
import { join } from 'node:path';
import { writeFileSync } from 'node:fs';
describe('Hooks System Integration'... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | true |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/test-mcp-server.ts | integration-tests/test-mcp-server.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
McpServer,
type ToolCallback,
} from '@modelcontextprotocol/sdk/server/mcp.js';
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
import express from 'express';
import ... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/json-output.test.ts | integration-tests/json-output.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { expect, describe, it, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
import { join } from 'node:path';
import { ExitCodes } from '@google/gemini-cli-core/src/index.js';
describe('JSON o... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/telemetry.test.ts | integration-tests/telemetry.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
describe('telemetry', () => {
let rig: TestRig;
beforeEach(() => {
rig = new TestRig();
});
afterEach(... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/extensions-reload.test.ts | integration-tests/extensions-reload.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { expect, it, describe, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
import { TestMcpServer } from './test-mcp-server.js';
import { writeFileSync } from 'node:fs';
import { join } from '... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/extensions-install.test.ts | integration-tests/extensions-install.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
const extension = `{
"name": "test-exte... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/google_web_search.test.ts | integration-tests/google_web_search.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { WEB_SEARCH_TOOL_NAME } from '../packages/core/src/tools/tool-names.js';
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/hooks-agent-flow.test.ts | integration-tests/hooks-agent-flow.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
import { join } from 'node:path';
import { writeFileSync } from 'node:fs';
describe('Hooks Agent Flow', () => {
le... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/mixed-input-crash.test.ts | integration-tests/mixed-input-crash.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { TestRig } from './test-helper.js';
describe('mixed input crash prevention', () => {
let rig: TestRig;
beforeEach(() => {
rig = new TestRig();
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/simple-mcp-server.test.ts | integration-tests/simple-mcp-server.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This test verifies MCP (Model Context Protocol) server integration.
* It uses a minimal MCP server implementation that doesn't require
* external dependencies, making it compatible with Docker sandbox mode.
*/
import { d... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/list_directory.test.ts | integration-tests/list_directory.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, beforeEach, afterEach } from 'vitest';
import {
TestRig,
poll,
printDebugInfo,
validateModelOutput,
} from './test-helper.js';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
google-gemini/gemini-cli | https://github.com/google-gemini/gemini-cli/blob/d3c206c6770d320953dff80c01d555ad64df5b8b/integration-tests/mcp_server_cyclic_schema.test.ts | integration-tests/mcp_server_cyclic_schema.test.ts | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This test verifies we can provide MCP tools with recursive input schemas
* (in JSON, using the $ref keyword) and both the GenAI SDK and the Gemini
* API calls succeed. Note that prior to
* https://github.com/googleapis/js... | typescript | Apache-2.0 | d3c206c6770d320953dff80c01d555ad64df5b8b | 2026-01-04T15:25:31.833747Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.