@mdsvex/typescript-plugin 0.1.0-next.1 → 0.1.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdsvex/typescript-plugin",
3
- "version": "0.1.0-next.1",
3
+ "version": "0.1.0-next.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pngwn/MDsveX.git",
@@ -9,9 +9,12 @@
9
9
  "description": "TypeScript plugin that teaches tsserver how to resolve .pfm imports",
10
10
  "type": "module",
11
11
  "main": "./lib/index.cjs",
12
+ "files": [
13
+ "lib"
14
+ ],
12
15
  "dependencies": {
13
16
  "@volar/typescript": "^2.4.28",
14
- "@mdsvex/language-core": "0.1.0-next.1"
17
+ "@mdsvex/language-core": "0.1.0-next.3"
15
18
  },
16
19
  "author": "pngwn <hello@pngwn.io>",
17
20
  "license": "MIT",
package/CHANGELOG.md DELETED
@@ -1,34 +0,0 @@
1
- # @mdsvex/typescript-plugin
2
-
3
- ## 0.1.0-next.1
4
-
5
- ### Minor Changes
6
-
7
- - [#887](https://github.com/pngwn/MDsveX/pull/887) [`ffaf805`](https://github.com/pngwn/MDsveX/commit/ffaf805cd7ac2ebb07c1b5a33896c36e53dc6c67) Thanks [@pngwn](https://github.com/pngwn)! - The editor now knows your templates, replacement components and directives. The Vite plugin writes what it resolved to `node_modules/.mdsvex/manifest.json` and the editor reads it, falling back to an `mdsvex.config.json` like the playground's:
8
-
9
- ```json
10
- {
11
- "templates": { "docs": "#lib/templates/Docs.svelte" },
12
- "components": "#lib/markdown.ts"
13
- }
14
- ```
15
-
16
- Hovering a replaced element or directive shows its component, and go to definition opens it. The frontmatter `template` key is typed as your template names or `false`. Completions offer template names, the template's props as frontmatter keys and their literal values, and a directive's props as args with their values. Directive args and the frontmatter of a templated document are type-checked against the component's props, and `metadata` is typed by the same YAML parser `compile()` uses. Compile errors such as an unknown template show on their line, and `.svx` files are supported alongside `.pfm`.
17
-
18
- ### Patch Changes
19
-
20
- - [#887](https://github.com/pngwn/MDsveX/pull/887) [`ffaf805`](https://github.com/pngwn/MDsveX/commit/ffaf805cd7ac2ebb07c1b5a33896c36e53dc6c67) Thanks [@pngwn](https://github.com/pngwn)! - With the Svelte extension installed, `.ts` files that re-export `.svelte` components no longer report `Cannot find module`.
21
-
22
- - Updated dependencies [[`ffaf805`](https://github.com/pngwn/MDsveX/commit/ffaf805cd7ac2ebb07c1b5a33896c36e53dc6c67), [`57ecb44`](https://github.com/pngwn/MDsveX/commit/57ecb446b292a3406dcf62550986ed15e1aa2b80)]:
23
- - @mdsvex/language-core@0.1.0-next.1
24
-
25
- ## 0.1.0-next.0
26
-
27
- ### Minor Changes
28
-
29
- - [#799](https://github.com/pngwn/MDsveX/pull/799) [`5b54692`](https://github.com/pngwn/MDsveX/commit/5b54692d6c895f02c947ce620a46c7a9beb856e9) Thanks [@pngwn](https://github.com/pngwn)! - Add language tools
30
-
31
- ### Patch Changes
32
-
33
- - Updated dependencies [[`5b54692`](https://github.com/pngwn/MDsveX/commit/5b54692d6c895f02c947ce620a46c7a9beb856e9)]:
34
- - @mdsvex/language-core@0.1.0-next.0
package/src/index.ts DELETED
@@ -1,44 +0,0 @@
1
- /**
2
- * PFM TypeScript Plugin.
3
- *
4
- * Teaches tsserver how to resolve .pfm imports by running them through
5
- * the PFM LanguagePlugin. This enables type-checking of .pfm imports
6
- * in .ts and .svelte files.
7
- *
8
- * Usage in tsconfig.json:
9
- * { "compilerOptions": { "plugins": [{ "name": "@mdsvex/typescript-plugin" }] } }
10
- */
11
-
12
- import { createLanguageServicePlugin } from "@volar/typescript/lib/quickstart/createLanguageServicePlugin.js";
13
- import { create_pfm_language_plugin, create_svelte_language_plugin } from "@mdsvex/language-core";
14
-
15
- // TS plugins must export a factory function via module.exports
16
- // (CJS convention that tsserver expects)
17
- module.exports = createLanguageServicePlugin((ts, info) => {
18
- console.log("[PFM TS Plugin] Loaded! Project:", info.project.getProjectName());
19
- return {
20
- languagePlugins: [
21
- // typescript reads the exports of templates a mdsvex.config.json names
22
- create_pfm_language_plugin({ typescript: ts as any }),
23
- // two plugins claiming .svelte break its imports from .ts files
24
- ...(svelte_plugin_loaded(info) ? [] : [create_svelte_language_plugin()]),
25
- ],
26
- };
27
- });
28
-
29
- const SVELTE_PLUGIN = "typescript-svelte-plugin";
30
-
31
- /** the svelte extension or the tsconfig loads the svelte typescript plugin */
32
- function svelte_plugin_loaded(info: {
33
- project: {
34
- projectService: { globalPlugins?: readonly string[] };
35
- getCompilerOptions(): { plugins?: unknown };
36
- };
37
- }): boolean {
38
- if (info.project.projectService.globalPlugins?.includes(SVELTE_PLUGIN)) return true;
39
- const plugins = info.project.getCompilerOptions().plugins;
40
- return (
41
- Array.isArray(plugins) &&
42
- plugins.some((p) => (p as { name?: unknown })?.name === SVELTE_PLUGIN)
43
- );
44
- }
@@ -1,26 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import { resolve } from "path";
3
-
4
- export default defineConfig({
5
- build: {
6
- lib: {
7
- entry: resolve(__dirname, "src/index.ts"),
8
- formats: ["cjs"],
9
- fileName: "index",
10
- },
11
- outDir: "lib",
12
- target: "node20",
13
- ssr: true,
14
- minify: false,
15
- rollupOptions: {
16
- // the vite plugin half of mdsvex loads vite lazily, the editor never reaches it
17
- external: ["typescript", "vite"],
18
- output: {
19
- entryFileNames: "index.cjs",
20
- },
21
- },
22
- },
23
- ssr: {
24
- noExternal: true,
25
- },
26
- });