repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/utilities/create-language.js
src/utilities/create-language.js
import * as assert from "#universal/assert"; /** @import {Language as LinguistLanguage} from 'linguist-languages' */ /** @typedef {{ name: string; parsers?: readonly string[]; group?: string | undefined; tmScope?: string | undefined; aceMode?: string | undefined; codemirrorMode?: string | undefined; code...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/utilities/skip.js
src/utilities/skip.js
/** * @typedef {{backwards?: boolean}} SkipOptions */ /** * @param {string | RegExp} characters * @returns {(text: string, startIndex: number | false, options?: SkipOptions) => number | false} */ function skip(characters) { return (text, startIndex, options) => { const backwards = Boolean(options?.backwards...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/utilities/make-string.js
src/utilities/make-string.js
import { DOUBLE_QUOTE, SINGLE_QUOTE } from "./get-preferred-quote.js"; /** @import {Quote} from "./get-preferred-quote.js" */ // Matches _any_ escape and unescaped quotes (both single and double). // Matching `\` in first group, so we won't treat `\\"` as escaped quote. const REGEX = /\\(["'\\])|(["'])/g; /** * @pa...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/utilities/pragma/pragma.evaluate.js
src/utilities/pragma/pragma.evaluate.js
export const FORMAT_PRAGMAS = ["format", "prettier"]; export const FORMAT_IGNORE_PRAGMAS = FORMAT_PRAGMAS.map( (pragma) => `no${pragma}`, ); export const FORMAT_PRAGMA_TO_INSERT = FORMAT_PRAGMAS[0]; // Regular expressions are put in this file so they can be evaluated export const YAML_IS_PRAGMA_REGEXP = new RegExp(...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/constants.evaluate.js
src/language-markdown/constants.evaluate.js
import { all as getCjkCharset } from "cjk-regex"; import { Charset } from "regexp-util"; import unicodeRegex from "unicode-regex"; const cjkCharset = new Charset( getCjkCharset(), unicodeRegex({ Script_Extensions: ["Han", "Katakana", "Hiragana", "Hangul", "Bopomofo"], General_Category: [ "Other_Lette...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/index.js
src/language-markdown/index.js
export { default as languages } from "./languages.evaluate.js"; export { default as options } from "./options.js"; export * as parsers from "./parsers.js"; export * as printers from "./printers.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parsers.js
src/language-markdown/parsers.js
import { locEnd, locStart } from "./loc.js"; import { parseMarkdown, parseMdx } from "./parse/index.js"; import { hasIgnorePragma, hasPragma } from "./pragma.js"; function createParser(parse) { return { astFormat: "mdast", hasPragma, hasIgnorePragma, locStart, locEnd, parse, }; } const mar...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/utilities.js
src/language-markdown/utilities.js
import * as assert from "#universal/assert"; import { CJK_REGEXP, PUNCTUATION_REGEXP } from "./constants.evaluate.js"; import { locEnd, locStart } from "./loc.js"; const INLINE_NODE_TYPES = new Set([ "liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkRef...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/clean.js
src/language-markdown/clean.js
import collapseWhiteSpace from "collapse-white-space"; import { isFrontMatter } from "../main/front-matter/index.js"; import { hasPragma } from "./pragma.js"; const ignoredProperties = new Set([ "position", "raw", // front-matter ]); function clean(original, cloned, parent) { // for codeblock if ( original...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/options.js
src/language-markdown/options.js
import commonOptions from "../common/common-options.evaluate.js"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.evaluate.js const options = { proseWrap: commonOptions.proseWrap, singleQuote: commonOptions.singleQuote, }; export default options;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/printers.js
src/language-markdown/printers.js
import clean from "./clean.js"; import embed from "./embed.js"; import { insertPragma } from "./pragma.js"; import { printMdast, printPrettierIgnored } from "./print/index.js"; import preprocess from "./print/preprocess.js"; import getVisitorKeys from "./traverse/get-visitor-keys.js"; import { hasPrettierIgnore } from ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/loc.js
src/language-markdown/loc.js
const locStart = (node) => node.position.start.offset; const locEnd = (node) => node.position.end.offset; export { locEnd, locStart };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/pragma.js
src/language-markdown/pragma.js
import { parseFrontMatter } from "../main/front-matter/index.js"; import { FORMAT_PRAGMA_TO_INSERT, MARKDOWN_HAS_IGNORE_PRAGMA_REGEXP, MARKDOWN_HAS_PRAGMA_REGEXP, } from "../utilities/pragma/pragma.evaluate.js"; const hasPragma = (text) => parseFrontMatter(text).content.trimStart().match(MARKDOWN_HAS_PRAGMA_RE...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/embed.js
src/language-markdown/embed.js
import { hardline, markAsRoot, replaceEndOfLine } from "../document/index.js"; import getMaxContinuousCount from "../utilities/get-max-continuous-count.js"; import inferParser from "../utilities/infer-parser.js"; import { getFencedCodeBlockValue } from "./utilities.js"; function embed(path, options) { const { node }...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/languages.evaluate.js
src/language-markdown/languages.evaluate.js
import * as linguistLanguages from "linguist-languages"; import createLanguage from "../utilities/create-language.js"; const languages = [ createLanguage(linguistLanguages.Markdown, (data) => ({ parsers: ["markdown"], vscodeLanguageIds: ["markdown"], filenames: [...data.filenames, "README"], extensio...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/index.js
src/language-markdown/parse/index.js
export { parseMarkdown } from "./parse-markdown.js"; export { parseMdx } from "./parse-mdx.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/parse-markdown.js
src/language-markdown/parse/parse-markdown.js
import { fromMarkdown } from "mdast-util-from-markdown"; import { mathFromMarkdown } from "mdast-util-math"; import { fromMarkdown as wikiLinkFromMarkdown } from "mdast-util-wiki-link"; import { gfm as gfmSyntax } from "micromark-extension-gfm"; import { math as mathSyntax } from "micromark-extension-math"; import { sy...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/mdx.js
src/language-markdown/parse/mdx.js
/** * modified from https://github.com/mdx-js/mdx/blob/c91b00c673bcf3e7c28b861fd692b69016026c45/packages/remark-mdx/index.js * * The MIT License (MIT) * * Copyright (c) 2017-2018 Compositor and Zeit, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and ass...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/parse-mdx.js
src/language-markdown/parse/parse-mdx.js
import footnotes from "remark-footnotes"; import remarkMath from "remark-math"; import remarkParse from "remark-parse"; import unified from "unified"; import { BLOCKS_REGEX, esSyntax } from "./mdx.js"; import frontMatter from "./unified-plugins/front-matter.js"; import htmlToJsx from "./unified-plugins/html-to-jsx.js";...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/unified-plugins/front-matter.js
src/language-markdown/parse/unified-plugins/front-matter.js
import { parseFrontMatter } from "../../../main/front-matter/index.js"; /** @import {Plugin, Settings} from "unified" */ /** * @type {Plugin<[], Settings>} */ const frontMatter = function () { const proto = this.Parser.prototype; proto.blockMethods = ["frontMatter", ...proto.blockMethods]; proto.blockTokenize...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/unified-plugins/html-to-jsx.js
src/language-markdown/parse/unified-plugins/html-to-jsx.js
import { INLINE_NODE_WRAPPER_TYPES, mapAst } from "../../utilities.js"; import { COMMENT_REGEX } from "../mdx.js"; function htmlToJsx() { return (ast) => mapAst(ast, (node, _index, [parent]) => { if ( node.type !== "html" || // Keep HTML-style comments (legacy MDX) COMMENT_REGEX.tes...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/unified-plugins/wiki-link.js
src/language-markdown/parse/unified-plugins/wiki-link.js
/** @import {Plugin, Settings} from "unified" */ /** * @type {Plugin<[], Settings>} */ const wikiLink = function () { const entityType = "wikiLink"; const wikiLinkRegex = /^\[\[(?<linkContents>.+?)\]\]/s; const proto = this.Parser.prototype; const methods = proto.inlineMethods; methods.splice(methods.index...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/unified-plugins/liquid.js
src/language-markdown/parse/unified-plugins/liquid.js
/** @import {Plugin, Settings} from "unified" */ /** * @type {Plugin<[], Settings>} */ const liquid = function () { const proto = this.Parser.prototype; const methods = proto.inlineMethods; methods.splice(methods.indexOf("text"), 0, "liquid"); proto.inlineTokenizers.liquid = tokenizer; function tokenizer(...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/micromark/mdast-util-gfm.js
src/language-markdown/parse/micromark/mdast-util-gfm.js
// There is no way to disable autolink // Hackly find and replace `gfm-autolink-literal` // https://github.com/remarkjs/remark-gfm/issues/16#issuecomment-899046315 import { gfmFromMarkdown as originalGfmFromMarkdown } from "mdast-util-gfm"; import * as assert from "#universal/assert"; /** @import {Extension} from "md...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/micromark/micromark-extension-html-text.js
src/language-markdown/parse/micromark/micromark-extension-html-text.js
// copied from https://github.com/micromark/micromark/blob/774a70c6bae6dd94486d3385dbd9a0f14550b709/packages/micromark-core-commonmark/dev/lib/html-text.js // and modified to preserve whitespace inside quoted attribute values /** * @import { * Code, * Construct, * State, * TokenizeContext, * Tokenizer ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/parse/micromark/micromark-extension-liquid.js
src/language-markdown/parse/micromark/micromark-extension-liquid.js
import { markdownLineEnding } from "micromark-util-character"; import { codes, types } from "micromark-util-symbol"; /** * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension * @typedef {import('mdast-util-from-markdown').Token} Token * @typedef {import('mdast-util-from-markdown').CompileC...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/traverse/visitor-keys.evaluate.js
src/language-markdown/traverse/visitor-keys.evaluate.js
import { generateReferenceSharedVisitorKeys } from "../../utilities/visitor-keys.js"; const visitorKeys = generateReferenceSharedVisitorKeys({ root: ["children"], paragraph: ["children"], sentence: ["children"], word: [], whitespace: [], emphasis: ["children"], strong: ["children"], delete: ["children"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/traverse/get-visitor-keys.js
src/language-markdown/traverse/get-visitor-keys.js
import createGetVisitorKeys from "../../utilities/create-get-visitor-keys.js"; import visitorKeys from "./visitor-keys.evaluate.js"; const getVisitorKeys = createGetVisitorKeys(visitorKeys); export default getVisitorKeys;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/preprocess.js
src/language-markdown/print/preprocess.js
import htmlWhitespace from "../../utilities/html-whitespace.js"; import { getOrderedListItemInfo, mapAst, splitText } from "../utilities.js"; // 0x0 ~ 0x10ffff const isSingleCharRegex = /^\\?.$/su; const isNewLineBlockquoteRegex = /^\n *>[ >]*$/; function preprocess(ast, options) { if (options.parser === "mdx") { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/list.js
src/language-markdown/print/list.js
import { align } from "../../document/index.js"; import { getNthListSiblingIndex, hasGitDiffFriendlyOrderedList, } from "../utilities.js"; import { printChildren } from "./children.js"; /** * @import AstPath from "../../common/ast-path.js" * @import {Doc} from "../../document/index.js" */ /** * @param {AstPat...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/word.js
src/language-markdown/print/word.js
import { PUNCTUATION_REGEXP } from "../constants.evaluate.js"; import { isAutolink } from "../utilities.js"; /** * @import AstPath from "../../common/ast-path.js" * @import {Doc} from "../../document/index.js" */ /** * @param {AstPath} path * @return {Doc} */ function printWord(path) { const { node } = path; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/index.js
src/language-markdown/print/index.js
export { printPrettierIgnored } from "./ignored.js"; export { printMdast } from "./mdast.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/children.js
src/language-markdown/print/children.js
import { hardline } from "../../document/index.js"; import { INLINE_NODE_TYPES, INLINE_NODE_WRAPPER_TYPES, isPrettierIgnore, isSetextHeading, } from "../utilities.js"; /** * @import AstPath from "../../common/ast-path.js" * @import {Doc} from "../../document/index.js" */ /** * @param {AstPath} path * @pa...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/ignored.js
src/language-markdown/print/ignored.js
/** * @import AstPath from "../../common/ast-path.js"; * @import {Doc} from "../../document/index.js"; */ /** * @param {AstPath} path * @param {*} options * @returns {Doc} */ function printPrettierIgnored(path, options) { const originalText = options.originalText.slice( path.node.position.start.offset, ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/whitespace.js
src/language-markdown/print/whitespace.js
import { hardline, line, softline } from "../../document/index.js"; import { isSetextHeading, KIND_CJ_LETTER, KIND_CJK_PUNCTUATION, KIND_K_LETTER, KIND_NON_CJK, } from "../utilities.js"; /** * @import {WordNode, WhitespaceValue, WordKind} from "../utilities.js" * @import AstPath from "../../common/ast-path...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/paragraph.js
src/language-markdown/print/paragraph.js
import { DOC_TYPE_ARRAY, DOC_TYPE_FILL, fill, getDocType, } from "../../document/index.js"; /** * @import AstPath from "../../common/ast-path.js" * @import {Doc} from "../../document/index.js" */ /** * @param {AstPath} path * @param {*} options * @param {*} print * @returns {Doc} */ function printPara...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/mdast.js
src/language-markdown/print/mdast.js
import collapseWhiteSpace from "collapse-white-space"; import escapeStringRegexp from "escape-string-regexp"; import { align, DOC_TYPE_STRING, fill, getDocType, group, hardline, indent, line, literalline, markAsRoot, replaceEndOfLine, softline, } from "../../document/index.js"; import getMaxCont...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/table.js
src/language-markdown/print/table.js
import { breakParent, group, hardlineWithoutBreakParent, ifBreak, join, } from "../../document/index.js"; import { printDocToString } from "../../document/printer/printer.js"; import getStringWidth from "../../utilities/get-string-width.js"; function printTable(path, options, print) { const { node } = path...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/sentence.js
src/language-markdown/print/sentence.js
/** * @import AstPath from "../../common/ast-path.js" * @import {Doc} from "../../document/index.js" */ import { DOC_TYPE_STRING, fill, getDocType } from "../../document/index.js"; /** * @param {AstPath} path * @param {*} print * @returns {Doc} */ function printSentence(path, print) { /** @type {Doc[]} */ ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/language-markdown/print/heading.js
src/language-markdown/print/heading.js
import { hardline } from "../../document/index.js"; import { isSetextHeading } from "../utilities.js"; import { printChildren } from "./children.js"; function printAtxHeading(path, options, print) { return [ "#".repeat(path.node.depth) + " ", printChildren(path, options, print), ]; } function printSetextH...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/find-project-root.js
src/config/find-project-root.js
// Simple version of `find-project-root` // https://github.com/kirstein/find-project-root/blob/master/index.js import * as path from "node:path"; import { DirectorySearcher } from "search-closest"; const DIRECTORIES = [".git", ".hg"]; /** @type {DirectorySearcher} */ let searcher; /** * Find the directory contains...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/resolve-config.js
src/config/resolve-config.js
import path from "node:path"; import micromatch from "micromatch"; import { toPath } from "url-or-path"; import partition from "../utilities/partition.js"; import { clearEditorconfigCache, loadEditorconfig as loadEditorconfigForFile, } from "./editorconfig/index.js"; import { clearPrettierConfigCache, loadPrett...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/editorconfig/index.js
src/config/editorconfig/index.js
import path from "node:path"; import { parse as parseEditorconfig } from "editorconfig-without-wasm"; import { clearFindProjectRootCache, findProjectRoot, } from "../find-project-root.js"; import editorConfigToPrettier from "./editorconfig-to-prettier.js"; /** @typedef {ReturnType<editorConfigToPrettier>} EditorCo...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/editorconfig/editorconfig-to-prettier.js
src/config/editorconfig/editorconfig-to-prettier.js
const isPositiveInteger = (value) => Number.isSafeInteger(value) && value > 0; function editorConfigToPrettier(editorConfig) { if (!editorConfig) { return; } const result = {}; const { indent_style, indent_size, tab_width, max_line_length, quote_type, end_of_line, } = editorConf...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/prettier-config/load-config.js
src/config/prettier-config/load-config.js
import path from "node:path"; import loadExternalConfig from "./load-external-config.js"; import loaders, { loadConfigFromPackageJson, loadConfigFromPackageYaml, } from "./loaders.js"; async function loadConfig(configFile) { const { base: fileName, ext: extension } = path.parse(configFile); const load = fi...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/prettier-config/loaders.js
src/config/prettier-config/loaders.js
import { pathToFileURL } from "node:url"; import json5 from "json5"; import parseJson from "parse-json"; import { parse as parseToml } from "smol-toml"; import readFile from "../../utilities/read-file.js"; async function readJson(file) { const content = await readFile(file); try { return parseJson(content); ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/prettier-config/index.js
src/config/prettier-config/index.js
import path from "node:path"; import mockable from "../../common/mockable.js"; import getConfigSearcher from "./config-searcher.js"; import loadConfig from "./load-config.js"; /** @import {FileSearcher} from 'search-closest' */ const loadCache = new Map(); const searchCache = new Map(); function clearPrettierConfigCa...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/prettier-config/load-external-config.js
src/config/prettier-config/load-external-config.js
import importFromFile from "../../utilities/import-from-file.js"; import requireFromFile from "../../utilities/require-from-file.js"; const requireErrorCodesShouldBeIgnored = new Set([ "MODULE_NOT_FOUND", "ERR_REQUIRE_ESM", "ERR_PACKAGE_PATH_NOT_EXPORTED", "ERR_REQUIRE_ASYNC_MODULE", ]); async function loadExt...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/config/prettier-config/config-searcher.js
src/config/prettier-config/config-searcher.js
import { FileSearcher } from "search-closest"; import { loadConfigFromPackageJson, loadConfigFromPackageYaml, } from "./loaders.js"; /** @import {SearcherOptions} from 'search-closest' */ // Align with docs, docs/configuration.md const CONFIG_FILE_NAMES = [ "package.json", "package.yaml", ".prettierrc", ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/mockable.js
src/cli/mockable.js
import fs from "node:fs/promises"; import { performance } from "node:perf_hooks"; import { isCI } from "ci-info"; // @ts-expect-error import { __internal as sharedWithCli } from "../index.js"; import clearStreamText from "./utilities/clear-stream-text.js"; const mockable = sharedWithCli.utilities.createMockable({ cl...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/file-info.js
src/cli/file-info.js
import path from "node:path"; import stringify from "fast-json-stable-stringify"; import { format, getFileInfo } from "../index.js"; import { printToScreen } from "./utilities.js"; // Note: This does not work with `--config-precedence` async function logFileInfoOrDie(context) { const { fileInfo: file, ignore...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/constants.evaluate.js
src/cli/constants.evaluate.js
import { outdent } from "outdent"; import { optionCategories } from "./prettier-internal.js"; const categoryOrder = [ optionCategories.CATEGORY_OUTPUT, optionCategories.CATEGORY_FORMAT, optionCategories.CATEGORY_CONFIG, optionCategories.CATEGORY_EDITOR, optionCategories.CATEGORY_OTHER, ]; const usageSummary...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/directory-ignorer.js
src/cli/directory-ignorer.js
import path from "node:path"; // Ignores files in version control systems directories and `node_modules` const alwaysIgnoredDirectories = [".git", ".sl", ".svn", ".hg", ".jj"]; const withNodeModules = [...alwaysIgnoredDirectories, "node_modules"]; const cwd = process.cwd(); class DirectoryIgnorer { #directories; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/prettier-internal.js
src/cli/prettier-internal.js
// @ts-expect-error import { __internal as sharedWithCli } from "../index.js"; export const { errors, optionCategories, createIsIgnoredFunction, formatOptionsHiddenDefaults, normalizeOptions, getSupportInfoWithoutPlugins, normalizeOptionSettings, vnopts, fastGlob, createTwoFilesPatch, picocolors,...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/index.js
src/cli/index.js
import * as prettier from "../index.js"; import Context from "./context.js"; import logFileInfoOrDie from "./file-info.js"; import logResolvedConfigPathOrDie from "./find-config-path.js"; import { formatFiles, formatStdin } from "./format.js"; import createLogger from "./logger.js"; import mockable from "./mockable.js"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/utilities.js
src/cli/utilities.js
import fs from "node:fs/promises"; import path from "node:path"; import sdbm from "sdbm"; // @ts-expect-error import { __internal as sharedWithCli } from "../index.js"; // eslint-disable-next-line no-console const printToScreen = console.log.bind(console); /** * @template Obj * @template Key * @param {Array<Obj>} ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/cli-options.evaluate.js
src/cli/cli-options.evaluate.js
import { outdent } from "outdent"; import { optionCategories } from "./prettier-internal.js"; /** * { * [optionName]: { * // The type of the option. For 'choice', see also `choices` below. * // When passing a type other than the ones listed below, the option is * // treated as taking any string as a...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/format-results-cache.js
src/cli/format-results-cache.js
// Inspired by LintResultsCache from ESLint // https://github.com/eslint/eslint/blob/c2d0a830754b6099a3325e6d3348c3ba983a677a/lib/cli-engine/lint-result-cache.js import fs from "node:fs"; import stringify from "fast-json-stable-stringify"; import fileEntryCache from "file-entry-cache"; import { version as prettierVers...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/expand-patterns.js
src/cli/expand-patterns.js
import path from "node:path"; import { directoryIgnorerWithNodeModules, directoryIgnorerWithoutNodeModules, } from "./directory-ignorer.js"; import { fastGlob } from "./prettier-internal.js"; import { lstatSafe, normalizeToPosix } from "./utilities.js"; /** @import {Context} from './context.js' */ /** * @param {...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/logger.js
src/cli/logger.js
import mockable from "./mockable.js"; import { picocolors } from "./prettier-internal.js"; const { argv, env } = process; // https://github.com/alexeyraspopov/picocolors/blob/0e7c4af2de299dd7bc5916f2bddd151fa2f66740/picocolors.js#L2 // Not working on Windows, but this is how `picocolors` works for stdout, let's keep i...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/context.js
src/cli/context.js
import { getContextOptions } from "./options/get-context-options.js"; import { parseArgv, parseArgvWithoutPlugins, } from "./options/parse-cli-arguments.js"; /** * @typedef {Object} Context * @property logger * @property {string[]} rawArguments * @property argv * @property {string[]} filePatterns * @property...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/find-config-path.js
src/cli/find-config-path.js
import path from "node:path"; import { resolveConfigFile } from "../index.js"; import { normalizeToPosix, printToScreen } from "./utilities.js"; async function logResolvedConfigPathOrDie(context) { const file = context.argv.findConfigPath; const configFile = await resolveConfigFile(file); if (configFile) { p...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/print-support-info.js
src/cli/print-support-info.js
import stringify from "fast-json-stable-stringify"; import { format, getSupportInfo } from "../index.js"; import { omit, printToScreen } from "./utilities.js"; const sortByName = (array) => array.sort((a, b) => a.name.localeCompare(b.name)); async function printSupportInfo() { const { languages, options } = await...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/usage.js
src/cli/usage.js
import camelCase from "camelcase"; import { categoryOrder, usageSummary } from "./constants.evaluate.js"; import { formatOptionsHiddenDefaults } from "./prettier-internal.js"; import { groupBy } from "./utilities.js"; const OPTION_USAGE_THRESHOLD = 25; const CHOICE_USAGE_MARGIN = 3; const CHOICE_USAGE_INDENTATION = 2;...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/find-cache-file.js
src/cli/find-cache-file.js
import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import findCacheDirectory from "find-cache-directory"; import { isJson, statSafe } from "./utilities.js"; /** * Find default cache file (`./node_modules/.cache/prettier/.prettier-cache`) using https://github.com/sindresorhus/fi...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/format.js
src/cli/format.js
import fs from "node:fs/promises"; import path from "node:path"; import getStdin from "get-stdin"; import * as prettier from "../index.js"; import { expandPatterns } from "./expand-patterns.js"; import findCacheFile from "./find-cache-file.js"; import FormatResultsCache from "./format-results-cache.js"; import mockable...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/normalize-cli-options.js
src/cli/options/normalize-cli-options.js
import { closetLevenshteinMatch, normalizeOptions, picocolors, vnopts, } from "../prettier-internal.js"; const descriptor = { key: (key) => (key.length === 1 ? `-${key}` : `--${key}`), value: (value) => vnopts.apiDescriptor.value(value), pair: ({ key, value }) => value === false ? `--no-${key}`...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/parse-cli-arguments.js
src/cli/options/parse-cli-arguments.js
import camelCase from "camelcase"; import { pick } from "../utilities.js"; import createMinimistOptions from "./create-minimist-options.js"; import { getContextOptionsWithoutPlugins } from "./get-context-options.js"; import minimist from "./minimist.js"; import normalizeCliOptions from "./normalize-cli-options.js"; fu...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/get-options-for-file.js
src/cli/options/get-options-for-file.js
import dashify from "dashify"; import { resolveConfig } from "../../index.js"; import { normalizeOptions as normalizeApiOptions } from "../prettier-internal.js"; import createMinimistOptions from "./create-minimist-options.js"; import minimist from "./minimist.js"; import normalizeCliOptions from "./normalize-cli-optio...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/minimist.js
src/cli/options/minimist.js
import minimist from "minimist"; const PLACEHOLDER = null; /** * unspecified boolean flag without default value is parsed as `undefined` instead of `false` */ export default function minimistParse(args, options) { /* c8 ignore next */ const boolean = options.boolean ?? []; /* c8 ignore next */ const default...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/get-context-options.js
src/cli/options/get-context-options.js
import dashify from "dashify"; import { getSupportInfo } from "../../index.js"; import cliOptions from "../cli-options.evaluate.js"; import { getSupportInfoWithoutPlugins, normalizeOptionSettings, optionCategories, } from "../prettier-internal.js"; const detailedCliOptions = normalizeOptionSettings(cliOptions).m...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/options/create-minimist-options.js
src/cli/options/create-minimist-options.js
export default function createMinimistOptions(detailedOptions) { const booleanNames = []; // Numeric-looking arguments will be returned as numbers unless opts.string or opts.boolean contains that argument name. // To disable numeric conversion for non-option arguments, add '_' to opts.string. // https://github....
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/cli/utilities/clear-stream-text.js
src/cli/utilities/clear-stream-text.js
import readline from "node:readline"; import stripAnsi from "strip-ansi"; import wcwidth from "wcwidth.js"; const countLines = (stream, text) => { const columns = stream.columns || 80; let lineCount = 0; for (const line of stripAnsi(text).split("\n")) { lineCount += Math.max(1, Math.ceil(wcwidth(line) / colu...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/public.js
src/document/public.js
import { addAlignmentToDoc, align, breakParent, conditionalGroup, cursor, dedent, dedentToRoot, fill, group, hardline, hardlineWithoutBreakParent, ifBreak, indent, indentIfBreak, join, label, line, lineSuffix, lineSuffixBoundary, literalline, literallineWithoutBreakParent, ma...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/index.js
src/document/index.js
export * from "./builders/index.js"; export * from "./debug.js"; export * from "./printer/printer.js"; export * from "./utilities/index.js";
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/debug.js
src/document/debug.js
import { DOC_TYPE_ALIGN, DOC_TYPE_BREAK_PARENT, DOC_TYPE_CURSOR, DOC_TYPE_FILL, DOC_TYPE_GROUP, DOC_TYPE_IF_BREAK, DOC_TYPE_INDENT, DOC_TYPE_INDENT_IF_BREAK, DOC_TYPE_LABEL, DOC_TYPE_LINE, DOC_TYPE_LINE_SUFFIX, DOC_TYPE_LINE_SUFFIX_BOUNDARY, DOC_TYPE_TRIM, } from "./builders/index.js"; functi...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/indent.js
src/document/builders/indent.js
import { assertDoc } from "../utilities/assert-doc.js"; import { DOC_TYPE_INDENT } from "./types.js"; /** @import {Doc} from "./index.js"; @typedef {{readonly type: DOC_TYPE_INDENT, contents: Doc}} Indent */ /** @param {Doc} contents @returns {Indent} */ function indent(contents) { assertDoc(contents); return { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/break-parent.js
src/document/builders/break-parent.js
import { DOC_TYPE_BREAK_PARENT } from "./types.js"; /** @typedef {{readonly type: DOC_TYPE_BREAK_PARENT}} BreakParent */ /** @typedef {BreakParent} */ const breakParent = { type: DOC_TYPE_BREAK_PARENT }; export { breakParent };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/align.js
src/document/builders/align.js
import { assertAlignType, assertDoc } from "../utilities/assert-doc.js"; import { indent } from "./indent.js"; import { DOC_TYPE_ALIGN } from "./types.js"; /** @import {Doc} from "./index.js"; @import {Indent} from "./indent.js"; @typedef {{readonly type: "root"}} AlignTypeRoot @typedef {number | string | AlignTypeRoo...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/trim.js
src/document/builders/trim.js
import { DOC_TYPE_TRIM } from "./types.js"; /** @typedef {{readonly type: DOC_TYPE_TRIM}} Trim */ /** @typedef {Trim} */ const trim = { type: DOC_TYPE_TRIM }; export { trim };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/types.js
src/document/builders/types.js
export const DOC_TYPE_STRING = /** @type {const} */ ("string"); export const DOC_TYPE_ARRAY = /** @type {const} */ ("array"); export const DOC_TYPE_CURSOR = /** @type {const} */ ("cursor"); export const DOC_TYPE_INDENT = /** @type {const} */ ("indent"); export const DOC_TYPE_ALIGN = /** @type {const} */ ("align"); expo...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/indent-if-break.js
src/document/builders/indent-if-break.js
import { assertDoc } from "../utilities/assert-doc.js"; import { DOC_TYPE_INDENT_IF_BREAK } from "./types.js"; /** @import {Doc} from "./index.js"; @import {GroupId} from "./group.js"; @typedef {{ readonly type: DOC_TYPE_INDENT_IF_BREAK, readonly contents: Doc, readonly groupId: GroupId, readonly negate: boole...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/fill.js
src/document/builders/fill.js
import { assertDocFillParts } from "../utilities/assert-doc.js"; import { DOC_TYPE_FILL } from "./types.js"; /** @import {Doc} from "./index.js"; @typedef {{ readonly type: DOC_TYPE_FILL, readonly parts: readonly Doc[], }} Fill */ /** @param {readonly Doc[]} parts @returns {Fill} */ function fill(parts) { asser...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/if-break.js
src/document/builders/if-break.js
import { assertDoc } from "../utilities/assert-doc.js"; import { DOC_TYPE_IF_BREAK } from "./types.js"; /** @import {Doc} from "./index.js"; @import {GroupId} from "./group.js"; @typedef {{ readonly type: DOC_TYPE_IF_BREAK, readonly breakContents: Doc, readonly flatContents: Doc, readonly groupId: GroupId, }} ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/index.js
src/document/builders/index.js
/** @import {Align} from "./align.js"; @import {BreakParent} from "./break-parent.js"; @import {Cursor} from "./cursor.js"; @import {Fill} from "./fill.js"; @import {Group} from "./group.js"; @import {IfBreak} from "./if-break.js"; @import {Indent} from "./indent.js"; @import {IndentIfBreak} from "./indent-if-break.js"...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/group.js
src/document/builders/group.js
import { assertDoc, assertDocArray } from "../utilities/assert-doc.js"; import { DOC_TYPE_GROUP } from "./types.js"; /** @import {Doc} from "./index.js"; @typedef {symbol} GroupId @typedef {{ readonly type: DOC_TYPE_GROUP, readonly id: GroupId, readonly contents: Doc, readonly break: boolean, readonly expand...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/join.js
src/document/builders/join.js
import { assertDoc, assertDocArray } from "../utilities/assert-doc.js"; /** @import {Doc} from "./index.js"; */ /** @param {Doc} separator @param {Doc[]} docs @returns {Doc[]} */ function join(separator, docs) { assertDoc(separator); assertDocArray(docs); const parts = []; for (let i = 0; i < docs.length; i...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/line-suffix-boundary.js
src/document/builders/line-suffix-boundary.js
import { DOC_TYPE_LINE_SUFFIX_BOUNDARY } from "./types.js"; /** @typedef {{readonly type: DOC_TYPE_LINE_SUFFIX_BOUNDARY}} LineSuffixBoundary */ /** @typedef {LineSuffixBoundary} */ const lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY }; export { lineSuffixBoundary };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/cursor.js
src/document/builders/cursor.js
import { DOC_TYPE_CURSOR } from "./types.js"; /** @typedef {{readonly type: DOC_TYPE_CURSOR}} Cursor */ /** @type {Cursor} */ const cursor = { type: DOC_TYPE_CURSOR }; export { cursor };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/label.js
src/document/builders/label.js
import { assertDoc } from "../utilities/assert-doc.js"; import { DOC_TYPE_LABEL } from "./types.js"; /** @import {Doc} from "./index.js"; @typedef {0 | 0n | '' | false | null | undefined} Falsy @typedef {{ readonly type: DOC_TYPE_LABEL, readonly label: any, readonly contents: Doc, }} Label */ /** Mark a doc wit...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/line.js
src/document/builders/line.js
import { breakParent } from "./break-parent.js"; import { DOC_TYPE_LINE } from "./types.js"; /** @import {BreakParent} from "./break-parent.js"; @typedef {{readonly type: DOC_TYPE_LINE}} Line @typedef {Line & {readonly soft: true}} SoftLine @typedef {Line & {readonly hard: true}} HardlineWithoutBreakParent @typedef {L...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/builders/line-suffix.js
src/document/builders/line-suffix.js
import { assertDoc } from "../utilities/assert-doc.js"; import { DOC_TYPE_LINE_SUFFIX } from "./types.js"; /** @import {Doc} from "./index.js"; @typedef {{readonly type: DOC_TYPE_LINE_SUFFIX, readonly contents: Doc}} LineSuffix */ /** @param {Doc} contents @returns {LineSuffix} */ function lineSuffix(contents) { as...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/utilities/get-doc-type.js
src/document/utilities/get-doc-type.js
import { DOC_TYPE_ARRAY, DOC_TYPE_STRING, VALID_OBJECT_DOC_TYPES, } from "../builders/types.js"; /** @import {Doc} from "../builders/index.js"; */ /** @template {unknown} InputDoc @param {InputDoc} doc @returns { InputDoc extends string ? DOC_TYPE_STRING : InputDoc extends readonly Doc[] ? DOC_TYPE_ARRAY ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/utilities/assert-doc.js
src/document/utilities/assert-doc.js
import noop from "../../utilities/noop.js"; import { DOC_TYPE_IF_BREAK, DOC_TYPE_LINE, DOC_TYPE_STRING, } from "../builders/types.js"; import { isEmptyDoc } from "../utilities/index.js"; import getDocType from "./get-doc-type.js"; import traverseDoc from "./traverse-doc.js"; /** @import {Doc} from "../builders/i...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/utilities/index.js
src/document/utilities/index.js
import { trimNewlinesEnd } from "trim-newlines"; import { DOC_TYPE_ALIGN, DOC_TYPE_ARRAY, DOC_TYPE_BREAK_PARENT, DOC_TYPE_CURSOR, DOC_TYPE_FILL, DOC_TYPE_GROUP, DOC_TYPE_IF_BREAK, DOC_TYPE_INDENT, DOC_TYPE_INDENT_IF_BREAK, DOC_TYPE_LABEL, DOC_TYPE_LINE, DOC_TYPE_LINE_SUFFIX, DOC_TYPE_LINE_SUFF...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/utilities/invalid-doc-error.js
src/document/utilities/invalid-doc-error.js
import { VALID_OBJECT_DOC_TYPES } from "../builders/types.js"; import getDocType from "./get-doc-type.js"; const disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list); function getDocErrorMessage(doc) { const type = doc === null ? "null" : typeof doc; if (type !== ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/utilities/traverse-doc.js
src/document/utilities/traverse-doc.js
import { DOC_TYPE_ALIGN, DOC_TYPE_ARRAY, DOC_TYPE_BREAK_PARENT, DOC_TYPE_CURSOR, DOC_TYPE_FILL, DOC_TYPE_GROUP, DOC_TYPE_IF_BREAK, DOC_TYPE_INDENT, DOC_TYPE_INDENT_IF_BREAK, DOC_TYPE_LABEL, DOC_TYPE_LINE, DOC_TYPE_LINE_SUFFIX, DOC_TYPE_LINE_SUFFIX_BOUNDARY, DOC_TYPE_STRING, DOC_TYPE_TRIM, ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/printer/trim-indentation.js
src/document/printer/trim-indentation.js
// Not using a regexp here because regexps for trimming off trailing // characters are known to have performance issues. /** Get trailing trailing indention length @param {string} text @returns {number} */ function getTrailingIndentionLength(text) { let length = 0; for (let index = text.length - 1; index >= 0; i...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/printer/indent.js
src/document/printer/indent.js
const INDENT_COMMAND_TYPE_INDENT = 0; const INDENT_COMMAND_TYPE_DEDENT = 1; const INDENT_COMMAND_TYPE_WIDTH = 2; const INDENT_COMMAND_TYPE_STRING = 3; /** @import {Align} from "../builders/index.js"; @typedef {{useTabs: boolean, tabWidth: number}} IndentOptions @typedef {{ readonly value: string, readonly length: ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/src/document/printer/printer.js
src/document/printer/printer.js
import { convertEndOfLineOptionToCharacter } from "../../common/end-of-line.js"; import getStringWidth from "../../utilities/get-string-width.js"; import { DOC_TYPE_ALIGN, DOC_TYPE_ARRAY, DOC_TYPE_BREAK_PARENT, DOC_TYPE_CURSOR, DOC_TYPE_FILL, DOC_TYPE_GROUP, DOC_TYPE_IF_BREAK, DOC_TYPE_INDENT, DOC_TYP...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false