testblocks 0.3.0 → 0.5.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/dist/cli/index.js +1 -1
- package/dist/client/assets/{index-RpGJFDVQ.js → index-Cq84-VIf.js} +158 -158
- package/dist/client/assets/{index-RpGJFDVQ.js.map → index-Cq84-VIf.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/plugins.js +15 -3
- package/dist/server/startServer.js +2 -2
- package/package.json +3 -2
package/dist/client/index.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
}
|
|
18
18
|
</style>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-Cq84-VIf.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-Dnk1ti7l.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
package/dist/server/index.js
CHANGED
|
@@ -35,14 +35,14 @@ app.use(express_1.default.json({ limit: '10mb' }));
|
|
|
35
35
|
app.get('/api/health', (req, res) => {
|
|
36
36
|
res.json({ status: 'ok', version: '1.0.0' });
|
|
37
37
|
});
|
|
38
|
-
// List available plugins
|
|
38
|
+
// List available plugins (with full block definitions for client registration)
|
|
39
39
|
app.get('/api/plugins', (req, res) => {
|
|
40
40
|
const available = (0, plugins_1.discoverPlugins)();
|
|
41
41
|
const loaded = (0, plugins_1.getServerPlugins)().map(p => ({
|
|
42
42
|
name: p.name,
|
|
43
43
|
version: p.version,
|
|
44
44
|
description: p.description,
|
|
45
|
-
|
|
45
|
+
blocks: p.blocks, // Include full block definitions
|
|
46
46
|
}));
|
|
47
47
|
res.json({
|
|
48
48
|
directory: (0, plugins_1.getPluginsDirectory)(),
|
package/dist/server/plugins.js
CHANGED
|
@@ -54,7 +54,12 @@ exports.getServerPlugins = getServerPlugins;
|
|
|
54
54
|
exports.isPluginLoaded = isPluginLoaded;
|
|
55
55
|
const fs = __importStar(require("fs"));
|
|
56
56
|
const path = __importStar(require("path"));
|
|
57
|
+
const jiti_1 = require("jiti");
|
|
57
58
|
const core_1 = require("../core");
|
|
59
|
+
// Create jiti instance for loading TypeScript plugins at runtime
|
|
60
|
+
const jiti = (0, jiti_1.createJiti)(__filename, {
|
|
61
|
+
interopDefault: true,
|
|
62
|
+
});
|
|
58
63
|
// Track initialization
|
|
59
64
|
let pluginsInitialized = false;
|
|
60
65
|
// List of registered plugins
|
|
@@ -135,12 +140,13 @@ async function loadPlugin(pluginName) {
|
|
|
135
140
|
const jsPath = path.join(pluginsDirectory, `${pluginName}.js`);
|
|
136
141
|
const tsPath = path.join(pluginsDirectory, `${pluginName}.ts`);
|
|
137
142
|
let pluginPath = null;
|
|
143
|
+
let isTypeScript = false;
|
|
138
144
|
if (fs.existsSync(jsPath)) {
|
|
139
145
|
pluginPath = jsPath;
|
|
140
146
|
}
|
|
141
147
|
else if (fs.existsSync(tsPath)) {
|
|
142
|
-
// For TypeScript files, require ts-node or esbuild-register
|
|
143
148
|
pluginPath = tsPath;
|
|
149
|
+
isTypeScript = true;
|
|
144
150
|
}
|
|
145
151
|
if (!pluginPath) {
|
|
146
152
|
console.error(`Plugin not found: ${pluginName} (looked in ${pluginsDirectory})`);
|
|
@@ -148,8 +154,14 @@ async function loadPlugin(pluginName) {
|
|
|
148
154
|
}
|
|
149
155
|
try {
|
|
150
156
|
console.log(`Loading plugin: ${pluginName} from ${pluginPath}`);
|
|
151
|
-
//
|
|
152
|
-
|
|
157
|
+
// Use jiti for TypeScript files, dynamic import for JavaScript
|
|
158
|
+
let module;
|
|
159
|
+
if (isTypeScript) {
|
|
160
|
+
module = jiti(pluginPath);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
module = await Promise.resolve(`${pluginPath}`).then(s => __importStar(require(s)));
|
|
164
|
+
}
|
|
153
165
|
// Look for default export or named export matching plugin name
|
|
154
166
|
const plugin = module.default ||
|
|
155
167
|
module[pluginName.replace(/-./g, x => x[1].toUpperCase()) + 'Plugin'] ||
|
|
@@ -75,14 +75,14 @@ async function startServer(options = {}) {
|
|
|
75
75
|
app.get('/api/health', (_req, res) => {
|
|
76
76
|
res.json({ status: 'ok', version: '1.0.0' });
|
|
77
77
|
});
|
|
78
|
-
// List available plugins
|
|
78
|
+
// List available plugins (with full block definitions for client registration)
|
|
79
79
|
app.get('/api/plugins', (_req, res) => {
|
|
80
80
|
const available = (0, plugins_1.discoverPlugins)();
|
|
81
81
|
const loaded = (0, plugins_1.getServerPlugins)().map(p => ({
|
|
82
82
|
name: p.name,
|
|
83
83
|
version: p.version,
|
|
84
84
|
description: p.description,
|
|
85
|
-
|
|
85
|
+
blocks: p.blocks, // Include full block definitions
|
|
86
86
|
}));
|
|
87
87
|
res.json({
|
|
88
88
|
directory: (0, plugins_1.getPluginsDirectory)(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testblocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Visual test automation tool with Blockly - API and Playwright testing",
|
|
5
5
|
"author": "Roy de Kleijn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"cors": "^2.8.5",
|
|
71
71
|
"express": "^4.21.2",
|
|
72
72
|
"glob": "^11.0.0",
|
|
73
|
+
"jiti": "^2.6.1",
|
|
73
74
|
"jsonpath-plus": "^10.3.0",
|
|
74
75
|
"otpauth": "^9.4.1",
|
|
75
76
|
"playwright": "^1.49.1",
|
|
@@ -79,7 +80,6 @@
|
|
|
79
80
|
"xpath": "^0.0.34"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@vitest/coverage-v8": "^2.1.8",
|
|
83
83
|
"@eslint/js": "^9.39.2",
|
|
84
84
|
"@types/cors": "^2.8.17",
|
|
85
85
|
"@types/express": "^5.0.0",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
91
91
|
"@typescript-eslint/parser": "^8.51.0",
|
|
92
92
|
"@vitejs/plugin-react": "^4.3.4",
|
|
93
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
93
94
|
"concurrently": "^8.2.2",
|
|
94
95
|
"eslint": "^9.39.2",
|
|
95
96
|
"eslint-plugin-react": "^7.37.5",
|