@flowscripter/example-plugin 1.0.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.
@@ -0,0 +1,9 @@
1
+ name: check-bun-dependencies
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: "0 0 * * *"
6
+ jobs:
7
+ call-check-bun-dependencies:
8
+ uses: flowscripter/.github/.github/workflows/check-bun-dependencies.yml@v1
9
+ secrets: inherit
@@ -0,0 +1,11 @@
1
+ name: lint-pr-message
2
+ on:
3
+ pull_request_target:
4
+ types:
5
+ - opened
6
+ - edited
7
+ - synchronize
8
+ jobs:
9
+ call-lint-pr-message:
10
+ uses: flowscripter/.github/.github/workflows/lint-pr-message.yml@v1
11
+ secrets: inherit
@@ -0,0 +1,8 @@
1
+ name: release-bun-library
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ jobs:
6
+ call-release-bun-library:
7
+ uses: flowscripter/.github/.github/workflows/release-bun-library.yml@v1
8
+ secrets: inherit
@@ -0,0 +1,8 @@
1
+ name: validate-bun-library-pr
2
+ on:
3
+ pull_request:
4
+ branches: [main]
5
+ jobs:
6
+ call-validate-bun-library-pr:
7
+ uses: flowscripter/.github/.github/workflows/validate-bun-library-pr.yml@v1
8
+ secrets: inherit
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Flowscripter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # example-plugin
2
+
3
+ [![version](https://img.shields.io/github/v/release/flowscripter/example-plugin?sort=semver)](https://github.com/flowscripter/example-plugin/releases)
4
+ [![build](https://img.shields.io/github/actions/workflow/status/flowscripter/example-plugin/release-bun-library.yml)](https://github.com/flowscripter/example-plugin/actions/workflows/release-bun-library.yml)
5
+ [![coverage](https://codecov.io/gh/flowscripter/example-plugin/branch/main/graph/badge.svg?token=EMFT2938ZF)](https://codecov.io/gh/flowscripter/example-plugin)
6
+ [![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/example-plugin/index.html)
7
+ [![license: MIT](https://img.shields.io/github/license/flowscripter/example-plugin)](https://github.com/flowscripter/example-plugin/blob/main/LICENSE)
8
+
9
+ > Example plugin for the
10
+ > [dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)
11
+
12
+ ## Bun Module Usage
13
+
14
+ Add the module:
15
+
16
+ `bun add @flowscripter/example-plugin`
17
+
18
+ Use the module:
19
+
20
+ ```typescript
21
+ import { ExampleExtension } from "@flowscripter/example-plugin";
22
+
23
+ const extension = new ExampleExtension();
24
+
25
+ extension.sayHello();
26
+ ```
27
+
28
+ ## Development
29
+
30
+ Test:
31
+
32
+ `bun test`
33
+
34
+ **NOTE**: The following tasks use Deno as it excels at these and Bun does not
35
+ currently provide such functionality:
36
+
37
+ Format:
38
+
39
+ `deno fmt`
40
+
41
+ Lint:
42
+
43
+ `deno lint index.ts src/ tests/`
44
+
45
+ Generate HTML API Documentation:
46
+
47
+ `deno doc --html --name=example-plugin index.ts`
48
+
49
+ ## Documentation
50
+
51
+ ### Overview
52
+
53
+ Refer to the
54
+ [dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)
55
+ for an overview of what this example is demonstrating.
56
+
57
+ ### API
58
+
59
+ Link to auto-generated API docs for the library:
60
+
61
+ [API Documentation](https://flowscripter.github.io/example-plugin/index.html)
62
+
63
+ ## License
64
+
65
+ MIT © Flowscripter
package/bun.lock ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "name": "@flowscripter/example-plugin",
6
+ "dependencies": {
7
+ "@flowscripter/dynamic-plugin-framework": "^1.3.8",
8
+ "@flowscripter/example-plugin-api": "^1.0.0",
9
+ },
10
+ "devDependencies": {
11
+ "@types/bun": "^1.2.4",
12
+ },
13
+ "peerDependencies": {
14
+ "typescript": "^5.8.2",
15
+ },
16
+ },
17
+ },
18
+ "packages": {
19
+ "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@1.3.8", "", { "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-/XEYnDORtgazu/7lOcqhwbnwyyErzs3p3aMfzRXFDtJNi+uBwNdJDVw81huHOqaf+UDoUPFu3L6SwSZv6LXFMg=="],
20
+
21
+ "@flowscripter/example-plugin-api": ["@flowscripter/example-plugin-api@1.0.0", "", { "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-6IND3SxnkIKspmmRUQqe3lITS+tQNNa7gKEkROSu1G1FYae8Gi5AnLDUOx1+JwhcHha+607az+ciXZ35Q/gNtw=="],
22
+
23
+ "@types/bun": ["@types/bun@1.2.4", "", { "dependencies": { "bun-types": "1.2.4" } }, "sha512-QtuV5OMR8/rdKJs213iwXDpfVvnskPXY/S0ZiFbsTjQZycuqPbMW8Gf/XhLfwE5njW8sxI2WjISURXPlHypMFA=="],
24
+
25
+ "@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
26
+
27
+ "@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
28
+
29
+ "bun-types": ["bun-types@1.2.4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="],
30
+
31
+ "typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
32
+
33
+ "undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
34
+ }
35
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default, exampleExtension } from "./src/ExamplePlugin.ts";
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@flowscripter/example-plugin",
3
+ "module": "index.ts",
4
+ "type": "module",
5
+ "version": "1.0.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "devDependencies": {
10
+ "@types/bun": "^1.2.4"
11
+ },
12
+ "peerDependencies": {
13
+ "typescript": "^5.8.2"
14
+ },
15
+ "dependencies": {
16
+ "@flowscripter/dynamic-plugin-framework": "^1.3.8",
17
+ "@flowscripter/example-plugin-api": "^1.0.0"
18
+ }
19
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ EXTENSION_POINT_1,
3
+ type ExtensionPoint1,
4
+ } from "@flowscripter/example-plugin-api";
5
+ import type {
6
+ ExtensionDescriptor,
7
+ ExtensionFactory,
8
+ Plugin,
9
+ } from "@flowscripter/dynamic-plugin-framework";
10
+
11
+ export const exampleExtension: ExtensionPoint1 = {
12
+ sayHello: () => {
13
+ console.info("hello world");
14
+ },
15
+ };
16
+
17
+ const exampleExtensionFactory: ExtensionFactory = {
18
+ create: () => {
19
+ return Promise.resolve(exampleExtension);
20
+ },
21
+ };
22
+
23
+ const exampleExtensionDescriptor: ExtensionDescriptor = {
24
+ extensionPoint: EXTENSION_POINT_1,
25
+
26
+ factory: exampleExtensionFactory,
27
+
28
+ extensionData: new Map<string, string>([[
29
+ "extension_foo",
30
+ "extension_bar",
31
+ ]]),
32
+ };
33
+
34
+ const examplePlugin: Plugin = {
35
+ extensionDescriptors: [
36
+ exampleExtensionDescriptor,
37
+ ],
38
+
39
+ pluginData: new Map<string, string>([["plugin_foo", "plugin_bar"]]),
40
+ };
41
+
42
+ export default examplePlugin;
@@ -0,0 +1,26 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { default as examplePlugin, exampleExtension } from "../index.ts";
3
+ import type { ExtensionPoint1 } from "@flowscripter/example-plugin-api";
4
+
5
+ describe("ExamplePlugin Tests", () => {
6
+ test("Access extension implementation via plugin", async () => {
7
+ expect(examplePlugin.pluginData?.get("plugin_foo")).toEqual("plugin_bar");
8
+
9
+ const extensionDescriptor = examplePlugin.extensionDescriptors[0];
10
+
11
+ expect(
12
+ extensionDescriptor.extensionData?.get("extension_foo"),
13
+ ).toEqual(
14
+ "extension_bar",
15
+ );
16
+
17
+ const extension = await extensionDescriptor.factory
18
+ .create() as ExtensionPoint1;
19
+
20
+ extension.sayHello();
21
+ });
22
+
23
+ test("Access extension implementation directly", () => {
24
+ exampleExtension.sayHello();
25
+ });
26
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Enable latest features
4
+ "lib": ["ESNext", "DOM"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+
22
+ // Some stricter flags (disabled by default)
23
+ "noUnusedLocals": false,
24
+ "noUnusedParameters": false,
25
+ "noPropertyAccessFromIndexSignature": false
26
+ }
27
+ }