@fnet/cli 0.111.0 → 0.111.2

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.
Files changed (154) hide show
  1. package/dist/fnet/index.DBSKvJyG.js +1 -0
  2. package/dist/fnet/index.DrwlOzAe.js +1 -0
  3. package/dist/fnet/index.js +1 -1
  4. package/dist/fnode/index.53yND1Av.js +1 -0
  5. package/dist/fnode/index.B1zLg4Y2.js +1 -0
  6. package/dist/fnode/index.B2LXSSn7.js +1 -0
  7. package/dist/fnode/index.BBrItYB9.js +1 -0
  8. package/dist/fnode/index.BSQp_bJN.js +1 -0
  9. package/dist/fnode/index.Bqzc7Bx8.js +1 -0
  10. package/dist/fnode/index.BwhWziH6.js +1 -0
  11. package/dist/fnode/index.CLlKzCGk.js +1 -0
  12. package/dist/fnode/index.Chvv_TJm.js +1 -0
  13. package/dist/fnode/index.D4KQB1ot.js +1 -0
  14. package/dist/fnode/index.DItyYiZ_.js +1 -0
  15. package/dist/fnode/index.DrwlOzAe.js +1 -0
  16. package/dist/fnode/index.js +1 -1
  17. package/dist/frun/index.js +126 -0
  18. package/package.json +8 -9
  19. package/readme.md +117 -25
  20. package/template/fnet/bun/fnet/flows.yaml.njk +1 -0
  21. package/template/fnet/bun/fnet.yaml.njk +1 -0
  22. package/template/fnet/bun/src/app/index.html.njk +67 -0
  23. package/template/fnet/bun/src/app/index.js.njk +36 -0
  24. package/template/fnet/bun/src/cli/index.js.njk +44 -0
  25. package/template/fnet/bun/src/default/blocks/assign.js.njk +40 -0
  26. package/template/fnet/bun/src/default/blocks/call.js.njk +92 -0
  27. package/template/fnet/bun/src/default/blocks/for.js.njk +81 -0
  28. package/template/fnet/bun/src/default/blocks/form.js.njk +65 -0
  29. package/template/fnet/bun/src/default/blocks/jump.js.njk +31 -0
  30. package/template/fnet/bun/src/default/blocks/modules.js.njk +50 -0
  31. package/template/fnet/bun/src/default/blocks/operation.js.njk +24 -0
  32. package/template/fnet/bun/src/default/blocks/raise.js.njk +25 -0
  33. package/template/fnet/bun/src/default/blocks/return.js.njk +27 -0
  34. package/template/fnet/bun/src/default/blocks/steps.js.njk +56 -0
  35. package/template/fnet/bun/src/default/blocks/switch.js.njk +73 -0
  36. package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +65 -0
  37. package/template/fnet/bun/src/default/engine.js.njk +79 -0
  38. package/template/fnet/bun/src/default/macros/block-body-header.js.njk +7 -0
  39. package/template/fnet/bun/src/default/macros/block-footer.js.njk +3 -0
  40. package/template/fnet/bun/src/default/macros/block-header.js.njk +14 -0
  41. package/template/fnet/bun/src/default/macros/block-library-header.js.njk +19 -0
  42. package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +8 -0
  43. package/template/fnet/bun/src/default/macros/block-modules.js.njk +29 -0
  44. package/template/fnet/bun/src/default/macros/block-next-header.js.njk +6 -0
  45. package/template/fnet/bun/src/default/macros/block-next.js.njk +20 -0
  46. package/template/fnet/bun/src/default/macros/block-run-form.js.njk +32 -0
  47. package/template/fnet/bun/src/default/macros/block-run-header.js.njk +39 -0
  48. package/template/fnet/bun/src/default/macros/page.js.njk +8 -0
  49. package/template/fnet/bun/src/default/macros/workflow-header.js.njk +7 -0
  50. package/template/fnet/bun/src/default/to.args.js.njk +120 -0
  51. package/template/fnet/bun/src/default/workflow.js.njk +117 -0
  52. package/template/fnet/core/assert.js +6 -0
  53. package/template/fnet/core/message.js +3 -0
  54. package/template/fnet/core/object.js +43 -0
  55. package/template/fnet/core/print.js +1 -0
  56. package/template/fnet/core/sleep.js +5 -0
  57. package/template/fnet/node/.gitignore.njk +8 -0
  58. package/template/fnet/node/fnet/flows.yaml.njk +1 -0
  59. package/template/fnet/node/fnet.yaml.njk +1 -0
  60. package/template/fnet/node/package.json.njk +90 -0
  61. package/template/fnet/node/readme.md.njk +21 -0
  62. package/template/fnet/node/rollup.config.mjs.njk +363 -0
  63. package/template/fnet/node/rollup_config_external.njk +8 -0
  64. package/template/fnet/node/rollup_config_onwarn.njk +9 -0
  65. package/template/fnet/node/rollup_config_output_banner.njk +3 -0
  66. package/template/fnet/node/rollup_config_output_footer.njk +5 -0
  67. package/template/fnet/node/rollup_config_output_globals.njk +9 -0
  68. package/template/fnet/node/rollup_config_output_name.njk +3 -0
  69. package/template/fnet/node/rollup_config_plugins.njk +90 -0
  70. package/template/fnet/node/src/app/index.html.njk +67 -0
  71. package/template/fnet/node/src/app/index.js.njk +36 -0
  72. package/template/fnet/node/src/cli/index.js.njk +44 -0
  73. package/template/fnet/node/src/default/blocks/assign.js.njk +40 -0
  74. package/template/fnet/node/src/default/blocks/call.js.njk +92 -0
  75. package/template/fnet/node/src/default/blocks/for.js.njk +81 -0
  76. package/template/fnet/node/src/default/blocks/form.js.njk +65 -0
  77. package/template/fnet/node/src/default/blocks/jump.js.njk +31 -0
  78. package/template/fnet/node/src/default/blocks/modules.js.njk +50 -0
  79. package/template/fnet/node/src/default/blocks/operation.js.njk +24 -0
  80. package/template/fnet/node/src/default/blocks/raise.js.njk +25 -0
  81. package/template/fnet/node/src/default/blocks/return.js.njk +27 -0
  82. package/template/fnet/node/src/default/blocks/steps.js.njk +56 -0
  83. package/template/fnet/node/src/default/blocks/switch.js.njk +73 -0
  84. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +65 -0
  85. package/template/fnet/node/src/default/engine.js.njk +79 -0
  86. package/template/fnet/node/src/default/macros/block-body-header.js.njk +7 -0
  87. package/template/fnet/node/src/default/macros/block-footer.js.njk +3 -0
  88. package/template/fnet/node/src/default/macros/block-header.js.njk +14 -0
  89. package/template/fnet/node/src/default/macros/block-library-header.js.njk +19 -0
  90. package/template/fnet/node/src/default/macros/block-modules-header.js.njk +8 -0
  91. package/template/fnet/node/src/default/macros/block-modules.js.njk +29 -0
  92. package/template/fnet/node/src/default/macros/block-next-header.js.njk +6 -0
  93. package/template/fnet/node/src/default/macros/block-next.js.njk +20 -0
  94. package/template/fnet/node/src/default/macros/block-run-form.js.njk +32 -0
  95. package/template/fnet/node/src/default/macros/block-run-header.js.njk +39 -0
  96. package/template/fnet/node/src/default/macros/page.js.njk +8 -0
  97. package/template/fnet/node/src/default/macros/workflow-header.js.njk +7 -0
  98. package/template/fnet/node/src/default/to.args.js.njk +120 -0
  99. package/template/fnet/node/src/default/workflow.js.njk +117 -0
  100. package/template/fnet/node/tsconfig.json.njk +16 -0
  101. package/template/fnet/project/.gitignore.njk +7 -0
  102. package/template/fnet/project/.vscode/launch.json +41 -0
  103. package/template/fnet/project/.vscode/tasks.json +46 -0
  104. package/template/fnet/project/fnet/flows.yaml.njk +4 -0
  105. package/template/fnet/project/fnet/targets.yaml.njk +7 -0
  106. package/template/fnet/project/fnet.yaml.njk +3 -0
  107. package/template/fnode/bun/.gitignore.njk +8 -0
  108. package/template/fnode/bun/build.js.njk +156 -0
  109. package/template/fnode/bun/fnode.yaml.njk +1 -0
  110. package/template/fnode/bun/package.json.njk +89 -0
  111. package/template/fnode/bun/readme.md.njk +21 -0
  112. package/template/fnode/bun/src/app/index-js-with-react-host.njk +50 -0
  113. package/template/fnode/bun/src/app/index-js-without-react-host.njk +23 -0
  114. package/template/fnode/bun/src/app/index.html.njk +67 -0
  115. package/template/fnode/bun/src/app/index.js.njk +9 -0
  116. package/template/fnode/bun/src/cli/index.js.njk +81 -0
  117. package/template/fnode/bun/src/default/engine.js.njk +17 -0
  118. package/template/fnode/bun/src/default/to.args.js.njk +120 -0
  119. package/template/fnode/bun/tsconfig.json.njk +16 -0
  120. package/template/fnode/node/.gitignore.njk +8 -0
  121. package/template/fnode/node/fnode.yaml.njk +1 -0
  122. package/template/fnode/node/package.json.njk +90 -0
  123. package/template/fnode/node/readme.md.njk +21 -0
  124. package/template/fnode/node/rollup.config.mjs.njk +363 -0
  125. package/template/fnode/node/rollup_config_external.njk +8 -0
  126. package/template/fnode/node/rollup_config_onwarn.njk +9 -0
  127. package/template/fnode/node/rollup_config_output_banner.njk +3 -0
  128. package/template/fnode/node/rollup_config_output_footer.njk +5 -0
  129. package/template/fnode/node/rollup_config_output_globals.njk +9 -0
  130. package/template/fnode/node/rollup_config_output_name.njk +3 -0
  131. package/template/fnode/node/rollup_config_plugins.njk +90 -0
  132. package/template/fnode/node/src/app/index-js-with-react-host.njk +50 -0
  133. package/template/fnode/node/src/app/index-js-without-react-host.njk +23 -0
  134. package/template/fnode/node/src/app/index.html.njk +67 -0
  135. package/template/fnode/node/src/app/index.js.njk +9 -0
  136. package/template/fnode/node/src/cli/index.js.njk +81 -0
  137. package/template/fnode/node/src/default/engine.js.njk +17 -0
  138. package/template/fnode/node/src/default/to.args.js.njk +120 -0
  139. package/template/fnode/node/tsconfig.json.njk +16 -0
  140. package/template/fnode/project/.gitignore.njk +11 -0
  141. package/template/fnode/project/.vscode/launch.json.njk +78 -0
  142. package/template/fnode/project/.vscode/tasks.json.njk +46 -0
  143. package/template/fnode/project/fnet/targets.yaml.njk +25 -0
  144. package/template/fnode/project/fnode.yaml.njk +12 -0
  145. package/template/fnode/python/.gitignore.njk +7 -0
  146. package/template/fnode/python/fnode.yaml.njk +1 -0
  147. package/template/fnode/python/package.json.njk +4 -0
  148. package/template/fnode/python/pyproject.toml.njk +3 -0
  149. package/template/fnode/python/readme.md.njk +12 -0
  150. package/template/fnode/python/setup.py.njk +19 -0
  151. package/template/fnode/python/src/cli/index.py.njk +25 -0
  152. package/template/schemas/to-npm.yaml +14 -0
  153. package/dist/fnet/index.DZbefC4O.js +0 -1
  154. package/dist/fnode/index.DrdnDArw.js +0 -1
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "{{atom.doc['npm::name'] or atom.doc['name'] or atom['id']}}",
3
+ "version": "{{atom.doc['npm::version'] or '0.1.0'}}",
4
+ "files": [
5
+ "dist/*",
6
+ "fnet/input.yaml",
7
+ "fnet/output.yaml"
8
+ ],
9
+ {# "sideEffects": false, #}
10
+ {% if atom.doc['npm::author'] %}
11
+ "author": "{{atom.doc['npm::author'] | safe}}",
12
+ {% endif %}
13
+
14
+ {% if atom.doc['npm::description'] %}
15
+ "description": "{{atom.doc['npm::description'] | safe}}",
16
+ {% endif %}
17
+
18
+ {% if atom.doc.features.project.format ==='cjs' %}
19
+ {% if atom.doc.features.rollup_output.esm.enabled === true%}
20
+ "main": "dist/default/esm/index.js",
21
+ "type":"module",
22
+ {% else %}
23
+ "main": "dist/default/cjs/index.cjs",
24
+ {% endif %}
25
+ {% if atom.doc.features.dts_enabled ===true %}
26
+ "types": "dist/default/types/index.d.ts",
27
+ {% endif %}
28
+ "exports":{
29
+ ".":{
30
+ "import":"./dist/default/esm/index.js",
31
+ "require":"./dist/default/cjs/index.cjs"
32
+ }
33
+ },
34
+ {% else %}
35
+ "main": "dist/default/esm/index.js",
36
+ {% if atom.doc.features.dts_enabled ===true %}
37
+ "types": "dist/default/types/index.d.ts",
38
+ {% endif %}
39
+ "type":"module",
40
+ "exports":{
41
+ ".":{
42
+ "import":"./dist/default/esm/index.js",
43
+ "require":"./dist/default/cjs/index.cjs"
44
+ }
45
+ },
46
+ {% endif %}
47
+
48
+ {% if atom.doc.repo.url %}
49
+ "repository": {
50
+ "type": "{{atom.doc.repo.type or 'git'}}",
51
+ "url": "{{atom.doc.repo.url}}"
52
+ },
53
+ {% endif %}
54
+ "license": "{{atom.doc.license or 'MIT'}}",
55
+ "scripts": {
56
+ "build": "rollup --config",
57
+ "watch": "rollup --config --watch --sourcemap --environment DEVELOPMENT",
58
+ "serve": "bunx serve ./"
59
+ {% if atom.doc.features.cli.enabled %}
60
+ {% if atom.doc.features.project.format ==='cjs' %}
61
+ ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
62
+ {% else %}
63
+ ,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/"
64
+ {% endif %}
65
+
66
+ {% endif %}
67
+ {% if atom.doc.features.app.enabled %}
68
+ ,"app": "bunx serve {{atom.doc.features.app.dir}}/"
69
+ {% endif %}
70
+ },
71
+ "devDependencies": {
72
+ {% for dep in packageDevDependencies %}
73
+ "{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
74
+ {% endfor%}
75
+ },
76
+ "dependencies": {
77
+ {% for dep in packageDependencies %}
78
+ "{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
79
+ {% endfor%}
80
+ }
81
+ {% if atom.doc.features.cli.enabled and atom.doc['npm::bin'] %}
82
+ ,"bin":{
83
+ {% if atom.doc.features.project.format ==='cjs' %}
84
+ "{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
85
+ {% else %}
86
+ "{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.js"
87
+ {% endif %}
88
+ }
89
+ {% endif %}
90
+ }
@@ -0,0 +1,21 @@
1
+ {{content | safe}}
2
+
3
+ {% if howto %}
4
+ {{howto | safe}}
5
+ {% endif %}
6
+
7
+ {% if input %}
8
+ # Input Schema
9
+
10
+ ```yaml
11
+ {{ input | safe}}
12
+ ```
13
+ {% endif %}
14
+
15
+ {% if output %}
16
+ # Output Schema
17
+
18
+ ```yaml
19
+ {{ output | safe}}
20
+ ```
21
+ {% endif %}
@@ -0,0 +1,363 @@
1
+ import commonjs from "@rollup/plugin-commonjs";
2
+ import { nodeResolve as resolve } from "@rollup/plugin-node-resolve";
3
+ import external from "rollup-plugin-peer-deps-external";
4
+
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+
8
+ const DEVELOPMENT = process.env.DEVELOPMENT ? true : false;
9
+ const extensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
10
+
11
+ {% if atom.doc.features.copy_enabled===true %}
12
+ const copyFiles = async (src, dest) => {
13
+ try {
14
+ await fs.copy(src, dest);
15
+ console.log(`Copied files from ${src} to ${dest}`);
16
+ } catch (err) {
17
+ console.error('Error copying files:', err);
18
+ }
19
+ };
20
+
21
+ const watchFiles = async (targets) => {
22
+ const chokidar = await import('chokidar');
23
+ targets.forEach(target => {
24
+ const watcher = chokidar.watch(target.src, { persistent: true });
25
+
26
+ watcher.on('add', async filePath => {
27
+ const destPath = target.dest;
28
+ const relativePath = path.relative(path.dirname(target.src), filePath);
29
+ await copyFiles(filePath, path.join(destPath, relativePath));
30
+ });
31
+
32
+ watcher.on('change', async filePath => {
33
+ const destPath = target.dest;
34
+ const relativePath = path.relative(path.dirname(target.src), filePath);
35
+ await copyFiles(filePath, path.join(destPath, relativePath));
36
+ });
37
+
38
+ watcher.on('unlink', async filePath => {
39
+ const destPath = target.dest;
40
+ const relativePath = path.relative(path.dirname(target.src), filePath);
41
+ try {
42
+ await fs.remove(path.join(destPath, relativePath));
43
+ console.log(`Removed files from ${path.join(destPath, relativePath)}`);
44
+ } catch (err) {
45
+ console.error('Error removing files:', err);
46
+ }
47
+ });
48
+ });
49
+ };
50
+ {% endif %}
51
+
52
+ const initPlugins = async (options) => {
53
+ const plugins = [];
54
+
55
+ {# DELETE #}
56
+ if (options.delete) {
57
+ const {default:del} = await import('@fnet/rollup-plugin-delete');
58
+ plugins.push(del(options.delete));
59
+ }
60
+
61
+ {# REPLACE #}
62
+ if (options.replace) {
63
+ const {default:replace} = await import("@rollup/plugin-replace");
64
+ plugins.push(replace({
65
+ "process.env.NODE_ENV": JSON.stringify(DEVELOPMENT ? 'development' : 'production'),
66
+ preventAssignment: true,
67
+ ...options.replace
68
+ }));
69
+ }
70
+
71
+ {# ALIAS #}
72
+ if (options.alias) {
73
+ const {default:alias} = await import('@rollup/plugin-alias');
74
+ plugins.push(alias(options.alias));
75
+ }
76
+
77
+ {# NUNJUCKS #}
78
+ {% if atom.doc.features.nunjucks_enabled===true %}
79
+ if (options.nunjucks) {
80
+ const {default:nunjucks} = await import('@fnet/rollup-plugin-nunjucks');
81
+ plugins.push(nunjucks(options.nunjucks.options));
82
+ }
83
+ {% endif %}
84
+
85
+ {# COPY #}
86
+ {% if atom.doc.features.copy_enabled===true %}
87
+ if (options.copy) {
88
+ const {default:copy} = await import('rollup-plugin-copy');
89
+ plugins.push(copy(options.copy.options));
90
+
91
+ if (DEVELOPMENT) watchFiles(options.copy.options.targets);
92
+ }
93
+ {% endif %}
94
+
95
+ {# STRING #}
96
+ {% if atom.doc.features.string_enabled===true %}
97
+ if (options.string) {
98
+ const { string } = await import('rollup-plugin-string');
99
+ plugins.push(string(options.string.options));
100
+ }
101
+ {% endif %}
102
+
103
+ {# IMAGE #}
104
+ {% if atom.doc.features.image_enabled===true %}
105
+ if (options.image) {
106
+ const {default:image} = await import('@rollup/plugin-image');
107
+ plugins.push(image(options.image.options));
108
+ }
109
+ {% endif %}
110
+
111
+ {# WASM #}
112
+ {% if atom.doc.features.wasm_enabled===true %}
113
+ if (options.wasm) {
114
+ const { wasm } = await import('@rollup/plugin-wasm');
115
+ plugins.push(wasm(options.wasm.options));
116
+ }
117
+ {% endif %}
118
+
119
+ {# POSTCSS #}
120
+ {% if atom.doc.features.css_enabled===true %}
121
+ if (options.postcss) {
122
+ const {default:postcss} = await import('rollup-plugin-postcss');
123
+ const { plugins: cssPlugins, ...cssOptions } = options.postcss.options;
124
+ const postcssPlugins = [];
125
+
126
+ if (cssPlugins) {
127
+ for (const plugin of cssPlugins) {
128
+ let pluginLib;
129
+ switch (plugin.name) {
130
+ case "postcss-import":
131
+ pluginLib = (await import("postcss-import")).default;
132
+ break;
133
+ case "postcss-url":
134
+ pluginLib = (await import("postcss-url")).default;
135
+ break;
136
+ case "postcss-preset-env":
137
+ pluginLib = (await import("postcss-preset-env")).default;
138
+ break;
139
+ case "autoprefixer":
140
+ pluginLib = (await import("autoprefixer")).default;
141
+ break;
142
+ case "cssnano":
143
+ pluginLib = (await import("cssnano")).default;
144
+ break;
145
+ default:
146
+ continue;
147
+ }
148
+ postcssPlugins.push(pluginLib(plugin.options));
149
+ }
150
+ }
151
+
152
+ plugins.push(postcss({
153
+ ...cssOptions,
154
+ plugins: postcssPlugins
155
+ }));
156
+ }
157
+ {% endif %}
158
+
159
+ {# JSON #}
160
+ {% if atom.doc.features.json_enabled===true %}
161
+ if (options.json) {
162
+ const {default:json} = await import('@rollup/plugin-json');
163
+ plugins.push(json(options.json.options));
164
+ }
165
+ {% endif %}
166
+
167
+ {# EXTERNAL #}
168
+ plugins.push(external({
169
+ includeDependencies: !options.browser
170
+ }));
171
+
172
+ {# RESOLVE #}
173
+ plugins.push(resolve({
174
+ extensions: extensions,
175
+ browser: options?.browser === true,
176
+ preferBuiltins: true,
177
+ modulePaths: ['./node_modules']
178
+ }));
179
+
180
+ {# COMMONJS #}
181
+ plugins.push(commonjs({
182
+ {% if atom.doc.features.project.format ==='esm' %}
183
+ include: /node_modules/,
184
+ ignore: ["fsevents"],
185
+ {% endif %}
186
+ }));
187
+
188
+
189
+ {# POLYFILL #}
190
+ {% if atom.doc.features.polyfill_enabled===true %}
191
+ if(options.polyfill){
192
+ const {default:polyfills} = await import('rollup-plugin-node-polyfills');
193
+ plugins.push(polyfills(options.polyfill.options));
194
+ }
195
+ {% endif %}
196
+
197
+ {# WORKBOX #}
198
+ {% if atom.doc.features.workbox_enabled===true %}
199
+ if (options?.workbox) {
200
+ const {generateSW,injectManifest} = await import('rollup-plugin-workbox');
201
+ if(options.workbox.options?.generate) plugins.push(generateSW(options.workbox.options.generate));
202
+ if(options.workbox.options?.inject) plugins.push(injectManifest(options.workbox.options.inject));
203
+ }
204
+ {% endif %}
205
+
206
+ {# BABEL #}
207
+ {% if atom.doc.features.babel_enabled===true %}
208
+ if (options?.babel) {
209
+ const { babel } = await import('@rollup/plugin-babel');
210
+ plugins.push(
211
+ babel({
212
+ babelHelpers: "bundled",
213
+ presets: [
214
+ ["@babel/preset-env", {
215
+ targets: options.babel.targets || "defaults",
216
+ }],
217
+ ["@babel/preset-react"]
218
+ ],
219
+ extensions: extensions,
220
+ exclude: "node_modules/**",
221
+ plugins: options.babel.plugins || [],
222
+ sourceMaps: DEVELOPMENT
223
+ })
224
+ );
225
+ }
226
+ {% endif %}
227
+
228
+ {# TERSER #}
229
+ {% if atom.doc.features.terser_enabled===true %}
230
+ if (options.terser) {
231
+ const {default:terser} = await import("@rollup/plugin-terser");
232
+ plugins.push(terser(options.terser.options));
233
+ }
234
+ {% endif %}
235
+
236
+ {# GZIP #}
237
+ {% if atom.doc.features.gzip_enabled===true %}
238
+ if (options.gzip) {
239
+ const {default:gzip} = await import('rollup-plugin-gzip');
240
+ if(options.gzip.options) plugins.push(gzip(options.gzip.options));
241
+ }
242
+ {% endif %}
243
+
244
+ {# ANALYZER #}
245
+ {% if atom.doc.features.analyzer_enabled===true %}
246
+ if (options.analyzer) {
247
+ const { default: analyzer } = await import("rollup-plugin-analyzer");
248
+ plugins.push(analyzer(options.analyzer.options));
249
+ }
250
+ {% endif %}
251
+
252
+ {# VISUALIZER #}
253
+ {% if atom.doc.features.visualizer_enabled===true %}
254
+ if (options.visualizer) {
255
+ const { visualizer } = await import("rollup-plugin-visualizer");
256
+ plugins.push(visualizer(options.visualizer.options));
257
+ }
258
+ {% endif %}
259
+
260
+ {# BROWSERSYNC #}
261
+ {% if atom.doc.features.browsersync_enabled===true %}
262
+ if (options.browsersync && DEVELOPMENT) {
263
+ const {default:browsersync} = await import('@fnet/rollup-plugin-browsersync');
264
+ options.browsersync.middleware = function (req, res, next) {
265
+ if (req.method === 'OPTIONS') {
266
+ res.setHeader('Access-Control-Allow-Origin', '*');
267
+ res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
268
+ res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
269
+ res.setHeader('Access-Control-Allow-Credentials', true);
270
+ res.end();
271
+ } else {
272
+ next();
273
+ }
274
+ };
275
+ plugins.push(browsersync(options.browsersync));
276
+ }
277
+ {% endif %}
278
+
279
+ return plugins;
280
+ }
281
+
282
+ const groups = [
283
+ { name: "default" }
284
+ ];
285
+
286
+ const configs = [];
287
+
288
+ const createConfigs = async () => {
289
+ for (const group of groups) {
290
+ let groupDir = path.normalize(`./dist/${group.name}/`);
291
+ if (!fs.existsSync(groupDir)) {
292
+ fs.mkdirSync(groupDir, { recursive: true });
293
+ }
294
+
295
+ {% for key, value in atom.doc.features.rollup_output %}
296
+ {% if value and value.enabled !== false %}
297
+ {
298
+ // {{key | upper}}
299
+ const config = {
300
+ input: path.normalize(`{{value.input or 'src/${group.name}/index.js'}}`),
301
+ output: {
302
+ dir: path.normalize(`{{value.output_dir or 'dist/${group.name}/' + key}}`),
303
+ format: "{{value.format}}",
304
+ {% if atom.doc.features.sourcemap === true %}
305
+ sourcemap: true,
306
+ {% endif %}
307
+ {% if value.format === 'cjs' %}
308
+ exports: "{{value.output_exports or 'named'}}",
309
+ interop: "auto",
310
+ entryFileNames: "[name].cjs",
311
+ chunkFileNames: "[name]-[hash].cjs",
312
+ {% endif %}
313
+ {% include 'rollup_config_output_name.njk' %}
314
+ {% include 'rollup_config_output_globals.njk' %}
315
+ {% include 'rollup_config_output_banner.njk' %}
316
+ {% include 'rollup_config_output_footer.njk' %}
317
+ },
318
+ {% if value.context %}
319
+ context: "{{value.context}}",
320
+ {% endif %}
321
+ {% include 'rollup_config_external.njk' %}
322
+ {% include 'rollup_config_onwarn.njk' %}
323
+ {% include 'rollup_config_plugins.njk' %}
324
+ }
325
+ configs.push(config);
326
+ }
327
+ {% endif %}
328
+ {% endfor %}
329
+ }
330
+
331
+ {# DTS #}
332
+ {% if atom.doc.features.dts_enabled ===true %}
333
+ const { dts } = await import("rollup-plugin-dts");
334
+ const typesConfig = {
335
+ input: path.normalize('{{atom.typesDir}}/default/index.d.ts'),
336
+ output: {
337
+ file: path.normalize("./dist/default/types/index.d.ts"),
338
+ format: "es"
339
+ },
340
+ plugins: [dts()],
341
+ }
342
+ configs.push(typesConfig);
343
+ {% endif %}
344
+ }
345
+
346
+ {% if atom.doc.features.render and atom.doc.features.render.enabled !== false %}
347
+ async function render(){
348
+ const { default:fnetRender } = await import('@flownet/lib-render-templates-dir');
349
+
350
+ const dirs={{atom.doc.features.render.dirs | default([]) | dump | safe}};
351
+
352
+ for (const dir of dirs) {
353
+ await fnetRender(dir);
354
+ }
355
+ }
356
+ {% endif %}
357
+ export default async () => {
358
+ {% if atom.doc.features.render and atom.doc.features.render.enabled !== false %}
359
+ await render();
360
+ {% endif %}
361
+ await createConfigs();
362
+ return configs;
363
+ };
@@ -0,0 +1,8 @@
1
+
2
+ {% if value.external_enabled %}
3
+ external: [
4
+ {% for external in value.external %}
5
+ "{{external}}" {% if not loop.last %},{% endif %}
6
+ {% endfor %}
7
+ ],
8
+ {% endif %}
@@ -0,0 +1,9 @@
1
+ onwarn(warning, warn) {
2
+ switch (warning.code) {
3
+ case 'MODULE_LEVEL_DIRECTIVE':
4
+ case 'CIRCULAR_DEPENDENCY':
5
+ return;
6
+ default:
7
+ warn(warning);
8
+ }
9
+ },
@@ -0,0 +1,3 @@
1
+ {% if value.banner %}
2
+ banner:'{{value.banner}}',
3
+ {% endif %}
@@ -0,0 +1,5 @@
1
+ {% if value.format==='iife' %}
2
+ {% if atom.type==='workflow'%}
3
+ {# footer: "new {{atom.doc.bundleName}}().run().catch(e=>{});" #}
4
+ {% endif %}
5
+ {% endif %}
@@ -0,0 +1,9 @@
1
+ {% if value.browser===true %}
2
+ {% if value.globals.length %}
3
+ globals: {
4
+ {% for global in value.globals %}
5
+ "{{global.key}}":"{{global.value}}" {% if not loop.last %},{% endif %}
6
+ {% endfor %}
7
+ },
8
+ {% endif %}
9
+ {% endif %}
@@ -0,0 +1,3 @@
1
+ {% if value.format==='iife' or value.format==='umd'%}
2
+ name: "{{atom.doc.bundleName}}",
3
+ {% endif %}
@@ -0,0 +1,90 @@
1
+ plugins: await initPlugins({
2
+ delete:{ targets: [path.normalize(groupDir + '{{key}}')], runOnce: DEVELOPMENT },
3
+
4
+ format:"{{ value.format }}",
5
+
6
+ {% if value.babel===true %}
7
+ babel:{{value.babel_options | dump | safe}},
8
+ {% endif %}
9
+
10
+ {% if value.replace ===true %}
11
+ replace:{{value.replace_options | dump | safe}},
12
+ {% endif %}
13
+
14
+ {% if value.browser===true %}
15
+ browser:true,
16
+ {% endif %}
17
+
18
+ {% if value.browsersync===true and atom.doc.features.browsersync_enabled===true%}
19
+ browsersync: {{value.browsersync_options | dump | safe}},
20
+ {% endif %}
21
+
22
+ {% if value.alias_enabled===true %}
23
+ alias:{{value.alias | dump | safe}},
24
+ {% endif %}
25
+
26
+ {# OK #}
27
+ {% if value.css %}
28
+ postcss:{{value.css | dump | safe}},
29
+ {% endif %}
30
+
31
+ {# OK #}
32
+ {% if value.copy %}
33
+ copy:{{value.copy | dump | safe}},
34
+ {% endif %}
35
+
36
+ {# OK #}
37
+ {% if value.terser%}
38
+ terser:{{value.terser | dump | safe}},
39
+ {% endif %}
40
+
41
+ {# OK #}
42
+ {% if value.json %}
43
+ json:{{value.json | dump | safe}},
44
+ {% endif %}
45
+
46
+ {# OK #}
47
+ {% if value.wasm %}
48
+ wasm: {{value.wasm | dump | safe}},
49
+ {% endif %}
50
+
51
+ {# OK #}
52
+ {% if value.string %}
53
+ string:{{value.string | dump | safe}},
54
+ {% endif %}
55
+
56
+ {# OK #}
57
+ {% if value.image %}
58
+ image:{{value.image | dump | safe}},
59
+ {% endif %}
60
+
61
+ {# OK #}
62
+ {% if value.analyzer %}
63
+ analyzer:{{value.analyzer | dump | safe}},
64
+ {% endif %}
65
+
66
+ {# OK #}
67
+ {% if value.visualizer %}
68
+ visualizer:{{value.visualizer | dump | safe}},
69
+ {% endif %}
70
+
71
+ {# OK #}
72
+ {% if value.polyfill %}
73
+ polyfill:{{value.polyfill | dump | safe}},
74
+ {% endif %}
75
+
76
+ {# OK #}
77
+ {% if value.nunjucks %}
78
+ nunjucks:{{value.nunjucks | dump | safe}},
79
+ {% endif %}
80
+
81
+ {# OK #}
82
+ {% if value.workbox %}
83
+ workbox:{{value.workbox | dump | safe}},
84
+ {% endif %}
85
+
86
+ {# OK #}
87
+ {% if value.gzip %}
88
+ gzip:{{value.gzip | dump | safe}},
89
+ {% endif %}
90
+ }),
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{atom.doc.title or atom.doc.name}}</title>
8
+
9
+ {% if atom.doc.features.css.options.extract===true %}
10
+ <link rel="stylesheet" href="./index.css" />
11
+ {% endif %}
12
+
13
+ {% if atom.doc.features.app.format==='iife' %}
14
+ <script src="./index.js"></script>
15
+ {% endif %}
16
+
17
+ </head>
18
+ <body style="height:100vh;margin:0;padding:0;background-color: #eeeeee;">
19
+ <div id="container" style="height:100%;"></div>
20
+ {% if atom.doc.features.app.export===true %}
21
+ {% if atom.doc.features.app.format==='esm' %}
22
+ <script type="module">
23
+ import { createApp } from "./index.js";
24
+ const run = createApp({container: document.getElementById("container")});
25
+ {% if atom.doc.features.app.props %}
26
+ const dispose=run({{ atom.doc.features.app.props | dump | safe }});
27
+ {% else %}
28
+ const dispose=run();
29
+ {% endif %}
30
+ </script>
31
+ {% endif %}
32
+
33
+ {% if atom.doc.features.app.format==='iife' %}
34
+ <script>
35
+ const { createApp } = window['{{atom.doc.bundleName}}'];
36
+ const run = createApp({container: document.getElementById("container")});
37
+ {% if atom.doc.features.app.props %}
38
+ const dispose=run({{ atom.doc.features.app.props | dump | safe }});
39
+ {% else %}
40
+ const dispose=run();
41
+ {% endif %}
42
+ </script>
43
+ {% endif %}
44
+ {% endif %}
45
+
46
+ {% if atom.doc.features.workbox_enabled %}
47
+ {% if atom.doc.features.rollup_output.app.workbox.enabled %}
48
+ <!-- Service Worker Registration -->
49
+ <script>
50
+ if ('serviceWorker' in navigator) {
51
+ window.addEventListener('load', () => {
52
+ navigator
53
+ .serviceWorker
54
+ .register('./sw.js', {scope: './'}) // Optionally add scope
55
+ .then((registration) => {
56
+ console.log('Service Worker registered with scope:', registration.scope);
57
+ })
58
+ .catch((error) => {
59
+ console.log('Service Worker registration failed:', error);
60
+ });
61
+ });
62
+ }
63
+ </script>
64
+ {% endif%}
65
+ {% endif%}
66
+ </body>
67
+ </html>