repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
sun-panel | github_2023 | hslr-s | typescript | generateMD5AndUpdate | function generateMD5AndUpdate() {
jsonData.md5 = generateMD5(JSON.stringify(jsonData))
} | // MD5 生成函数 | https://github.com/hslr-s/sun-panel/blob/25f46209d97ae7bd6de29c39f93fd4d83932eb06/src/utils/jsonImportExport/index.ts#L67-L69 | 25f46209d97ae7bd6de29c39f93fd4d83932eb06 |
openbao | github_2023 | openbao | typescript | SidebarHeaderHomeLinkComponent.ariaLabel | get ariaLabel() {
const { ariaLabel } = this.args;
assert(
'@ariaLabel for "Sidebar::Header::HomeLink" ("Logo") must have a valid value',
ariaLabel !== undefined
);
return ariaLabel;
} | /**
* @param ariaLabel
* @type {string}
* @description The value of `aria-label`
*/ | https://github.com/openbao/openbao/blob/b77625e9e5441469f949cc548aeed31f523628ec/ui/app/components/sidebar/header/home-link.ts#L21-L30 | b77625e9e5441469f949cc548aeed31f523628ec |
openbao | github_2023 | openbao | typescript | DownloadService.csv | csv(filename: string, content: string) {
this.download(filename, content, 'csv');
} | // namespacelonglonglong4/,auth/method/uMGBU,35,20,15\n' | https://github.com/openbao/openbao/blob/b77625e9e5441469f949cc548aeed31f523628ec/ui/app/services/download.ts#L54-L56 | b77625e9e5441469f949cc548aeed31f523628ec |
openbao | github_2023 | openbao | typescript | PagePkiIssuerRotateRootComponent.displayFields | get displayFields() {
const addKeyFields = ['privateKey', 'privateKeyType'];
const defaultFields = [
'certificate',
'caChain',
'issuerId',
'issuerName',
'issuingCa',
'keyName',
'keyId',
'serialNumber',
];
return this.args.newRootModel.id ? [...defaultField... | // for displaying old root details, and generated root details | https://github.com/openbao/openbao/blob/b77625e9e5441469f949cc548aeed31f523628ec/ui/lib/pki/addon/components/page/pki-issuer-rotate-root.ts#L61-L74 | b77625e9e5441469f949cc548aeed31f523628ec |
openbao | github_2023 | openbao | typescript | fetchOptions | const fetchOptions = async () => {
try {
const url = new URL(location);
var version = url.searchParams.get("version");
// Check if options are cached in localStorage and not expired
const cachedOptions = localStorage.getItem("gh-releases");
... | // Function to fetch options from API | https://github.com/openbao/openbao/blob/b77625e9e5441469f949cc548aeed31f523628ec/website/src/pages/downloads.tsx#L25-L83 | b77625e9e5441469f949cc548aeed31f523628ec |
backrest | github_2023 | garethgeorge | typescript | handleScroll | const handleScroll = () => {
if (!ref.current) {
return;
}
const refRect = ref.current!.getBoundingClientRect();
let wiggle = Math.max(refRect.height - window.innerHeight, 0);
let topY = Math.max(ref.current!.getBoundingClientRect().top, 0);
let bottomY = topY;
if (topY... | // handle scroll events to keep the fixed container in view. | https://github.com/garethgeorge/backrest/blob/403458f70705258906258fa77d4668d70ac176e3/webui/src/components/OperationTreeView.tsx#L472-L490 | 403458f70705258906258fa77d4668d70ac176e3 |
backrest | github_2023 | garethgeorge | typescript | getStatus | const getStatus = async (req: GetOperationsRequest) => {
let ops = await getOperations(req);
ops.sort((a, b) => {
return Number(b.unixTimeStartMs - a.unixTimeStartMs);
});
let flowID: BigInt | undefined = undefined;
for (const op of ops) {
if (op.status === OperationStatus.STATUS_PENDING || op.status... | // getStatus returns the status of the last N operations that belong to a single snapshot. | https://github.com/garethgeorge/backrest/blob/403458f70705258906258fa77d4668d70ac176e3/webui/src/state/logstate.ts#L58-L82 | 403458f70705258906258fa77d4668d70ac176e3 |
backrest | github_2023 | garethgeorge | typescript | fetchData | const fetchData = async () => {
// check if the tab is in the foreground
if (document.hidden) {
return;
}
try {
const data = await backrestService.getSummaryDashboard({});
setSummaryData(data);
} catch (e) {
alertApi.error("Failed to fetch summary data: " +... | // Fetch summary data | https://github.com/garethgeorge/backrest/blob/403458f70705258906258fa77d4668d70ac176e3/webui/src/views/SummaryDashboard.tsx#L54-L66 | 403458f70705258906258fa77d4668d70ac176e3 |
vue-vapor | github_2023 | vuejs | typescript | PluginTyped | const PluginTyped: Plugin<PluginOptions> = (app, options) => {} | // still valid but it's better to use the regular function because this one can accept an optional param | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages-private/dts-test/appUse.test-d.ts#L91-L91 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | testUnrefGenerics | function testUnrefGenerics<T>(p: T | Ref<T>) {
expectType<T>(unref(p))
} | // #3954 | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages-private/dts-test/ref.test-d.ts#L408-L410 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | customNodeTransform | const customNodeTransform: NodeTransform = (node, context) => {
if (
node.type === NodeTypes.ELEMENT &&
node.tag === 'div' &&
node.props.some(
prop =>
prop.type === NodeTypes.ATTRIBUTE &&
prop.name === 'id' &&
prop.value &&
prop.val... | // a NodeTransform that swaps out <div id="foo" /> with <span id="foo" /> | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/__tests__/transforms/transformElement.spec.ts#L1318-L1335 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | isReferenced | function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean {
switch (parent.type) {
// yes: PARENT[NODE]
// yes: NODE.child
// no: parent.NODE
case 'MemberExpression':
case 'OptionalMemberExpression':
if (parent.property === node) {
return !!parent.computed
}
... | /**
* Copied from https://github.com/babel/babel/blob/main/packages/babel-types/src/validators/isReferenced.ts
* To avoid runtime dependency on @babel/types (which includes process references)
* This file should not change very often in babel but we may need to keep it
* up-to-date from time to time.
*
* https://... | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/babelUtils.ts#L328-L496 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | genCallExpression | function genCallExpression(node: CallExpression, context: CodegenContext) {
const { push, helper, pure } = context
const callee = isString(node.callee) ? node.callee : helper(node.callee)
if (pure) {
push(PURE_ANNOTATION)
}
push(callee + `(`, NewlineType.None, node)
genNodeList(node.arguments, context)
... | // JavaScript | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/codegen.ts#L902-L911 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | isTagStartChar | function isTagStartChar(c: number): boolean {
return (
(c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||
(c >= CharCodes.UpperA && c <= CharCodes.UpperZ)
)
} | /**
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a
* tag name.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L144-L149 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.getPos | public getPos(index: number): Position {
let line = 1
let column = index + 1
for (let i = this.newlines.length - 1; i >= 0; i--) {
const newlineIndex = this.newlines[i]
if (index > newlineIndex) {
line = i + 2
column = index - newlineIndex
break
}
}
return {... | /**
* Generate Position object with line / column information using recorded
* newline positions. We know the index is always going to be an already
* processed index, so all the newlines up to this index should have been
* recorded.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L296-L312 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.stateInRCDATA | private stateInRCDATA(c: number): void {
if (this.sequenceIndex === this.currentSequence.length) {
if (c === CharCodes.Gt || isWhitespace(c)) {
const endOfText = this.index - this.currentSequence.length
if (this.sectionStart < endOfText) {
// Spoof the index so that reported locatio... | /** Look for an end tag. For <title> and <textarea>, also decode entities. */ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L409-L455 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.fastForwardTo | private fastForwardTo(c: number): boolean {
while (++this.index < this.buffer.length) {
const cc = this.buffer.charCodeAt(this.index)
if (cc === CharCodes.NewLine) {
this.newlines.push(this.index)
}
if (cc === c) {
return true
}
}
/*
* We increment the ind... | /**
* When we wait for one specific character, we can speed things up
* by skipping through the buffer until we find it.
*
* @returns Whether the character was found.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L478-L498 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.stateInCommentLike | private stateInCommentLike(c: number): void {
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, this.index - 2)
} else {
th... | /**
* Comments and CDATA end with `-->` and `]]>`.
*
* Their common qualities are:
* - Their end sequences have a distinct character they start with.
* - That character is then repeated, so we have to check multiple repeats.
* - All characters but the start character of the sequence can be skipped.
... | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L508-L530 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.parse | public parse(input: string): void {
this.buffer = input
while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index)
if (c === CharCodes.NewLine) {
this.newlines.push(this.index)
}
switch (this.state) {
case State.Text: {
this.stateText... | /**
* Iterates through the buffer, calling the function corresponding to the current state.
*
* States that are more likely to be hit are higher up, as a performance improvement.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L928-L1077 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.cleanup | private cleanup() {
// If we are inside of text or attributes, emit what we already have.
if (this.sectionStart !== this.index) {
if (
this.state === State.Text ||
(this.state === State.InRCDATA && this.sequenceIndex === 0)
) {
this.cbs.ontext(this.sectionStart, this.index)
... | /**
* Remove data that has already been consumed from the buffer.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L1082-L1100 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Tokenizer.handleTrailingData | private handleTrailingData() {
const endIndex = this.buffer.length
// If there is no remaining data, we are done.
if (this.sectionStart >= endIndex) {
return
}
if (this.state === State.InCommentLike) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sec... | /** Handle any trailing data. */ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/tokenizer.ts#L1114-L1150 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | hasProp | function hasProp(prop: Property, props: ObjectExpression) {
let result = false
if (prop.key.type === NodeTypes.SIMPLE_EXPRESSION) {
const propKeyName = prop.key.content
result = props.properties.some(
p =>
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
p.key.content === propKeyName,
... | // check existing key to avoid overriding user provided keys | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/utils.ts#L473-L484 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | pushRefVForMarker | const pushRefVForMarker = () => {
if (context.scopes.vFor > 0) {
properties.push(
createObjectProperty(
createSimpleExpression('ref_for', true),
createSimpleExpression('true'),
),
)
}
} | // mark template ref on v-for | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/transforms/transformElement.ts#L416-L425 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | dedupeProperties | function dedupeProperties(properties: Property[]): Property[] {
const knownProps: Map<string, Property> = new Map()
const deduped: Property[] = []
for (let i = 0; i < properties.length; i++) {
const prop = properties[i]
// dynamic keys are always allowed
if (prop.key.type === NodeTypes.COMPOUND_EXPRES... | // Dedupe props in an object literal. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-core/src/transforms/transformElement.ts#L838-L861 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | cachedArrayBailedMatcher | function cachedArrayBailedMatcher(n = 1) {
return {
type: NodeTypes.JS_CACHE_EXPRESSION,
value: {
type: NodeTypes.JS_ARRAY_EXPRESSION,
elements: new Array(n).fill(0).map(() => ({
// should remain VNODE_CALL instead of JS_CALL_EXPRESSION
codegenNode: { type: NodeTypes.... | /**
* Assert cached node NOT stringified
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts#L29-L40 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | cachedArraySuccessMatcher | function cachedArraySuccessMatcher(n = 1) {
return {
type: NodeTypes.JS_CACHE_EXPRESSION,
value: {
type: NodeTypes.JS_ARRAY_EXPRESSION,
elements: new Array(n).fill(0).map(() => ({
type: NodeTypes.JS_CALL_EXPRESSION,
callee: CREATE_STATIC,
})),
},
}
... | /**
* Assert cached node is stringified (no content check)
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts#L45-L56 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | cachedArrayStaticNodeMatcher | function cachedArrayStaticNodeMatcher(content: string, count: number) {
return {
type: NodeTypes.JS_CACHE_EXPRESSION,
value: {
type: NodeTypes.JS_ARRAY_EXPRESSION,
elements: [
{
type: NodeTypes.JS_CALL_EXPRESSION,
callee: CREATE_STATIC,
argum... | /**
* Assert cached node stringified with desired content and node count
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts#L61-L75 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | analyzeNode | function analyzeNode(node: StringifiableNode): [number, number] | false {
if (node.type === NodeTypes.ELEMENT && isNonStringifiable(node.tag)) {
return false
}
if (node.type === NodeTypes.TEXT_CALL) {
return [1, 0]
}
let nc = 1 // node count
let ec = node.props.length > 0 ? 1 : 0 // element w/ bin... | /**
* for a cached node, analyze it and return:
* - false: bailed (contains non-stringifiable props or runtime constant)
* - [nc, ec] where
* - nc is the number of nodes inside
* - ec is the number of element with bindings inside
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/src/transforms/stringifyStatic.ts#L211-L287 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | walk | function walk(node: ElementNode): boolean {
const isOptionTag = node.tag === 'option' && node.ns === Namespaces.HTML
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i]
// bail on non-attr bindings
if (
p.type === NodeTypes.ATTRIBUTE &&
!isStringifiableAttr(p.... | // TODO: check for cases where using innerHTML will result in different | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/src/transforms/stringifyStatic.ts#L232-L284 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | evaluateConstant | function evaluateConstant(exp: ExpressionNode): string {
if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {
return new Function(`return (${exp.content})`)()
} else {
// compound
let res = ``
exp.children.forEach(c => {
if (isString(c) || isSymbol(c)) {
return
}
if (c.type === ... | // __UNSAFE__ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-dom/src/transforms/stringifyStatic.ts#L397-L417 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | isEmpty | function isEmpty(node: ElementNode) {
for (let i = 0; i < node.children.length; i++) {
const child = node.children[i]
if (child.type !== NodeTypes.TEXT || child.content.trim() !== '') {
return false
}
}
return true
} | /**
* Returns true if the node has no children
* once the empty text nodes (trimmed content) have been filtered out.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/parse.ts#L425-L433 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | dedent | function dedent(s: string): [string, number] {
const lines = s.split('\n')
const minIndent = lines.reduce(function (minIndent, line) {
if (line.trim() === '') {
return minIndent
}
const indent = line.match(/^\s*/)?.[0]?.length || 0
return Math.min(indent, minIndent)
}, Infinity)
if (minInd... | /**
* Dedent a string.
*
* This removes any whitespace that is common to all lines in the string from
* each line in the string.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/parse.ts#L470-L490 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | hasStaticWithDefaults | function hasStaticWithDefaults(ctx: TypeResolveContext) {
return !!(
ctx.propsRuntimeDefaults &&
ctx.propsRuntimeDefaults.type === 'ObjectExpression' &&
ctx.propsRuntimeDefaults.properties.every(
node =>
node.type !== 'SpreadElement' &&
(!node.computed || node.key.type.endsWith('Lite... | /**
* check defaults. If the default object is an object literal with only
* static properties, we can directly generate more optimized default
* declarations. Otherwise we will have to fallback to runtime merging.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/script/defineProps.ts#L314-L324 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | inferValueType | function inferValueType(node: Node): string | undefined {
switch (node.type) {
case 'StringLiteral':
return 'String'
case 'NumericLiteral':
return 'Number'
case 'BooleanLiteral':
return 'Boolean'
case 'ObjectExpression':
return 'Object'
case 'ArrayExpression':
return ... | // non-comprehensive, best-effort type infernece for a runtime value | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/script/defineProps.ts#L375-L391 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | resolveExtractPropTypes | function resolveExtractPropTypes(
{ props }: ResolvedElements,
scope: TypeScope,
): ResolvedElements {
const res: ResolvedElements = { props: {} }
for (const key in props) {
const raw = props[key]
res.props[key] = reverseInferType(
raw.key,
raw.typeAnnotation!.typeAnnotation,
scope,
... | /**
* support for the `ExtractPropTypes` helper - it's non-exhaustive, mostly
* tailored towards popular component libs like element-plus and antd-vue.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/script/resolveType.ts#L1802-L1816 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | scss | const scss: StylePreprocessor = (source, map, options, load = require) => {
const nodeSass: typeof import('sass') = load('sass')
const { compileString, renderSync } = nodeSass
const data = getSource(source, options.filename, options.additionalData)
let css: string
let dependencies: string[]
let sourceMap: ... | // .scss/.sass processor | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/style/preprocessors.ts#L25-L71 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | less | const less: StylePreprocessor = (source, map, options, load = require) => {
const nodeLess = load('less')
let result: any
let error: Error | null = null
nodeLess.render(
getSource(source, options.filename, options.additionalData),
{ ...options, syncImport: true },
(err: Error | null, output: any) =... | // .less | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/style/preprocessors.ts#L85-L115 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | styl | const styl: StylePreprocessor = (source, map, options, load = require) => {
const nodeStylus = load('stylus')
try {
const ref = nodeStylus(source, options)
if (map) ref.set('sourcemap', { inline: false, comment: false })
const result = ref.render()
const dependencies = ref.deps()
if (map) {
... | // .styl | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/style/preprocessors.ts#L118-L139 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | parseUriParts | function parseUriParts(urlString: string): UrlWithStringQuery {
// A TypeError is thrown if urlString is not a string
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
return uriParse(isString(urlString) ? urlString : '', false, true)
} | /**
* vuejs/component-compiler-utils#22 Support uri fragment in transformed require
* @param urlString - an url as a string
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-sfc/src/template/templateUtils.ts#L35-L39 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | compile | function compile(template: string | RootNode, options: CompilerOptions = {}) {
let { code } = _compile(template, {
...options,
mode: 'module',
prefixIdentifiers: true,
})
return code
} | // TODO This is a temporary test case for initial implementation. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-vapor/__tests__/compile.spec.ts#L8-L15 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | dedupeProperties | function dedupeProperties(results: DirectiveTransformResult[]): IRProp[] {
const knownProps: Map<string, IRProp> = new Map()
const deduped: IRProp[] = []
for (const result of results) {
const prop = resolveDirectiveResult(result)
// dynamic keys are always allowed
if (!prop.key.isStatic) {
dedu... | // Dedupe props in an object literal. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-vapor/src/transforms/transformElement.ts#L403-L427 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | transformComponentSlot | function transformComponentSlot(
node: ElementNode,
dir: VaporDirectiveNode | undefined,
context: TransformContext<ElementNode>,
) {
const { children } = node
const arg = dir && dir.arg
const nonSlotTemplateChildren = children.filter(
n =>
isNonWhitespaceContent(node) &&
!(n.type === NodeTyp... | // <Foo v-slot:default> | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-vapor/src/transforms/vSlot.ts#L62-L107 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | transformTemplateSlot | function transformTemplateSlot(
node: ElementNode,
dir: VaporDirectiveNode,
context: TransformContext<ElementNode>,
) {
context.dynamic.flags |= DynamicFlag.NON_TEMPLATE
const arg = dir.arg && resolveExpression(dir.arg)
const vFor = findDir(node, 'for')
const vIf = findDir(node, 'if')
const vElse = fin... | // <template #foo> | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/compiler-vapor/src/transforms/vSlot.ts#L110-L189 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.every | every(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.every(obj => obj.id === foo)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L724-L729 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.filter | filter(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.filter(obj => obj.id === foo)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L732-L737 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.find | find(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.find(obj => obj.id === foo)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L740-L745 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.findIndex | findIndex(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.findIndex(obj => obj.id === bar)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L748-L753 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.forEach | forEach(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L771-L775 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.map | map(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.map(obj => obj.value)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L778-L783 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | Collection.some | some(foo: any, bar: any, baz: any) {
expect(foo).toBe('foo')
expect(bar).toBe('bar')
expect(baz).toBe('baz')
return super.some(obj => obj.id === baz)
} | // @ts-expect-error | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/reactiveArray.spec.ts#L786-L791 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | clamp | const clamp = (n: number, min: number, max: number) =>
Math.min(max, Math.max(min, n)) | // useClamp from VueUse | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/__tests__/watch.spec.ts#L238-L239 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | iterator | function iterator(
self: unknown[],
method: keyof Array<unknown>,
wrapValue: (value: any) => unknown,
) {
// note that taking ARRAY_ITERATE dependency here is not strictly equivalent
// to calling iterate on the proxified array.
// creating the iterator does not access any array property:
// it is only wh... | // instrument iterators to take ARRAY_ITERATE dependency | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/arrayInstrumentations.ts#L197-L225 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | apply | function apply(
self: unknown[],
method: ArrayMethods,
fn: (item: unknown, index: number, array: unknown[]) => unknown,
thisArg?: unknown,
wrappedRetFn?: (result: any) => unknown,
args?: IArguments,
) {
const arr = shallowReadArray(self)
const needsWrap = arr !== self && !isShallow(self)
// @ts-expect... | // instrument functions that read (potentially) all items | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/arrayInstrumentations.ts#L234-L270 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | reduce | function reduce(
self: unknown[],
method: keyof Array<any>,
fn: (acc: unknown, item: unknown, index: number, array: unknown[]) => unknown,
args: unknown[],
) {
const arr = shallowReadArray(self)
let wrappedFn = fn
if (arr !== self) {
if (!isShallow(self)) {
wrappedFn = function (this: unknown, a... | // instrument reduce and reduceRight to take ARRAY_ITERATE dependency | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/arrayInstrumentations.ts#L273-L293 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | searchProxy | function searchProxy(
self: unknown[],
method: keyof Array<any>,
args: unknown[],
) {
const arr = toRaw(self) as any
track(arr, TrackOpTypes.ITERATE, ARRAY_ITERATE_KEY)
// we run the method using the original args first (which may be reactive)
const res = arr[method](...args)
// if that didn't work, ru... | // instrument identity-sensitive methods to account for reactive proxies | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/arrayInstrumentations.ts#L296-L313 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | noTracking | function noTracking(
self: unknown[],
method: keyof Array<any>,
args: unknown[] = [],
) {
pauseTracking()
startBatch()
const res = (toRaw(self) as any)[method].apply(self, args)
endBatch()
resetTracking()
return res
} | // instrument length-altering mutation methods to avoid length being tracked | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/arrayInstrumentations.ts#L317-L328 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | ComputedRefImpl.notify | notify(): true | void {
this.flags |= EffectFlags.DIRTY
if (
!(this.flags & EffectFlags.NOTIFIED) &&
// avoid infinite self recursion
activeSub !== this
) {
batch(this, true)
return true
} else if (__DEV__) {
// TODO warn
}
} | /**
* @internal
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/computed.ts#L117-L129 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | ReactiveEffect.notify | notify(): void {
if (
this.flags & EffectFlags.RUNNING &&
!(this.flags & EffectFlags.ALLOW_RECURSE)
) {
return
}
if (!(this.flags & EffectFlags.NOTIFIED)) {
batch(this)
}
} | /**
* @internal
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/effect.ts#L138-L148 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | ReactiveEffect.runIfDirty | runIfDirty(): void {
if (isDirty(this)) {
this.run()
}
} | /**
* @internal
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/effect.ts#L207-L211 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | EffectScope.resume | resume(): void {
if (this._active) {
if (this._isPaused) {
this._isPaused = false
let i, l
if (this.scopes) {
for (i = 0, l = this.scopes.length; i < l; i++) {
this.scopes[i].resume()
}
}
for (i = 0, l = this.effects.length; i < l; i++) {... | /**
* Resumes the effect scope, including all child scopes and effects.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/effectScope.ts#L71-L86 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | EffectScope.on | on(): void {
this.prevScope = activeEffectScope
activeEffectScope = this
} | /**
* This should only be called on non-detached scopes
* @internal
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/effectScope.ts#L107-L110 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | EffectScope.off | off(): void {
activeEffectScope = this.prevScope
} | /**
* This should only be called on non-detached scopes
* @internal
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/reactivity/src/effectScope.ts#L116-L118 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | slot | const slot = () => {} | // default slot | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/h.spec.ts#L23-L23 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | job2 | const job2 = () => calls.push('job2') | // job1 has no id | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/scheduler.spec.ts#L473-L473 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | cb2 | const cb2 = () => calls.push('cb2') | // cb1 has no id | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/scheduler.spec.ts#L497-L497 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | cb | const cb: SchedulerJob = () => {
if (count < 5) {
count++
queuePostFlushCb(cb)
}
} | // post cb | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/scheduler.spec.ts#L611-L616 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | job1 | const job1 = () => {
// @ts-expect-error
job2.flags! |= SchedulerJobFlags.DISPOSED
} | // simulate parent component that toggles child | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/scheduler.spec.ts#L755-L758 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | job2 | const job2 = () => spy() | // simulate child that's triggered by the same reactive change that | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/scheduler.spec.ts#L761-L761 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | CompB | const CompB = ({ msg }: { msg: string }) => h(CompC, { msg }) | // test HOC | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/components/BaseTransition.spec.ts#L113-L113 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | mockPersistedHooks | function mockPersistedHooks() {
const state = { show: true }
const toggle = ref(true)
const hooks: VNodeProps = {
onVnodeBeforeMount(vnode) {
vnode.transition!.beforeEnter(vnode.el!)
},
onVnodeMounted(vnode) {
vnode.transition!.enter(vnode.el!)
},
... | // this is pretty much how v-show is implemented | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/components/BaseTransition.spec.ts#L186-L211 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | defineAsyncComponent | function defineAsyncComponent<T extends ComponentOptions>(
comp: T,
delay: number = 0,
) {
return {
setup(props: any, { slots }: any) {
const p = new Promise(resolve => {
setTimeout(() => {
resolve(() => h(comp, props, slots))
}, delay)
})
// i... | // a simple async factory for testing purposes only. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/components/Suspense.spec.ts#L39-L56 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | baseCheckWarn | function baseCheckWarn(
shouldWarn: boolean,
children: RawSlots,
props: SuspenseProps | null = null,
) {
const Comp = {
setup() {
return () => h(Suspense, props, children)
},
}
const root = nodeOps.createElement('div')
render(h(Comp), root)
... | // base function to check if a combination of slots warns or not | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/__tests__/components/Suspense.spec.ts#L2166-L2187 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | warnRuntimeUsage | const warnRuntimeUsage = (method: string) =>
warn(
`${method}() is a compiler-hint helper that is only usable inside ` +
`<script setup> of a single file component. Its arguments should be ` +
`compiled away and passing it at runtime has no effect.`,
) | // dev only | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/apiSetupHelpers.ts#L36-L41 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getSlotsProxy | function getSlotsProxy(instance: ComponentInternalInstance): Slots {
return new Proxy(instance.slots, {
get(target, key: string) {
track(instance, TrackOpTypes.GET, '$slots')
return target[key]
},
})
} | /**
* Dev-only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/component.ts#L1110-L1117 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | inferFromRegistry | const inferFromRegistry = (registry: Record<string, any> | undefined) => {
for (const key in registry) {
if (registry[key] === Component) {
return key
}
}
} | // try to infer the name based on reverse resolution | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/component.ts#L1228-L1234 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getType | function getType(ctor: Prop<any> | null): string {
// Early return for null to avoid unnecessary computations
if (ctor === null) {
return 'null'
}
// Avoid using regex for common cases by checking the type directly
if (typeof ctor === 'function') {
// Using name property to avoid converting function ... | // dev only | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L627-L645 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | validateProps | function validateProps(
rawProps: Data,
props: Data,
instance: ComponentInternalInstance,
) {
const resolvedValues = toRaw(props)
const options = instance.propsOptions[0]
const camelizePropsKey = Object.keys(rawProps).map(key => camelize(key))
for (const key in options) {
let opt = options[key]
if... | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L650-L669 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | validateProp | function validateProp(
name: string,
value: unknown,
prop: PropOptions,
props: Data,
isAbsent: boolean,
) {
const { type, required, validator, skipCheck } = prop
// required!
if (required && isAbsent) {
warn('Missing required prop: "' + name + '"')
return
}
// missing but optional
if (valu... | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L674-L711 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | assertType | function assertType(
value: unknown,
type: PropConstructor | null,
): AssertionResult {
let valid
const expectedType = getType(type)
if (expectedType === 'null') {
valid = value === null
} else if (isSimpleType(expectedType)) {
const t = typeof value
valid = t === expectedType.toLowerCase()
... | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L725-L751 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getInvalidTypeMessage | function getInvalidTypeMessage(
name: string,
value: unknown,
expectedTypes: string[],
): string {
if (expectedTypes.length === 0) {
return (
`Prop type [] for prop "${name}" won't match anything.` +
` Did you mean to use type Array instead?`
)
}
let message =
`Invalid prop: type che... | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L756-L788 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | styleValue | function styleValue(value: unknown, type: string): string {
if (type === 'String') {
return `"${value}"`
} else if (type === 'Number') {
return `${Number(value)}`
} else {
return `${value}`
}
} | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L793-L801 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | isExplicable | function isExplicable(type: string): boolean {
const explicitTypes = ['string', 'number', 'boolean']
return explicitTypes.some(elem => type.toLowerCase() === elem)
} | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L806-L809 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | isBoolean | function isBoolean(...args: string[]): boolean {
return args.some(elem => elem.toLowerCase() === 'boolean')
} | /**
* dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentProps.ts#L814-L816 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getPublicInstance | const getPublicInstance = (
i: ComponentInternalInstance | null,
): ComponentPublicInstance | ComponentInternalInstance['exposed'] | null => {
if (!i) return null
if (isStatefulComponent(i)) return getComponentPublicInstance(i)
return getPublicInstance(i.parent)
} | /**
* #2437 In Vue 3, functional components do not have a public instance proxy but
* they exist in the internal parent chain. For code that relies on traversing
* public $parent chains, skip functional ones and go to the parent instead.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentPublicInstance.ts#L357-L363 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getChildRoot | const getChildRoot = (vnode: VNode): [VNode, SetRootFn] => {
const rawChildren = vnode.children as VNodeArrayChildren
const dynamicChildren = vnode.dynamicChildren
const childRoot = filterSingleRoot(rawChildren, false)
if (!childRoot) {
return [vnode, undefined]
} else if (
__DEV__ &&
childRoot.pa... | /**
* dev only
* In dev mode, template root level comments are rendered, which turns the
* template into a fragment root, but we need to locate the single element
* root for attrs and scope id processing.
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/componentRenderUtils.ts#L276-L303 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | createDevtoolsComponentHook | function createDevtoolsComponentHook(
hook: DevtoolsHooks,
): DevtoolsComponentHook {
return (component: ComponentInternalInstance) => {
emit(
hook,
component.appContext.app,
component.uid,
component.parent ? component.parent.uid : undefined,
component,
)
}
} | /*! #__NO_SIDE_EFFECTS__ */ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/devtools.ts#L129-L141 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | locateClosingAnchor | const locateClosingAnchor = (
node: Node | null,
open = '[',
close = ']',
): Node | null => {
let match = 0
while (node) {
node = nextSibling(node)
if (node && isComment(node)) {
if (node.data === open) match++
if (node.data === close) {
if (match === 0) {
... | // looks ahead for a start and closing comment node | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/hydration.ts#L732-L752 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | propHasMismatch | function propHasMismatch(
el: Element,
key: string,
clientValue: any,
vnode: VNode,
instance: ComponentInternalInstance | null,
): boolean {
let mismatchType: MismatchTypes | undefined
let mismatchKey: string | undefined
let actual: string | boolean | null | undefined
let expected: string | boolean | ... | /**
* Dev only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/hydration.ts#L788-L883 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | baseCreateRenderer | function baseCreateRenderer(
options: RendererOptions,
createHydrationFns?: typeof createHydrationFunctions,
): any {
// compile-time feature flags check
if (__ESM_BUNDLER__ && !__TEST__) {
initFeatureFlags()
}
const target = getGlobalThis()
target.__VUE__ = true
if (__DEV__ || __FEATURE_PROD_DEVTO... | // implementation | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L341-L2405 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | patch | const patch: PatchFn = (
n1,
n2,
container,
anchor = null,
parentComponent = null,
parentSuspense = null,
namespace = undefined,
slotScopeIds = null,
optimized = __DEV__ && isHmrUpdating ? false : !!n2.dynamicChildren,
) => {
if (n1 === n2) {
return
}
// patching... | // Note: functions inside this closure should use `const xxx = () => {}` | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L373-L488 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | patchStaticNode | const patchStaticNode = (
n1: VNode,
n2: VNode,
container: RendererElement,
namespace: ElementNamespace,
) => {
// static nodes are only patched during dev for HMR
if (n2.children !== n1.children) {
const anchor = hostNextSibling(n1.anchor!)
// remove existing
removeStaticNod... | /**
* Dev / HMR only
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L544-L566 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | patchBlockChildren | const patchBlockChildren: PatchBlockChildrenFn = (
oldChildren,
newChildren,
fallbackContainer,
parentComponent,
parentSuspense,
namespace: ElementNamespace,
slotScopeIds,
) => {
for (let i = 0; i < newChildren.length; i++) {
const oldVNode = oldChildren[i]
const newVNode =... | // The fast path for blocks. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L940-L981 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | hydrateSubTree | const hydrateSubTree = () => {
if (__DEV__) {
startMeasure(instance, `render`)
}
instance.subTree = renderComponentRoot(instance)
if (__DEV__) {
endMeasure(instance, `render`)
}
if (__DEV__) {
startMeasure(... | // vnode has adopted host node - perform hydration instead of mount. | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L1313-L1334 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | patchKeyedChildren | const patchKeyedChildren = (
c1: VNode[],
c2: VNodeArrayChildren,
container: RendererElement,
parentAnchor: RendererNode | null,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
namespace: ElementNamespace,
slotScopeIds: string[] | null,
opt... | // can be all-keyed or mixed | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L1763-L2001 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | getSequence | function getSequence(arr: number[]): number[] {
const p = arr.slice()
const result = [0]
let i, j, u, v, c
const len = arr.length
for (i = 0; i < len; i++) {
const arrI = arr[i]
if (arrI !== 0) {
j = result[result.length - 1]
if (arr[j] < arrI) {
p[i] = j
result.push(i)
... | // https://en.wikipedia.org/wiki/Longest_increasing_subsequence | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/renderer.ts#L2491-L2530 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | findInsertionIndex | function findInsertionIndex(id: number) {
let start = flushIndex + 1
let end = queue.length
while (start < end) {
const middle = (start + end) >>> 1
const middleJob = queue[middle]
const middleJobId = getId(middleJob)
if (
middleJobId < id ||
(middleJobId === id && middleJob.flags! & ... | // Use binary-search to find a suitable position in the queue. The queue needs | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/scheduler.ts#L73-L92 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | deepCloneVNode | function deepCloneVNode(vnode: VNode): VNode {
const cloned = cloneVNode(vnode)
if (isArray(vnode.children)) {
cloned.children = (vnode.children as VNode[]).map(deepCloneVNode)
}
return cloned
} | /**
* Dev only, for HMR of hoisted vnodes reused in v-for
* https://github.com/vitejs/vite/issues/2022
*/ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/vnode.ts#L741-L747 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | formatTrace | function formatTrace(trace: ComponentTraceStack): any[] {
const logs: any[] = []
trace.forEach((entry, i) => {
logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry))
})
return logs
} | /* v8 ignore start */ | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/warning.ts#L111-L117 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | emptyPlaceholder | function emptyPlaceholder(vnode: VNode): VNode | undefined {
if (isKeepAlive(vnode)) {
vnode = cloneVNode(vnode)
vnode.children = null
return vnode
}
} | // the placeholder really only handles one special case: KeepAlive | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/components/BaseTransition.ts#L488-L494 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
vue-vapor | github_2023 | vuejs | typescript | resolveAsset | function resolveAsset(
type: AssetTypes,
name: string,
warnMissing = true,
maybeSelfReference = false,
) {
const instance = currentRenderingInstance || currentInstance
if (instance) {
const Component = instance.type
// explicit self name has highest priority
if (type === COMPONENTS) {
con... | // implementation | https://github.com/vuejs/vue-vapor/blob/da75dd9131958ff4fb0f9b592c99cd76c761e272/packages/runtime-core/src/helpers/resolveAssets.ts#L77-L131 | da75dd9131958ff4fb0f9b592c99cd76c761e272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.