Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ export default antfu({
'vue/no-v-text-v-html-on-component',
'vue/component-name-in-template-casing',
'jsonc/sort-array-values',
'pnpm/yaml-no-duplicate-catalog-item',
)
.override('antfu/pnpm/package-json', {
ignores: [
'packages/create-theme/template/package.json',
'packages/create-app/template/package.json',
// VSCE and OVSX do not support pnpm catalog when reading `@types/vscode`'s version.
'packages/vscode/package.json',
],
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"lint-staged": "catalog:dev",
"mermaid": "catalog:frontend",
"playwright-chromium": "catalog:dev",
"prettier": "catalog:frontend",
"prettier": "catalog:dev",
"prettier-plugin-slidev": "catalog:dev",
"rimraf": "catalog:dev",
"shiki": "catalog:frontend",
Expand Down
1 change: 0 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"monaco-editor": "catalog:monaco",
"nanotar": "catalog:frontend",
"pptxgenjs": "catalog:prod",
"prettier": "catalog:frontend",
"recordrtc": "catalog:frontend",
"shiki": "catalog:frontend",
"shiki-magic-move": "catalog:frontend",
Expand Down
7 changes: 3 additions & 4 deletions packages/slidev/node/vite/extendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const INCLUDE_GLOBAL = [
'@typescript/ata',
'file-saver',
'lz-string',
'prettier',
'recordrtc',
'typescript',
'yaml',
Expand Down Expand Up @@ -90,9 +89,9 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin {
},
...(isInstalledGlobally.value
? await Promise.all(INCLUDE_GLOBAL.map(async dep => ({
find: dep,
replacement: fileURLToPath(await resolveClientDep(dep)),
})))
find: dep,
replacement: fileURLToPath(await resolveClientDep(dep)),
})))
: []
),
],
Expand Down
44 changes: 22 additions & 22 deletions packages/types/src/builtin-layouts.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
export type BuiltinLayouts =
| '404'
| 'center'
| 'cover'
| 'default'
| 'end'
| 'error'
| 'fact'
| 'full'
| 'iframe-left'
| 'iframe-right'
| 'iframe'
| 'image-left'
| 'image-right'
| 'image'
| 'intro'
| 'none'
| 'quote'
| 'section'
| 'statement'
| 'two-cols-header'
| 'two-cols'
export type BuiltinLayouts
= | '404'
| 'center'
| 'cover'
| 'default'
| 'end'
| 'error'
| 'fact'
| 'full'
| 'iframe-left'
| 'iframe-right'
| 'iframe'
| 'image-left'
| 'image-right'
| 'image'
| 'intro'
| 'none'
| 'quote'
| 'section'
| 'statement'
| 'two-cols-header'
| 'two-cols'
28 changes: 14 additions & 14 deletions packages/types/src/clicks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ export type RawSingleAtValue = null | undefined | boolean | string | number
export type RawRangeAtValue = null | undefined | false | [string | number, string | number]
export type RawAtValue = RawSingleAtValue | RawRangeAtValue

export type NormalizedSingleClickValue =
| number // since absolute click
| string // since relative click
| null // disabled
export type NormalizedRangeClickValue =
| [number, number] // [absolute start, absolute end]
| [number, string] // [absolute start, absolute end based on start]
| [string, number] // [relative start, absolute end]
| [string, string] // [relative start, relative end]
| [string | number, string | number] // make TypeScript happy
| null // disabled
export type NormalizedAtValue =
| NormalizedSingleClickValue // since
| NormalizedRangeClickValue // range
export type NormalizedSingleClickValue
= | number // since absolute click
| string // since relative click
| null // disabled
export type NormalizedRangeClickValue
= | [number, number] // [absolute start, absolute end]
| [number, string] // [absolute start, absolute end based on start]
| [string, number] // [relative start, absolute end]
| [string, string] // [relative start, relative end]
| [string | number, string | number] // make TypeScript happy
| null // disabled
export type NormalizedAtValue
= | NormalizedSingleClickValue // since
| NormalizedRangeClickValue // range

export type ClicksElement = Element | string

Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/setups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export interface ShikiContext {
loadTheme: (path: string) => Promise<any>
}

