Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/create-language-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openworkflowspec/language-service": minor
---

Create the language service package foundation
7 changes: 7 additions & 0 deletions .syncpackrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
}
},
"versionGroups": [
{
"label": "Only language-service may depend on Volar. See the Architecture section in packages/language-service/README.md.",
"dependencies": ["@volar/**", "volar-service-*"],
"packages": ["!@openworkflowspec/language-service"],
"dependencyTypes": ["prod", "dev", "peer"],
"isBanned": true
},
{
"label": "Ignore root package version",
"packages": ["open-workflow-editor"],
Expand Down
3 changes: 3 additions & 0 deletions packages/language-service/.oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../../.oxfmtrc.json"]
}
22 changes: 22 additions & 0 deletions packages/language-service/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["../../.oxlintrc.json"],
"overrides": [
{
"files": ["src/**/*.{ts,tsx}"],
"excludeFiles": ["src/volar/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@volar/*", "volar-service-*"],
"message": "Volar dependencies may only be imported from src/volar. See the Architecture section in README.md."
}
]
}
]
}
}
]
}
48 changes: 48 additions & 0 deletions packages/language-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
Copyright 2021-Present The Open Workflow Specification Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# @openworkflowspec/language-service

Language service foundation for the Open Workflow Specification, built on [Volar](https://volarjs.dev/).

The package provides the common infrastructure for Open Workflow language features.

## Architecture

Volar-specific code is isolated under `src/volar/`. Imports from `@volar/*` outside this directory are prevented by Oxlint.

```text
src/
├── index.ts
└── volar/
└── index.ts
```

## Development

```bash
# Run unit tests
pnpm test

# Linting
pnpm lint

# Build package (development)
pnpm run build:dev

# Build package (production - includes linting and tests)
pnpm run build:prod
```
50 changes: 50 additions & 0 deletions packages/language-service/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@openworkflowspec/language-service",
"version": "1.1.0",
"private": true,
"description": "Open Workflow language service foundation",
"keywords": [],
"homepage": "https://github.com/open-workflow-specification/editor",
"bugs": {
"url": "https://github.com/open-workflow-specification/editor/issues"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/open-workflow-specification/editor.git"
},
"files": [
"dist",
"src"
],
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"clean": "rimraf ./dist",
"build:dev": "pnpm clean && tsc -p tsconfig.json && vite build",
"build:prod": "pnpm lint && pnpm run build:dev && pnpm test",
"lint": "oxlint --config .oxlintrc.json src/ tests/",
"format": "oxfmt --config .oxfmtrc.json",
"format:check": "oxfmt --config .oxfmtrc.json --check",
"test": "vitest run"
},
"dependencies": {
"@volar/language-service": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"oxfmt": "catalog:",
"oxlint": "catalog:",
"rimraf": "catalog:",
"typescript": "catalog:",
"vite": "catalog:",
"vitest": "catalog:"
}
}
17 changes: 17 additions & 0 deletions packages/language-service/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export * from "./volar/index";
24 changes: 24 additions & 0 deletions packages/language-service/src/volar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export { createLanguageService } from "@volar/language-service";

export type {
LanguageService,
LanguageServiceEnvironment,
LanguageServicePlugin,
ProjectContext,
} from "@volar/language-service";
24 changes: 24 additions & 0 deletions packages/language-service/tests/languageService.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { describe, it, expect } from "vitest";
import { createLanguageService } from "../src/index";

describe("createLanguageService", () => {
it("re-exports createLanguageService from @volar/language-service", () => {
expect(typeof createLanguageService).toBe("function");
});
});
14 changes: 14 additions & 0 deletions packages/language-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"sourceMap": false,
"emitDeclarationOnly": true,
"noEmitOnError": true,
"rootDir": "./src",
"outDir": "./dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
35 changes: 35 additions & 0 deletions packages/language-service/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { defineConfig } from "vite";

export default defineConfig({
resolve: {
tsconfigPaths: true,
},
build: {
emptyOutDir: false,
Comment thread
fantonangeli marked this conversation as resolved.
sourcemap: true,
lib: {
entry: "src/index.ts",
fileName: (format) => (format === "es" ? "index.js" : `index.${format}.js`),
formats: ["es"],
},
rollupOptions: {
external: [/^@volar\//],
},
},
});
27 changes: 27 additions & 0 deletions packages/language-service/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { defineConfig } from "vitest/config";

export default defineConfig({
resolve: {
tsconfigPaths: true,
},
test: {
globals: true,
environment: "node",
},
});
Loading