153 |
154 | ${attributes.map((a, i) => {
155 | const className = i === activeIndex ? "active" : "";
156 | return html`- this.onOptionClick(a.name)}
159 | >
160 | ${a.name}
161 |
`;
162 | })}
163 |
164 |
165 |
166 |
171 | ${command}
172 |
173 | ${copyElement}
174 |
175 |
176 | `;
177 | }
178 | }
179 |
180 | customElements.define("vpf-command", Command);
181 |
--------------------------------------------------------------------------------
/docs/status.md:
--------------------------------------------------------------------------------
1 | ---
2 | index: 8
3 | categoryindex: 1
4 | category: docs
5 | ---
6 |
7 | # Current status
8 |
9 | At present, this project is my personal playground. Like any open-source initiative,
10 | the code is open for perusal – and that's the primary expectation to set.
11 |
12 | ## What works?
13 |
14 | So far, I've managed to run and build my [Telplin project](https://github.com/nojaf/telplin/) locally.
15 | It's a promising start, though it's not yet primed for broader use.
16 | This project does support Fable plugins, but compatibility with other projects isn't assured.
17 |
18 | ## What is published?
19 |
20 | A first package was pushed to [npm](https://www.npmjs.com/package/vite-plugin-fable). This was merely to reserve the package name.
21 |
22 | ## Own aspirations
23 |
24 | I'm looking to incorporate this into a few of my ventures, like [Fantomas tools](https://fsprojects.github.io/fantomas-tools/),
25 | and I'm intrigued by the potential integration with Astro projects and the inclusion of simple scripts.
26 |
27 | ## The roadmap
28 |
29 | This project is a sporadic labor of love. Progress is steady but unhurried, with significant intervals between updates.
30 | I am committed to seeing this through, convinced of its substantial value.
31 | Yet, there's an air of 'memento mori' – it's a passion project that could fade at any moment.
32 |
33 | ## Everything else
34 |
35 | Heads up, folks! The GitHub issue tracker is off the grid. Why, you ask? This isn't just another code repository.
36 | It's a journey, a chunk of my life carved into digital form. Sure, the code's there for you, open and free.
37 | But my time? That's a different story. I've poured years into these skills, building, breaking, learning.
38 | So, I'm channeling my energy into the code, not endless chats.
39 |
40 | Got something sharp, a genuine gem of a contribution? I'm all about that.
41 | Throw a PR my way. Let's get the conversation rolling with some real, in-depth code talk.
42 | Show me you've got the game, that you're not just passing through.
43 |
44 | And if you're thinking, "Hey, I need this guy on my side," then we're talking business, my friend.
45 | [Hit me up](https://nojaf.com/) for some contracting work. That's the signal to me that you're serious, ready to invest in making something awesome together.
46 |
47 |
48 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "9.0.102",
4 | "rollForward": "latestMinor"
5 | }
6 | }
--------------------------------------------------------------------------------
/ideas.md:
--------------------------------------------------------------------------------
1 | # Ideas
2 |
3 | Here, scattered thoughts dwell, crafted for none but my own soul's gaze. No vow within these words shall be bound to the morrow's light.
4 |
5 | - Filter out the diagnostics for files inside fable_modules. Probably configurable via plugin options.
6 | - Fable.Compiler should expose some sort of version property
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { spawn } from "node:child_process";
2 | import { fileURLToPath } from "node:url";
3 | import { promises as fs } from "node:fs";
4 | import path from "node:path";
5 | import { JSONRPCEndpoint } from "ts-lsp-client";
6 | import { normalizePath } from "vite";
7 | import { transform } from "esbuild";
8 | import { filter, map, bufferTime, Subject } from "rxjs";
9 | import colors from "picocolors";
10 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
11 | import withResolvers from "promise.withresolvers";
12 | import { codeFrameColumns } from "@babel/code-frame";
13 |
14 | withResolvers.shim();
15 |
16 | const fsharpFileRegex = /\.(fs|fsx)$/;
17 | const currentDir = path.dirname(fileURLToPath(import.meta.url));
18 | const fableDaemon = path.join(currentDir, "bin/Fable.Daemon.dll");
19 |
20 | if (process.env.VITE_PLUGIN_FABLE_DEBUG) {
21 | console.log(
22 | `Running daemon in debug mode, visit http://localhost:9014 to view logs`,
23 | );
24 | }
25 |
26 | /**
27 | * @typedef {Object} PluginOptions
28 | * @property {string} [fsproj] - The main fsproj to load
29 | * @property {'transform' | 'preserve' | 'automatic' | null} [jsx] - Apply JSX transformation after Fable compilation: https://esbuild.github.io/api/#transformation
30 | * @property {Boolean} [noReflection] - Pass noReflection value to Fable.Compiler
31 | * @property {string[]} [exclude] - Pass exclude to Fable.Compiler
32 | */
33 |
34 | /** @type {PluginOptions} */
35 | const defaultConfig = { jsx: null, noReflection: false, exclude: [] };
36 |
37 | /**
38 | * @function
39 | * @param {PluginOptions} userConfig - The options for configuring the plugin.
40 | * @description Initializes and returns a Vite plugin for to process the incoming F# project.
41 | * @returns {import('vite').Plugin} A Vite plugin object with the standard structure and hooks.
42 | */
43 | export default function fablePlugin(userConfig) {
44 | /** @type {import("./types.js").PluginState} */
45 | const state = {
46 | config: Object.assign({}, defaultConfig, userConfig),
47 | compilableFiles: new Map(),
48 | sourceFiles: new Set(),
49 | fsproj: null,
50 | configuration: "Debug",
51 | dependentFiles: new Set(),
52 | // @ts-ignore
53 | logger: { info: console.log, warn: console.warn, error: console.error },
54 | dotnetProcess: null,
55 | endpoint: null,
56 | pendingChanges: null,
57 | hotPromiseWithResolvers: null,
58 | isBuild: false,
59 | };
60 |
61 | /** @type {Subject