初始化上传
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled

This commit is contained in:
2026-07-24 17:08:39 +08:00
commit e9e4693333
7516 changed files with 768821 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# Copied from the root directory during publish.
README.md
LICENSE.txt

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
{
"name": "pyright-typeserver",
"displayName": "Pyright Type Server",
"description": "Type Server Protocol (TSP) server for the Python language, powered by Pyright",
"version": "1.1.410",
"license": "MIT",
"author": {
"name": "Microsoft Corporation"
},
"publisher": "Microsoft Corporation",
"engines": {
"node": ">=14.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/pyright",
"directory": "packages/pyright-typeserver"
},
"scripts": {
"build": "rspack build -c rspack.config.js --mode production",
"clean": "shx rm -rf ./dist ./out README.md LICENSE.txt",
"prepack": "npm run clean && shx cp ../../README.md . && shx cp ../../LICENSE.txt . && npm run build",
"webpack": "rspack build -c rspack.config.js --mode development"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
},
"devDependencies": {
"@rspack/cli": "^2.0.5",
"@rspack/core": "^2.0.5",
"@types/node": "^25.9.2",
"copy-webpack-plugin": "^14.0.0",
"esbuild-loader": "^4.5.0",
"shx": "^0.4.0",
"ts-loader": "^9.5.4",
"typescript": "~6.0.3",
"webpack": "^5.104.1"
},
"files": [
"/dist",
"LICENSE.txt"
],
"main": "pyright-typeserver.js",
"bin": {
"pyright-typeserver": "pyright-typeserver.js"
},
"overrides": {
"tar": "7.5.11"
}
}

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
// Stash the base directory into a global variable.
global.__rootDirectory = __dirname + '/dist/';
require('./dist/pyright-typeserver');

View File

@@ -0,0 +1,78 @@
const path = require('path');
const { createRequire } = require('module');
const { monorepoResourceNameMapper, tsconfigResolveAliases } = require('../../build/lib/webpack');
const rspack = createRequire(__filename)('@rspack/core');
const outPath = path.resolve(__dirname, 'dist');
const typeshedFallback = path.resolve(__dirname, '..', 'pyright-internal', 'typeshed-fallback');
/** @type {(env: any, argv: { mode: 'production' | 'development' | 'none' }) => any} */
module.exports = (_, { mode }) => {
return {
context: __dirname,
entry: {
'pyright-typeserver': './src/node/nodeMain.ts',
},
target: 'node',
output: {
filename: '[name].js',
path: outPath,
devtoolModuleFilenameTemplate:
mode === 'development' ? '../[resource-path]' : monorepoResourceNameMapper('pyright-typeserver'),
clean: true,
},
devtool: mode === 'development' ? 'source-map' : 'nosources-source-map',
cache: mode === 'development',
stats: {
all: false,
errors: true,
warnings: true,
publicPath: true,
timings: true,
},
resolve: {
extensions: ['.ts', '.js'],
alias: tsconfigResolveAliases('tsconfig.json'),
},
externals: {
fsevents: 'commonjs2 fsevents',
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, 'tsconfig.json'),
},
},
{
test: /\.js$/,
loader: 'esbuild-loader',
options: {
target: 'node12',
},
},
],
},
plugins: [new rspack.CopyRspackPlugin({ patterns: [{ from: typeshedFallback, to: 'typeshed-fallback' }] })],
optimization: {
splitChunks: {
cacheGroups: {
defaultVendors: {
name: 'vendor',
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
priority: -10,
},
pyright: {
name: 'pyright-internal',
chunks: 'all',
test: /[\\/]pyright-internal[\\/]/,
priority: -20,
},
},
},
},
};
};

View File

@@ -0,0 +1,13 @@
/*
* nodeMain.ts
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT license.
*
* Thin entry-point shim for the Pyright type server. All server logic lives in
* pyright-internal so that vscode-languageserver resolves to a single copy (matching
* how the `pyright` package's entry points shim over pyright-internal).
*/
import { main } from 'pyright-internal/typeServer/nodeMain';
void main();

View File

@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./out",
"rootDir": "../..",
"paths": {
"pyright-internal/*": ["../pyright-internal/src/*"]
},
"typeRoots": ["./node_modules/@types", "../pyright-internal/typings"]
},
"include": ["src/**/*", "**/*.js", "../pyright-internal/typings/*.d.ts"],
"exclude": ["node_modules", "dist", "out", "pyright-typeserver.js"]
}