export type ShikiSetupReturn =
Partial<
export type ShikiSetupReturn
= Partial<
& Omit<CodeToHastOptionsCommon<BuiltinLanguage>, 'lang'>
& CodeOptionsThemes<BuiltinTheme>
& CodeOptionsMeta
Expand Down
6 changes: 5 additions & 1 deletion packages/vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ language-server/**
scripts/**
src/**
tsdown.config.ts
*.map
**/*.map
syntaxes/codeblock-patch.ts
syntaxes/slidev.example.md
syntaxes/tsconfig.json
syntaxes/.vscode
2 changes: 0 additions & 2 deletions packages/vscode/language-server/import-meta-url.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"main": "./dist/index.cjs",
"icon": "dist/res/logo.png",
"engines": {
"vscode": "^1.89.0"
"vscode": "^1.101.0"
},
"activationEvents": [
"onStartupFinished"
Expand Down Expand Up @@ -449,13 +449,13 @@
"@slidev/parser": "workspace:*",
"@slidev/types": "workspace:*",
"@types/node": "catalog:types",
"@types/vscode": "catalog:types",
"@types/vscode": "^1.101.0",
"@volar/language-server": "catalog:vscode",
"@volar/vscode": "catalog:vscode",
"get-port-please": "catalog:prod",
"mlly": "catalog:prod",
"ovsx": "catalog:dev",
"prettier": "catalog:frontend",
"prettier": "catalog:vscode",
"reactive-vscode": "catalog:vscode",
"tm-grammars": "catalog:frontend",
"ts-json-schema-generator": "catalog:vscode",
Expand Down
16 changes: 12 additions & 4 deletions packages/vscode/scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs/promises'
import process from 'node:process'
import { x } from 'tinyexec'
import { type Options, x } from 'tinyexec'

async function publish() {
const root = new URL('..', import.meta.url)
Expand All @@ -23,11 +23,19 @@ async function publish() {

console.log('Publishing VS Code extension...')

await x('npm', ['run', 'build'], { nodeOptions: { cwd: root, stdio: 'inherit' } })
const options: Partial<Options> = {
nodeOptions: {
cwd: root,
stdio: 'inherit',
},
throwOnError: true,
}

await x('npm', ['run', 'build'], options)
console.log('\nPublish to VSCE...\n')
await x('npx', ['@vscode/vsce', 'publish', '--no-dependencies', '-p', process.env.VSCE_TOKEN!], { nodeOptions: { cwd: root, stdio: 'inherit' } })
await x('npx', ['@vscode/vsce', 'publish', '--no-dependencies', '-p', process.env.VSCE_TOKEN!], options)
console.log('\nPublish to OVSE...\n')
await x('npx', ['ovsx', 'publish', '--no-dependencies', '-p', process.env.OVSX_TOKEN!], { nodeOptions: { cwd: root, stdio: 'inherit' } })
await x('npx', ['ovsx', 'publish', '--no-dependencies', '-p', process.env.OVSX_TOKEN!], options)
}

publish()
32 changes: 16 additions & 16 deletions packages/vscode/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@ import { defineConfig } from 'tsdown'
import { generateCodeblockPatch } from './syntaxes/codeblock-patch.ts'

export default defineConfig({
// @ts-expect-error `entry` is valid option
entry: {
'index': 'src/index.ts',
'language-server': 'language-server/bin.ts',
},
format: 'cjs',
target: 'node18',
target: 'node20',
clean: true,
minify: process.env.NODE_ENV === 'production',
sourcemap: true,
external: [
'vscode',
],
shims: ['./language-server/import-meta-url.ts'],
define: {
'import.meta.url': 'import_meta_url',
},
alias: {
'@slidev/parser/fs': fileURLToPath(new URL('../parser/src/fs.ts', import.meta.url)),
'@slidev/parser/core': fileURLToPath(new URL('../parser/src/core.ts', import.meta.url)),
'@slidev/parser/types': fileURLToPath(new URL('../parser/src/types.ts', import.meta.url)),
'@slidev/parser': fileURLToPath(new URL('../parser/src/index.ts', import.meta.url)),
},
plugins: [{
name: 'umd2esm',
setup(build: any) {
build.onResolve({ filter: /^(vscode-.*-languageservice|jsonc-parser)/ }, async (args: any) => {
const pathUmdMay = await resolvePath(args.path, { url: args.resolveDir })
// Call twice the replace is to solve the problem of the path in Windows
const pathEsm = pathUmdMay.replace('/umd/', '/esm/').replace('\\umd\\', '\\esm\\')
return { path: pathEsm }
})
plugins: [
{
name: 'umd2esm',
resolveId: {
filter: {
id: /^(vscode-.*-languageservice|vscode-languageserver-types|jsonc-parser)$/,
},
async handler(source, importer) {
const pathUmdMay = await resolvePath(source, { url: importer })
// Call twice the replace is to solve the problem of the path in Windows
const pathEsm = pathUmdMay.replace('/umd/', '/esm/').replace('\\umd\\', '\\esm\\')
return { id: pathEsm }
},
},
},
}],
],
async onSuccess() {
const assetsDir = join(import.meta.dirname, '../../assets')
const resDir = join(import.meta.dirname, './dist/res')
Expand Down
Loading