Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 12, 2024
1 parent 5b6b3d6 commit a75c562
Show file tree
Hide file tree
Showing 24 changed files with 786 additions and 689 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DefaultTheme } from 'vitepress'
import antfu from '@antfu/eslint-config'
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { bundledThemes } from 'shiki'
import { createTwoslasher as createTwoslasherESLint } from 'twoslash-eslint'
import { defineConfig } from 'vitepress'
import type { DefaultTheme } from 'vitepress'
import { version } from '../../package.json'
import vite from './vite.config'

Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://vitepress.dev/guide/custom-theme
import type { EnhanceAppContext } from 'vitepress'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import Theme from 'vitepress/theme'
import type { EnhanceAppContext } from 'vitepress'

import '@shikijs/vitepress-twoslash/style.css'
import 'uno.css'
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"sass": "^1.78.0",
"unocss": "^0.62.3",
"vitepress": "^1.3.4",
"vue": "^3.5.3"
"vue": "^3.5.4"
}
}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"version": "0.2.11",
"private": true,
"packageManager": "pnpm@9.9.0",
"packageManager": "pnpm@9.10.0",
"scripts": {
"typecheck": "tsc",
"build": "pnpm -r run build",
Expand All @@ -16,22 +16,22 @@
"prepare": "simple-git-hooks"
},
"devDependencies": {
"@antfu/eslint-config": "^3.3.2",
"@antfu/eslint-config": "^3.6.0",
"@iconify-json/ri": "^1.2.0",
"@iconify-json/svg-spinners": "^1.2.0",
"@shikijs/markdown-it": "^1.16.2",
"@shikijs/transformers": "^1.16.2",
"@shikijs/twoslash": "^1.16.2",
"@shikijs/vitepress-twoslash": "^1.16.2",
"@shikijs/markdown-it": "^1.17.0",
"@shikijs/transformers": "^1.17.0",
"@shikijs/twoslash": "^1.17.0",
"@shikijs/vitepress-twoslash": "^1.17.0",
"@types/node": "^22.5.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@typescript/twoslash": "^3.2.8",
"@typescript/vfs": "^1.6.0",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-v8": "^2.1.0",
"@vueuse/core": "^11.0.3",
"bumpp": "^9.5.2",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"esno": "^4.7.0",
"fast-glob": "^3.3.2",
"jiti": "^1.21.6",
Expand All @@ -41,26 +41,26 @@
"preact": "^10.23.2",
"pretty-format": "^29.7.0",
"react": "^18.3.1",
"shiki": "^1.16.2",
"shiki": "^1.17.0",
"simple-git-hooks": "^2.11.1",
"tslib": "^2.7.0",
"twoslash": "workspace:*",
"twoslash-cdn": "workspace:*",
"twoslash-eslint": "workspace:*",
"twoslash-vue": "workspace:*",
"typescript": "^5.5.4",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.3",
"vite": "^5.4.4",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.0.5",
"vue": "^3.5.3"
"vitest": "^2.1.0",
"vue": "^3.5.4"
},
"resolutions": {
"@types/node": "^22.5.4",
"twoslash": "workspace:*",
"twoslash-vue": "workspace:*",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
Expand Down
8 changes: 4 additions & 4 deletions packages/twoslash-cdn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
"@typescript/ata": "^0.9.7",
"@typescript/vfs": "^1.6.0",
"twoslash-cdn": "workspace:*",
"typescript": "^5.5.4",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"unstorage": "^1.11.1",
"vite": "^5.4.3",
"vitest": "^2.0.5"
"unstorage": "^1.12.0",
"vite": "^5.4.4",
"vitest": "^2.1.0"
}
}
6 changes: 3 additions & 3 deletions packages/twoslash-cdn/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"dev": "vite"
},
"dependencies": {
"@shikijs/twoslash": "^1.16.2",
"shiki": "^1.16.2"
"@shikijs/twoslash": "^1.17.0",
"shiki": "^1.17.0"
},
"devDependencies": {
"idb-keyval": "^6.2.1",
"vite": "^5.4.3"
"vite": "^5.4.4"
}
}
2 changes: 1 addition & 1 deletion packages/twoslash-cdn/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TwoslashExecuteOptions, TwoslashFunction, TwoslashOptions, TwoslashReturn } from 'twoslash'
import { setupTypeAcquisition } from '@typescript/ata'
import { createDefaultMapFromCDN } from '@typescript/vfs'
import { createTwoslasher } from 'twoslash'
import ts from 'typescript'
import type { TwoslashExecuteOptions, TwoslashFunction, TwoslashOptions, TwoslashReturn } from 'twoslash'

