@fnet/cli 0.114.0 → 0.116.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/fnet/index.BZuqvTVt.js +1 -0
- package/dist/fnet/index.js +1 -1
- package/dist/fnode/index.B_0ZxySP.js +1 -0
- package/dist/fnode/{index.Cl6LPgIY.js → index.D3C-8oZW.js} +1 -1
- package/dist/fnode/index.D4sPJLOP.js +1 -0
- package/dist/fnode/index.DIZA_GzC.js +1 -0
- package/dist/fnode/{index.mC936qdY.js → index.DMkgR1Dh.js} +1 -1
- package/dist/fnode/index.js +1 -1
- package/dist/fnode/{index.qJ6fWMSj.js → index.uPDSav7E.js} +1 -1
- package/package.json +2 -1
- package/template/fnet/bun/src/cli/index.js.njk +1 -1
- package/template/fnet/node/package.json.njk +1 -0
- package/template/fnet/node/rollup.config.mjs.njk +144 -11
- package/template/fnet/node/src/cli/index.js.njk +322 -39
- package/template/fnode/bun/src/cli/index.js.njk +2 -2
- package/template/fnode/node/package.json.njk +10 -1
- package/template/fnode/node/rollup.config.mjs.njk +144 -11
- package/template/fnode/node/src/cli/index.js.njk +289 -46
- package/dist/fnet/index.PNP2oTpU.js +0 -1
- package/dist/fnode/index.6_yfJqit.js +0 -1
- package/dist/fnode/index.BlhtGEKB.js +0 -1
- package/dist/fnode/index.CLPC6OJN.js +0 -1
- package/template/fnet/bun/fnet/flows.yaml.njk +0 -1
- package/template/fnet/bun/fnet.yaml.njk +0 -1
- package/template/fnet/node/fnet/flows.yaml.njk +0 -1
- package/template/fnet/node/fnet.yaml.njk +0 -1
- package/template/fnet/node/rollup_config_external.njk +0 -8
- package/template/fnet/node/rollup_config_onwarn.njk +0 -9
- package/template/fnet/node/rollup_config_output_banner.njk +0 -3
- package/template/fnet/node/rollup_config_output_footer.njk +0 -5
- package/template/fnet/node/rollup_config_output_globals.njk +0 -9
- package/template/fnet/node/rollup_config_output_name.njk +0 -3
- package/template/fnet/node/rollup_config_plugins.njk +0 -90
- package/template/fnode/bun/fnode.yaml.njk +0 -1
- package/template/fnode/node/fnode.yaml.njk +0 -1
- package/template/fnode/node/rollup_config_external.njk +0 -8
- package/template/fnode/node/rollup_config_onwarn.njk +0 -9
- package/template/fnode/node/rollup_config_output_banner.njk +0 -3
- package/template/fnode/node/rollup_config_output_footer.njk +0 -5
- package/template/fnode/node/rollup_config_output_globals.njk +0 -9
- package/template/fnode/node/rollup_config_output_name.njk +0 -3
- package/template/fnode/node/rollup_config_plugins.njk +0 -90
- package/template/fnode/python/fnode.yaml.njk +0 -1
- /package/template/fnet/bun/src/default/{to.args.js.njk → input.args.js.njk} +0 -0
- /package/template/fnet/node/src/default/{to.args.js.njk → input.args.js.njk} +0 -0
- /package/template/fnet/project/.vscode/{launch.json → launch.json.njk} +0 -0
- /package/template/fnet/project/.vscode/{tasks.json → tasks.json.njk} +0 -0
- /package/template/fnode/bun/src/default/{to.args.js.njk → input.args.js.njk} +0 -0
- /package/template/fnode/node/src/default/{to.args.js.njk → input.args.js.njk} +0 -0
|
@@ -1,44 +1,327 @@
|
|
|
1
1
|
{% if atom.doc.features.cli.enabled===true %}
|
|
2
|
-
import argv from '../default/to.args.js';
|
|
3
|
-
import { default as Engine } from '../default/{{atom.doc.features.cli_default_entry_file or atom.doc.features.main_default_entry_file}}';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
{# Define macros for reusable code blocks #}
|
|
4
|
+
{% macro importMcpDependencies() %}
|
|
5
|
+
import { Server, ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
8
|
+
import express from "express";
|
|
9
|
+
{% endmacro %}
|
|
10
|
+
|
|
11
|
+
{% macro mcpModeCodeExtended(runFn) %}
|
|
12
|
+
if (cliMode === 'mcp') {
|
|
13
|
+
// MCP mode code
|
|
14
|
+
const server = new Server({
|
|
15
|
+
name: "{{atom.doc.features.cli.mcp.name or atom.doc.name}}",
|
|
16
|
+
version: "{{atom.doc.version or '0.0.1'}}"
|
|
17
|
+
}, {
|
|
18
|
+
capabilities: {
|
|
19
|
+
tools: {}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Define available tools
|
|
24
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
25
|
+
return {
|
|
26
|
+
tools: [{
|
|
27
|
+
name: "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}",
|
|
28
|
+
description: "{{atom.doc.features.cli.mcp.tool.description or atom.doc.description}}",
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {},
|
|
32
|
+
additionalProperties: true
|
|
33
|
+
}
|
|
34
|
+
}]
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Handle tool execution
|
|
39
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
40
|
+
if (request.params.name === "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}") {
|
|
41
|
+
try {
|
|
42
|
+
const result = await {{ runFn }}(request.params.arguments, { Engine });
|
|
43
|
+
return {
|
|
44
|
+
content: [{
|
|
45
|
+
type: "text",
|
|
46
|
+
text: JSON.stringify(result)
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return {
|
|
51
|
+
content: [{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: `Error: ${error.message}`
|
|
54
|
+
}],
|
|
55
|
+
isError: true
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw new Error("Tool not found");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Get transport type from arguments
|
|
63
|
+
const transportType = args['mcp-transport-type'] || args.mcp_transport_type || 'stdio';
|
|
64
|
+
let transport;
|
|
65
|
+
|
|
66
|
+
if (transportType === 'stdio') {
|
|
67
|
+
// Use stdio transport
|
|
68
|
+
transport = new StdioServerTransport();
|
|
69
|
+
console.log("MCP server started with stdio transport");
|
|
70
|
+
} else if (transportType === 'http') {
|
|
71
|
+
// Use HTTP transport
|
|
72
|
+
const app = express();
|
|
73
|
+
app.use(express.json());
|
|
74
|
+
|
|
75
|
+
const port = args['cli-port'] || args.cli_port || 3000;
|
|
76
|
+
const server = app.listen(port, () => {
|
|
77
|
+
console.log(`MCP server started with HTTP transport on port ${port}`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
transport = new StreamableHTTPServerTransport({
|
|
81
|
+
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
app.post('/mcp', async (req, res) => {
|
|
85
|
+
await transport.handleRequest(req, res, req.body);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
app.get('/mcp', async (req, res) => {
|
|
89
|
+
await transport.handleRequest(req, res);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
app.delete('/mcp', async (req, res) => {
|
|
93
|
+
await transport.handleRequest(req, res);
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
97
|
+
console.error(`Supported types: stdio, http`);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await server.connect(transport);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
{% endmacro %}
|
|
105
|
+
|
|
106
|
+
{% macro mcpModeCodeEngine(engineVar) %}
|
|
107
|
+
if (cliMode === 'mcp') {
|
|
108
|
+
// MCP mode code
|
|
109
|
+
const server = new Server({
|
|
110
|
+
name: "{{atom.doc.features.cli.mcp.name or atom.doc.name}}",
|
|
111
|
+
version: "{{atom.doc.version or '0.0.1'}}"
|
|
112
|
+
}, {
|
|
113
|
+
capabilities: {
|
|
114
|
+
tools: {}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Define available tools
|
|
119
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
120
|
+
return {
|
|
121
|
+
tools: [{
|
|
122
|
+
name: "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}",
|
|
123
|
+
description: "{{atom.doc.features.cli.mcp.tool.description or atom.doc.description}}",
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: "object",
|
|
126
|
+
properties: {},
|
|
127
|
+
additionalProperties: true
|
|
128
|
+
}
|
|
129
|
+
}]
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Handle tool execution
|
|
134
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
135
|
+
if (request.params.name === "{{atom.doc.features.cli.mcp.tool.name or atom.doc.name}}") {
|
|
136
|
+
try {
|
|
137
|
+
const result = await {{ engineVar }}.run(request.params.arguments);
|
|
138
|
+
return {
|
|
139
|
+
content: [{
|
|
140
|
+
type: "text",
|
|
141
|
+
text: JSON.stringify(result)
|
|
142
|
+
}]
|
|
143
|
+
};
|
|
144
|
+
} catch (error) {
|
|
145
|
+
return {
|
|
146
|
+
content: [{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: `Error: ${error.message}`
|
|
149
|
+
}],
|
|
150
|
+
isError: true
|
|
151
|
+
};
|
|
36
152
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
153
|
+
}
|
|
154
|
+
throw new Error("Tool not found");
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Note: Direct access to workflow nodes is not implemented in this version
|
|
158
|
+
// In a future version, we could expose workflow nodes as separate MCP tools
|
|
159
|
+
|
|
160
|
+
// Get transport type from arguments
|
|
161
|
+
const transportType = args['mcp-transport-type'] || args.mcp_transport_type || 'stdio';
|
|
162
|
+
let transport;
|
|
163
|
+
|
|
164
|
+
if (transportType === 'stdio') {
|
|
165
|
+
// Use stdio transport
|
|
166
|
+
transport = new StdioServerTransport();
|
|
167
|
+
console.log("MCP server started with stdio transport");
|
|
168
|
+
} else if (transportType === 'http') {
|
|
169
|
+
// Use HTTP transport
|
|
170
|
+
const app = express();
|
|
171
|
+
app.use(express.json());
|
|
172
|
+
|
|
173
|
+
const port = args['cli-port'] || args.cli_port || 3000;
|
|
174
|
+
const server = app.listen(port, () => {
|
|
175
|
+
console.log(`MCP server started with HTTP transport on port ${port}`);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
transport = new StreamableHTTPServerTransport({
|
|
179
|
+
sessionIdGenerator: () => Math.random().toString(36).substring(2, 15),
|
|
42
180
|
});
|
|
43
|
-
|
|
181
|
+
|
|
182
|
+
app.post('/mcp', async (req, res) => {
|
|
183
|
+
await transport.handleRequest(req, res, req.body);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
app.get('/mcp', async (req, res) => {
|
|
187
|
+
await transport.handleRequest(req, res);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
app.delete('/mcp', async (req, res) => {
|
|
191
|
+
await transport.handleRequest(req, res);
|
|
192
|
+
});
|
|
193
|
+
} else {
|
|
194
|
+
console.error(`Unknown MCP transport type: ${transportType}`);
|
|
195
|
+
console.error(`Supported types: stdio, http`);
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
await server.connect(transport);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
{% endmacro %}
|
|
203
|
+
|
|
204
|
+
{% macro httpModeCodeExpress(runFn, engineParam) %}
|
|
205
|
+
if (cliMode === 'http') {
|
|
206
|
+
// HTTP mode code using Express
|
|
207
|
+
const app = express();
|
|
208
|
+
app.use(express.json());
|
|
209
|
+
|
|
210
|
+
app.post('/{{atom.doc.features.cli.http.path or atom.doc.name}}', async (req, res) => {
|
|
211
|
+
try {
|
|
212
|
+
const result = await {{ runFn }}(req.body{{ engineParam }});
|
|
213
|
+
res.json(result);
|
|
214
|
+
} catch (error) {
|
|
215
|
+
res.status(500).json({ error: error.message });
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const port = args['cli-port'] || args.cli_port || 3000;
|
|
220
|
+
app.listen(port, () => {
|
|
221
|
+
console.log(`HTTP server started on port ${port}`);
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
{% endmacro %}
|
|
226
|
+
|
|
227
|
+
{% macro defaultModeExtended() %}
|
|
228
|
+
if (cliMode === 'default') {
|
|
229
|
+
// Default mode code
|
|
230
|
+
return await runExtended(args, { Engine });
|
|
231
|
+
}
|
|
232
|
+
{% endmacro %}
|
|
233
|
+
|
|
234
|
+
{% macro defaultModeEngine(engineVar) %}
|
|
235
|
+
if (cliMode === 'default') {
|
|
236
|
+
// Default mode code
|
|
237
|
+
const result = await {{ engineVar }}.run(args);
|
|
238
|
+
|
|
239
|
+
if (typeof result !== 'undefined') {
|
|
240
|
+
const stdout_format = args['stdout-format'] || args.stdout_format || null;
|
|
241
|
+
|
|
242
|
+
if (stdout_format === 'json') console.log(JSON.stringify(result, null, 2));
|
|
243
|
+
else console.log(result);
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
{% endmacro %}
|
|
248
|
+
|
|
249
|
+
{% macro runWithCatch() %}
|
|
250
|
+
run()
|
|
251
|
+
.catch((error) => {
|
|
252
|
+
console.error(error.message);
|
|
253
|
+
process.exit(1);
|
|
254
|
+
});
|
|
255
|
+
{% endmacro %}
|
|
256
|
+
|
|
257
|
+
{% macro runWithThenCatch() %}
|
|
258
|
+
run()
|
|
259
|
+
.then(() => {
|
|
260
|
+
{# process.exit(0); #}
|
|
261
|
+
})
|
|
262
|
+
.catch((error) => {
|
|
263
|
+
console.error(error.message);
|
|
264
|
+
process.exit(1);
|
|
265
|
+
});
|
|
266
|
+
{% endmacro %}
|
|
267
|
+
|
|
268
|
+
{# Main template starts here #}
|
|
269
|
+
import argv from '../default/input.args.js';
|
|
270
|
+
import { default as Engine } from '../default/{{atom.doc.features.cli_default_entry_file or atom.doc.features.main_default_entry_file}}';
|
|
271
|
+
|
|
272
|
+
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
273
|
+
{{ importMcpDependencies() }}
|
|
274
|
+
{% endif %}
|
|
275
|
+
|
|
276
|
+
{% if atom.doc.features.cli.http.enabled===true %}
|
|
277
|
+
// Using express for HTTP mode
|
|
278
|
+
import express from 'express';
|
|
279
|
+
{% endif %}
|
|
280
|
+
|
|
281
|
+
{% if atom.doc.features.cli.extend===true %}
|
|
282
|
+
{# TYPE 1 #}
|
|
283
|
+
import { default as runExtended } from '../../../cli';
|
|
284
|
+
|
|
285
|
+
const run = async () => {
|
|
286
|
+
const args = await argv();
|
|
287
|
+
const cliMode = args['cli-mode'] || args.cli_mode || 'default';
|
|
288
|
+
|
|
289
|
+
{{ defaultModeExtended() }}
|
|
290
|
+
|
|
291
|
+
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
292
|
+
{{ mcpModeCodeExtended('runExtended') }}
|
|
293
|
+
{% endif %}
|
|
294
|
+
|
|
295
|
+
{% if atom.doc.features.cli.http.enabled===true %}
|
|
296
|
+
{{ httpModeCodeExpress('runExtended', ', { Engine }') }}
|
|
297
|
+
{% endif %}
|
|
298
|
+
|
|
299
|
+
console.error(`Unknown CLI mode: ${cliMode}`);
|
|
300
|
+
process.exit(1);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
{{ runWithThenCatch() }}
|
|
304
|
+
{% else %}
|
|
305
|
+
{# TYPE 2 #}
|
|
306
|
+
const run = async () => {
|
|
307
|
+
const args = await argv();
|
|
308
|
+
const cliMode = args['cli-mode'] || args.cli_mode || 'default';
|
|
309
|
+
const engine = new Engine();
|
|
310
|
+
|
|
311
|
+
{{ defaultModeEngine('engine') }}
|
|
312
|
+
|
|
313
|
+
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
314
|
+
{{ mcpModeCodeEngine('engine') }}
|
|
315
|
+
{% endif %}
|
|
316
|
+
|
|
317
|
+
{% if atom.doc.features.cli.http.enabled===true %}
|
|
318
|
+
{{ httpModeCodeExpress('engine.run', '') }}
|
|
319
|
+
{% endif %}
|
|
320
|
+
|
|
321
|
+
console.error(`Unknown CLI mode: ${cliMode}`);
|
|
322
|
+
process.exit(1);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
{{ runWithCatch() }}
|
|
326
|
+
{% endif %}
|
|
44
327
|
{% endif %}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
{% if atom.doc.features.project.format==='esm' %}
|
|
4
4
|
|
|
5
|
-
import argv from '../default/
|
|
5
|
+
import argv from '../default/input.args.js';
|
|
6
6
|
|
|
7
7
|
{% if atom.doc.features.cli.extend===true %}
|
|
8
8
|
|
|
@@ -40,7 +40,7 @@ run()
|
|
|
40
40
|
|
|
41
41
|
{% elif atom.doc.features.project.format==='cjs' %}
|
|
42
42
|
|
|
43
|
-
const argv = require('../default/
|
|
43
|
+
const argv = require('../default/input.args.js');
|
|
44
44
|
|
|
45
45
|
{% if atom.doc.features.cli.extend===true %}
|
|
46
46
|
|
|
@@ -54,13 +54,22 @@
|
|
|
54
54
|
"license": "{{atom.doc.license or 'MIT'}}",
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "rollup --config",
|
|
57
|
+
"build:dev": "rollup --config --sourcemap --environment DEVELOPMENT",
|
|
57
58
|
"watch": "rollup --config --watch --sourcemap --environment DEVELOPMENT",
|
|
58
59
|
"serve": "bunx serve ./"
|
|
59
60
|
{% if atom.doc.features.cli.enabled %}
|
|
60
61
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
61
|
-
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
|
|
62
|
+
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs",
|
|
63
|
+
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
64
|
+
,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
65
|
+
,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
66
|
+
{% endif %}
|
|
62
67
|
{% else %}
|
|
63
68
|
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/"
|
|
69
|
+
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
70
|
+
,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/ --cli-mode=mcp"
|
|
71
|
+
,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/ --cli-mode=mcp"
|
|
72
|
+
{% endif %}
|
|
64
73
|
{% endif %}
|
|
65
74
|
,"compile": "fbin compile {{atom.doc.features.cli.dir}}/index.js -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
66
75
|
,"install-bin": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
@@ -182,9 +182,9 @@ const initPlugins = async (options) => {
|
|
|
182
182
|
{% if atom.doc.features.project.format ==='esm' %}
|
|
183
183
|
include: /node_modules/,
|
|
184
184
|
ignore: ["fsevents"],
|
|
185
|
-
{% endif %}
|
|
185
|
+
{% endif %}
|
|
186
186
|
}));
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
|
|
189
189
|
{# POLYFILL #}
|
|
190
190
|
{% if atom.doc.features.polyfill_enabled===true %}
|
|
@@ -193,7 +193,7 @@ const initPlugins = async (options) => {
|
|
|
193
193
|
plugins.push(polyfills(options.polyfill.options));
|
|
194
194
|
}
|
|
195
195
|
{% endif %}
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
{# WORKBOX #}
|
|
198
198
|
{% if atom.doc.features.workbox_enabled===true %}
|
|
199
199
|
if (options?.workbox) {
|
|
@@ -291,7 +291,7 @@ const createConfigs = async () => {
|
|
|
291
291
|
if (!fs.existsSync(groupDir)) {
|
|
292
292
|
fs.mkdirSync(groupDir, { recursive: true });
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
{% for key, value in atom.doc.features.rollup_output %}
|
|
296
296
|
{% if value and value.enabled !== false %}
|
|
297
297
|
{
|
|
@@ -310,17 +310,150 @@ const createConfigs = async () => {
|
|
|
310
310
|
entryFileNames: "[name].cjs",
|
|
311
311
|
chunkFileNames: "[name]-[hash].cjs",
|
|
312
312
|
{% endif %}
|
|
313
|
-
{
|
|
314
|
-
{%
|
|
315
|
-
{
|
|
316
|
-
{%
|
|
313
|
+
{# BEGIN: rollup_config_output_name #}
|
|
314
|
+
{% if value.format==='iife' or value.format==='umd'%}
|
|
315
|
+
name: "{{atom.doc.bundleName}}",
|
|
316
|
+
{% endif %}
|
|
317
|
+
{# END: rollup_config_output_name #}
|
|
318
|
+
{# BEGIN: rollup_config_output_globals #}
|
|
319
|
+
{% if value.browser===true %}
|
|
320
|
+
{% if value.globals.length %}
|
|
321
|
+
globals: {
|
|
322
|
+
{% for global in value.globals %}
|
|
323
|
+
"{{global.key}}":"{{global.value}}" {% if not loop.last %},{% endif %}
|
|
324
|
+
{% endfor %}
|
|
325
|
+
},
|
|
326
|
+
{% endif %}
|
|
327
|
+
{% endif %}
|
|
328
|
+
{# END: rollup_config_output_globals #}
|
|
329
|
+
{# BEGIN: rollup_config_output_banner #}
|
|
330
|
+
{% if value.banner %}
|
|
331
|
+
banner:'{{value.banner}}',
|
|
332
|
+
{% endif %}
|
|
333
|
+
{# END: rollup_config_output_banner #}
|
|
334
|
+
{# BEGIN: rollup_config_output_footer #}
|
|
335
|
+
{% if value.format==='iife' %}
|
|
336
|
+
{% if atom.type==='workflow'%}
|
|
337
|
+
{# footer: "new {{atom.doc.bundleName}}().run().catch(e=>{});" #}
|
|
338
|
+
{% endif %}
|
|
339
|
+
{% endif %}
|
|
340
|
+
{# END: rollup_config_output_footer #}
|
|
317
341
|
},
|
|
318
342
|
{% if value.context %}
|
|
319
343
|
context: "{{value.context}}",
|
|
320
344
|
{% endif %}
|
|
321
|
-
{
|
|
322
|
-
{%
|
|
323
|
-
|
|
345
|
+
{# BEGIN: rollup_config_external #}
|
|
346
|
+
{% if value.external_enabled %}
|
|
347
|
+
external: [
|
|
348
|
+
{% for external in value.external %}
|
|
349
|
+
"{{external}}" {% if not loop.last %},{% endif %}
|
|
350
|
+
{% endfor %}
|
|
351
|
+
],
|
|
352
|
+
{% endif %}
|
|
353
|
+
{# END: rollup_config_external #}
|
|
354
|
+
{# BEGIN: rollup_config_onwarn #}
|
|
355
|
+
onwarn(warning, warn) {
|
|
356
|
+
switch (warning.code) {
|
|
357
|
+
case 'MODULE_LEVEL_DIRECTIVE':
|
|
358
|
+
case 'CIRCULAR_DEPENDENCY':
|
|
359
|
+
return;
|
|
360
|
+
default:
|
|
361
|
+
warn(warning);
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{# END: rollup_config_onwarn #}
|
|
365
|
+
{# BEGIN: rollup_config_plugins #}
|
|
366
|
+
plugins: await initPlugins({
|
|
367
|
+
delete:{ targets: [path.normalize(groupDir + '{{key}}')], runOnce: DEVELOPMENT },
|
|
368
|
+
|
|
369
|
+
format:"{{ value.format }}",
|
|
370
|
+
|
|
371
|
+
{% if value.babel===true %}
|
|
372
|
+
babel:{{value.babel_options | dump | safe}},
|
|
373
|
+
{% endif %}
|
|
374
|
+
|
|
375
|
+
{% if value.replace ===true %}
|
|
376
|
+
replace:{{value.replace_options | dump | safe}},
|
|
377
|
+
{% endif %}
|
|
378
|
+
|
|
379
|
+
{% if value.browser===true %}
|
|
380
|
+
browser:true,
|
|
381
|
+
{% endif %}
|
|
382
|
+
|
|
383
|
+
{% if value.browsersync===true and atom.doc.features.browsersync_enabled===true%}
|
|
384
|
+
browsersync: {{value.browsersync_options | dump | safe}},
|
|
385
|
+
{% endif %}
|
|
386
|
+
|
|
387
|
+
{% if value.alias_enabled===true %}
|
|
388
|
+
alias:{{value.alias | dump | safe}},
|
|
389
|
+
{% endif %}
|
|
390
|
+
|
|
391
|
+
{# OK #}
|
|
392
|
+
{% if value.css %}
|
|
393
|
+
postcss:{{value.css | dump | safe}},
|
|
394
|
+
{% endif %}
|
|
395
|
+
|
|
396
|
+
{# OK #}
|
|
397
|
+
{% if value.copy %}
|
|
398
|
+
copy:{{value.copy | dump | safe}},
|
|
399
|
+
{% endif %}
|
|
400
|
+
|
|
401
|
+
{# OK #}
|
|
402
|
+
{% if value.terser%}
|
|
403
|
+
terser:{{value.terser | dump | safe}},
|
|
404
|
+
{% endif %}
|
|
405
|
+
|
|
406
|
+
{# OK #}
|
|
407
|
+
{% if value.json %}
|
|
408
|
+
json:{{value.json | dump | safe}},
|
|
409
|
+
{% endif %}
|
|
410
|
+
|
|
411
|
+
{# OK #}
|
|
412
|
+
{% if value.wasm %}
|
|
413
|
+
wasm: {{value.wasm | dump | safe}},
|
|
414
|
+
{% endif %}
|
|
415
|
+
|
|
416
|
+
{# OK #}
|
|
417
|
+
{% if value.string %}
|
|
418
|
+
string:{{value.string | dump | safe}},
|
|
419
|
+
{% endif %}
|
|
420
|
+
|
|
421
|
+
{# OK #}
|
|
422
|
+
{% if value.image %}
|
|
423
|
+
image:{{value.image | dump | safe}},
|
|
424
|
+
{% endif %}
|
|
425
|
+
|
|
426
|
+
{# OK #}
|
|
427
|
+
{% if value.analyzer %}
|
|
428
|
+
analyzer:{{value.analyzer | dump | safe}},
|
|
429
|
+
{% endif %}
|
|
430
|
+
|
|
431
|
+
{# OK #}
|
|
432
|
+
{% if value.visualizer %}
|
|
433
|
+
visualizer:{{value.visualizer | dump | safe}},
|
|
434
|
+
{% endif %}
|
|
435
|
+
|
|
436
|
+
{# OK #}
|
|
437
|
+
{% if value.polyfill %}
|
|
438
|
+
polyfill:{{value.polyfill | dump | safe}},
|
|
439
|
+
{% endif %}
|
|
440
|
+
|
|
441
|
+
{# OK #}
|
|
442
|
+
{% if value.nunjucks %}
|
|
443
|
+
nunjucks:{{value.nunjucks | dump | safe}},
|
|
444
|
+
{% endif %}
|
|
445
|
+
|
|
446
|
+
{# OK #}
|
|
447
|
+
{% if value.workbox %}
|
|
448
|
+
workbox:{{value.workbox | dump | safe}},
|
|
449
|
+
{% endif %}
|
|
450
|
+
|
|
451
|
+
{# OK #}
|
|
452
|
+
{% if value.gzip %}
|
|
453
|
+
gzip:{{value.gzip | dump | safe}},
|
|
454
|
+
{% endif %}
|
|
455
|
+
}),
|
|
456
|
+
{# END: rollup_config_plugins #}
|
|
324
457
|
}
|
|
325
458
|
configs.push(config);
|
|
326
459
|
}
|