@mdsvex/typescript-plugin 0.0.0 → 0.1.0-next.0

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,15 +1,21 @@
1
1
  {
2
2
  "name": "@mdsvex/typescript-plugin",
3
- "version": "0.0.0",
4
- "description": "Placeholder release so npm trusted publishing can be configured.",
5
- "license": "MIT",
6
- "homepage": "https://mdsvex.pngwn.io",
3
+ "version": "0.1.0-next.0",
7
4
  "repository": {
8
5
  "type": "git",
9
- "url": "https://github.com/pngwn/MDsveX",
6
+ "url": "git+https://github.com/pngwn/MDsveX.git",
10
7
  "directory": "language-tools/typescript-plugin"
11
8
  },
12
- "publishConfig": {
13
- "access": "public"
9
+ "description": "TypeScript plugin that teaches tsserver how to resolve .pfm imports",
10
+ "type": "module",
11
+ "main": "./lib/index.cjs",
12
+ "dependencies": {
13
+ "@volar/typescript": "^2.4.28",
14
+ "@mdsvex/language-core": "0.1.0-next.0"
15
+ },
16
+ "author": "pngwn <hello@pngwn.io>",
17
+ "license": "MIT",
18
+ "scripts": {
19
+ "build": "vite build --config vite.config.build.ts"
14
20
  }
15
21
  }
package/src/index.ts ADDED
@@ -0,0 +1,22 @@
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: [create_pfm_language_plugin(), create_svelte_language_plugin()],
21
+ };
22
+ });
@@ -0,0 +1,25 @@
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
+ external: ["typescript"],
17
+ output: {
18
+ entryFileNames: "index.cjs",
19
+ },
20
+ },
21
+ },
22
+ ssr: {
23
+ noExternal: true,
24
+ },
25
+ });
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @mdsvex/typescript-plugin
2
-
3
- Placeholder. The first real release is published from CI.