/**
* A subset of `unstorage`'s interface to maximize the compatibility
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash-eslint/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NodeErrorWithoutPosition, TwoslashGenericFunction, TwoslashGenericResult } from 'twoslash-protocol'
import { Linter } from 'eslint'
import { createPositionConverter, resolveNodePositions } from 'twoslash-protocol'
import type { NodeErrorWithoutPosition, TwoslashGenericFunction, TwoslashGenericResult } from 'twoslash-protocol'

export interface CreateTwoslashESLintOptions {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/twoslash-eslint/test/fixtures.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// <reference types="vite/client" />

import type { Linter } from 'eslint'
import type { TwoslashGenericResult } from 'twoslash-protocol'
import { extname } from 'node:path'
import process from 'node:process'
import antfu from '@antfu/eslint-config'
import { expect, it } from 'vitest'
import type { Linter } from 'eslint'
import type { TwoslashGenericResult } from 'twoslash-protocol'
import { createTwoslasher } from '../src/index'

// To add a test, create a file in the fixtures folder and it will will run through
Expand Down
24 changes: 12 additions & 12 deletions packages/twoslash-vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import type { Language, VueCompilerOptions } from '@vue/language-core'
import type {
CompilerOptionDeclaration,
CreateTwoslashOptions,
HandbookOptions,
ParsedFlagNotation,
Range,
TwoslashExecuteOptions,
TwoslashInstance,
TwoslashReturnMeta,
} from 'twoslash'
import type { CompilerOptions } from 'typescript'
import { createLanguage, createVueLanguagePlugin, defaultMapperFactory, FileMap, resolveVueCompilerOptions, setupGlobalTypes } from '@vue/language-core'
import {
createTwoslasher as createTwoslasherBase,
Expand All @@ -13,18 +25,6 @@ import {
resolveNodePositions,
} from 'twoslash-protocol'
import ts from 'typescript'
import type { Language, VueCompilerOptions } from '@vue/language-core'
import type {
CompilerOptionDeclaration,
CreateTwoslashOptions,
HandbookOptions,
ParsedFlagNotation,
Range,
TwoslashExecuteOptions,
TwoslashInstance,
TwoslashReturnMeta,
} from 'twoslash'
import type { CompilerOptions } from 'typescript'

export interface VueSpecificOptions {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash-vue/test/fixtures.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference types="vite/client" />

import type { TwoslashReturn } from 'twoslash'
import { extname } from 'node:path'
import process from 'node:process'
import { expect, it } from 'vitest'
import type { TwoslashReturn } from 'twoslash'
import { createTwoslasher } from '../src/index'

// To add a test, create a file in the fixtures folder and it will will run through
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash/scripts/flag-keys.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CompilerOptionDeclaration } from '../src/types/options'
import fs from 'node:fs/promises'
import ts from 'typescript'
import { defaultHandbookOptions } from '../src/defaults'
import type { CompilerOptionDeclaration } from '../src/types/options'

async function generateFlagKeys() {
const tsOptionDeclarations = (ts as any).optionDeclarations as CompilerOptionDeclaration[]
Expand Down
12 changes: 5 additions & 7 deletions packages/twoslash/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createFSBackedSystem, createSystem, createVirtualTypeScriptEnvironment } from '@typescript/vfs'
import { createPositionConverter, isInRange, isInRanges, removeCodeRanges, resolveNodePositions } from 'twoslash-protocol'

import type { ErrorLevel, NodeError, NodeWithoutPosition, Position, Range } from 'twoslash-protocol'
import type { CompilerOptions, CompletionEntry, CompletionTriggerKind, DiagnosticCategory, JsxEmit } from 'typescript'

import type { CompilerOptionDeclaration, CreateTwoslashOptions, TwoslashExecuteOptions, TwoslashInstance, TwoslashOptions, TwoslashReturn, TwoslashReturnMeta, VirtualFile } from './types'
import { createFSBackedSystem, createSystem, createVirtualTypeScriptEnvironment } from '@typescript/vfs'

import { createPositionConverter, isInRange, isInRanges, removeCodeRanges, resolveNodePositions } from 'twoslash-protocol'
import { defaultCompilerOptions, defaultHandbookOptions } from './defaults'
import { TwoslashError } from './error'
import { findCutNotations, findFlagNotations, findQueryMarkers, getExtension, getIdentifierTextSpans, getObjectHash, removeTsExtension, splitFiles, typesToExtension } from './utils'
import { validateCodeForErrors } from './validation'

import type { CompilerOptionDeclaration, CreateTwoslashOptions, TwoslashExecuteOptions, TwoslashInstance, TwoslashOptions, TwoslashReturn, TwoslashReturnMeta, VirtualFile } from './types'
import { validateCodeForErrors } from './validation'

export * from './public'

Expand Down Expand Up @@ -207,12 +207,10 @@ export function createTwoslasher(createOptions: CreateTwoslashOptions = {}): Two
}
// #endregion

// eslint-disable-next-line unicorn/consistent-function-scoping
function getOffsetInFile(offset: number, file: VirtualFile) {
return offset - file.offset + (file.prepend?.length || 0)
}

// eslint-disable-next-line unicorn/consistent-function-scoping
function getFileContent(file: VirtualFile) {
return (file.prepend || '') + file.content + (file.append || '')
}
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash/src/fallback.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TwoslashReturnMeta } from './types'
import { removeCodeRanges } from 'twoslash-protocol'
import { flagKeys } from './flag-keys'
import { reAnnonateMarkers, reConfigBoolean, reConfigValue } from './regexp'
import { findCutNotations } from './utils'
import type { TwoslashReturnMeta } from './types'

/**
* A fallback function to strip out twoslash annotations from a string and does nothing else.
Expand Down
4 changes: 2 additions & 2 deletions packages/twoslash/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TwoslashOptions } from './core'
import type { TwoslashOptionsLegacy, TwoslashReturnLegacy } from './legacy'
import ts from 'typescript'
import { createTwoslasher as _createTwoslasher, twoslasher as _twoslasher } from './core'
import { convertLegacyOptions, convertLegacyReturn } from './legacy'
import type { TwoslashOptions } from './core'
import type { TwoslashOptionsLegacy, TwoslashReturnLegacy } from './legacy'

export * from './legacy'
export * from './public'
Expand Down
4 changes: 2 additions & 2 deletions packages/twoslash/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { objectHash } from 'ohash'
import type { createPositionConverter, Range } from 'twoslash-protocol'
import type { SourceFile } from 'typescript'
import type { CompilerOptionDeclaration, ParsedFlagNotation, TwoslashReturnMeta, VirtualFile } from './types'
import { objectHash } from 'ohash'
import { defaultHandbookOptions } from './defaults'
import { TwoslashError } from './error'
import { reAnnonateMarkers, reConfigBoolean, reConfigValue, reCutAfter, reCutBefore, reCutEnd, reCutStart, reFilenamesMakers } from './regexp'
import type { CompilerOptionDeclaration, ParsedFlagNotation, TwoslashReturnMeta, VirtualFile } from './types'

export function getObjectHash(obj: any): string {
return objectHash(obj)
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash/test/custom_transformers.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Node, SourceFile, TransformationContext, TransformerFactory } from 'typescript'
import { isSourceFile, isStringLiteral, visitEachChild, visitNode } from 'typescript'
import { expect, it } from 'vitest'
import type { Node, SourceFile, TransformationContext, TransformerFactory } from 'typescript'
import { twoslasher } from '../src/index'

it('applies custom transformers', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash/test/fixtures.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference types="vite/client" />

import type { TwoslashReturn } from '../src/types'
import { extname } from 'node:path'
import process from 'node:process'
import { expect, it } from 'vitest'
import { createTwoslasher, removeTwoslashNotations } from '../src/index'
import type { TwoslashReturn } from '../src/types'

// To add a test, create a file in the fixtures folder and it will will run through
// as though it was the codeblock.
Expand Down
2 changes: 1 addition & 1 deletion packages/twoslash/test/new.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TwoslashReturn } from '../src/types'
import ts from 'typescript'
import { expect, it } from 'vitest'
import { twoslasher } from '../src'
import { splitFiles } from '../src/utils'
import type { TwoslashReturn } from '../src/types'

export type TS = typeof import('typescript')

Expand Down
6 changes: 4 additions & 2 deletions packages/twoslash/test/results/tests/completions-edge-2.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/twoslash/test/results/tests/completions-edge.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions packages/twoslash/test/results/tests/completions-files-2.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a75c562

Please sign in to comment.