@fnet/cli 0.129.0 → 0.130.1
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/fbin/index.js +1 -1
- package/dist/fnet/{index.DkEl8VOr.js → index.DOYkqsYT.js} +1 -1
- package/dist/fnet/index.js +1 -1
- package/dist/fnode/index.D9RmDejw.js +1 -0
- package/dist/fnode/index.js +1 -1
- package/dist/fservice/index.js +1 -1
- package/package.json +1 -1
- package/template/{fnode/bun → fnet/node}/build.js.njk +39 -46
- package/template/fnet/node/package.json.njk +17 -11
- package/template/fnode/node/build.js.njk +149 -0
- package/template/fnode/node/package.json.njk +20 -12
- package/template/fnode/project/fnet/targets.yaml.njk +2 -2
- package/template/schemas/to-npm.yaml +1 -1
- package/dist/fnode/index.AkoGqRzv.js +0 -1
- package/dist/fnode/index.BqI7rTjk.js +0 -1
- package/dist/fnode/index.CuZwF16z.js +0 -1
- package/template/fnode/bun/.gitignore.njk +0 -8
- package/template/fnode/bun/package.json.njk +0 -93
- package/template/fnode/bun/readme.md.njk +0 -21
- package/template/fnode/bun/src/app/index-js-with-react-host.njk +0 -50
- package/template/fnode/bun/src/app/index-js-without-react-host.njk +0 -23
- package/template/fnode/bun/src/app/index.html.njk +0 -67
- package/template/fnode/bun/src/app/index.js.njk +0 -9
- package/template/fnode/bun/src/cli/index.js.njk +0 -82
- package/template/fnode/bun/src/default/engine.js.njk +0 -17
- package/template/fnode/bun/src/default/input.args.js.njk +0 -122
- package/template/fnode/bun/tsconfig.json.njk +0 -16
|
@@ -57,10 +57,17 @@
|
|
|
57
57
|
{% endif %}
|
|
58
58
|
"license": "{{atom.doc.license or 'MIT'}}",
|
|
59
59
|
"scripts": {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
{% if atom.doc.features.runtime.type === 'bun' %}
|
|
61
|
+
"build": "bun ./build.js",
|
|
62
|
+
"build:dev": "bun ./build.js --dev",
|
|
63
|
+
"watch": "bun --watch --watch-mode=poll --watch-ignore-dirs=node_modules,dist --watch-paths=./src ./build.js --dev",
|
|
64
|
+
"serve": "bunx serve ./"
|
|
65
|
+
{% else %}
|
|
66
|
+
"build": "rollup --config",
|
|
67
|
+
"build:dev": "rollup --config --sourcemap --environment DEVELOPMENT",
|
|
68
|
+
"watch": "rollup --config --watch --sourcemap --environment DEVELOPMENT --environment FLOWNET_WATCH",
|
|
69
|
+
"serve": "bunx serve ./"
|
|
70
|
+
{% endif %}
|
|
64
71
|
|
|
65
72
|
{% if atom.doc.features.cli.enabled %}
|
|
66
73
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
@@ -70,26 +77,25 @@
|
|
|
70
77
|
,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
71
78
|
{% endif %}
|
|
72
79
|
{% else %}
|
|
73
|
-
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
80
|
+
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}}"
|
|
74
81
|
,"cli:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
|
|
75
82
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
76
|
-
,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
77
|
-
,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
83
|
+
,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
84
|
+
,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
78
85
|
,"cli:mcp:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
|
|
79
86
|
,"cli:mcp:inspect:dev": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
|
|
80
87
|
{% endif %}
|
|
81
88
|
{% endif %}
|
|
82
|
-
,"cli:compile": "fbin compile {{atom.doc.features.cli.
|
|
89
|
+
,"cli:compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
83
90
|
,"cli:compile:dev": "fbin compile {{atom.doc.features.cli.input.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
84
91
|
,"cli:install": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
85
92
|
|
|
86
|
-
,"compile": "fbin compile {{atom.doc.features.cli.
|
|
93
|
+
,"compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
87
94
|
,"install-bin": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
88
95
|
{% endif %}
|
|
89
96
|
|
|
90
97
|
{% if atom.doc.features.app.enabled %}
|
|
91
98
|
,"app": "bunx serve {{atom.doc.features.app.dir}}/"
|
|
92
|
-
{# ,"app:dev": "bunx serve {{atom.doc.features.app.input.dir}}" #}
|
|
93
99
|
{% endif %}
|
|
94
100
|
},
|
|
95
101
|
"devDependencies": {
|
|
@@ -108,7 +114,7 @@
|
|
|
108
114
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
109
115
|
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
|
|
110
116
|
{% else %}
|
|
111
|
-
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.
|
|
117
|
+
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.output.file}}"
|
|
112
118
|
{% endif %}
|
|
113
119
|
}
|
|
114
120
|
{% endif %}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Build script for Bun projects
|
|
4
|
+
* This script uses Bun's built-in bundler instead of Rollup
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
async function ensureDir(dir) {
|
|
15
|
+
try {
|
|
16
|
+
await mkdir(dir, { recursive: true });
|
|
17
|
+
} catch (err) {
|
|
18
|
+
if (err.code !== 'EEXIST') throw err;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function buildOutput(name, config) {
|
|
23
|
+
console.log(`Building ${name}...`);
|
|
24
|
+
|
|
25
|
+
const outdir = config.outdir || join(__dirname, `dist/${name}`);
|
|
26
|
+
await ensureDir(outdir);
|
|
27
|
+
|
|
28
|
+
{% if atom.doc.features.app.enabled !== false %}
|
|
29
|
+
// Copy HTML file if it exists and this is an app build
|
|
30
|
+
if (name === 'app') {
|
|
31
|
+
try {
|
|
32
|
+
const htmlPath = './src/app/index.html';
|
|
33
|
+
if (fs.existsSync(htmlPath)) {
|
|
34
|
+
const htmlContent = await Bun.file(htmlPath).text();
|
|
35
|
+
await writeFile(join(outdir, 'index.html'), htmlContent);
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (err.code !== 'ENOENT') {
|
|
39
|
+
console.warn('Warning: Could not copy HTML file:', err.message);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
const buildConfig = {
|
|
46
|
+
entrypoints: config.entrypoints || [`./src/${name}/index.js`],
|
|
47
|
+
outdir: outdir,
|
|
48
|
+
format: config.format || 'esm',
|
|
49
|
+
target: config.target || "browser",
|
|
50
|
+
minify: config.minify !== undefined ? config.minify : false,
|
|
51
|
+
sourcemap: config.sourcemap || 'external',
|
|
52
|
+
splitting: true,
|
|
53
|
+
// Add environment variables to help with module resolution
|
|
54
|
+
define: {
|
|
55
|
+
'process.env.NODE_PATH': JSON.stringify('./node_modules')
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
plugins: [
|
|
59
|
+
...(config.plugins || [])
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if(config.external) buildConfig.external = config.external;
|
|
64
|
+
if(config.packages) buildConfig.packages = config.packages;
|
|
65
|
+
if(config.banner) buildConfig.banner = config.banner;
|
|
66
|
+
if(config.footer) buildConfig.footer = config.footer;
|
|
67
|
+
|
|
68
|
+
// Build with Bun.build
|
|
69
|
+
const result = await Bun.build(buildConfig);
|
|
70
|
+
|
|
71
|
+
if (!result.success) {
|
|
72
|
+
console.error(`${name} build failed:`, result.logs);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function main() {
|
|
80
|
+
try {
|
|
81
|
+
{% if atom.doc.features.project.format === 'esm' or atom.doc.features.project.format === undefined %}
|
|
82
|
+
// Build default ESM
|
|
83
|
+
await buildOutput('default', {
|
|
84
|
+
format: "esm",
|
|
85
|
+
target: "browser",
|
|
86
|
+
minify: false,
|
|
87
|
+
sourcemap: "external",
|
|
88
|
+
entrypoints: ["./src/default/index.js"],
|
|
89
|
+
outdir: "./dist/default/esm",
|
|
90
|
+
packages: "external"
|
|
91
|
+
});
|
|
92
|
+
{% endif %}
|
|
93
|
+
|
|
94
|
+
{% if atom.doc.features.project.format !== 'esm' %}
|
|
95
|
+
// Build default CJS
|
|
96
|
+
await buildOutput('defaultCjs', {
|
|
97
|
+
format: "cjs",
|
|
98
|
+
target: "browser",
|
|
99
|
+
minify: false,
|
|
100
|
+
sourcemap: "external",
|
|
101
|
+
entrypoints: ["./src/default/index.js"],
|
|
102
|
+
outdir: "./dist/default/cjs",
|
|
103
|
+
packages: "external"
|
|
104
|
+
});
|
|
105
|
+
{% endif %}
|
|
106
|
+
|
|
107
|
+
{% if atom.doc.features.cli.enabled !== false %}
|
|
108
|
+
// Build CLI if exists
|
|
109
|
+
if (fs.existsSync('./src/cli/index.js')) {
|
|
110
|
+
await buildOutput('cli', {
|
|
111
|
+
format: "esm",
|
|
112
|
+
target: "browser",
|
|
113
|
+
minify: false,
|
|
114
|
+
sourcemap: "external",
|
|
115
|
+
entrypoints: ["./src/cli/index.js"],
|
|
116
|
+
outdir: "{{ atom.doc.features.cli.dir | default('./dist/cli/esm') }}",
|
|
117
|
+
packages: "external",
|
|
118
|
+
banner: "#!/usr/bin/env bun"
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
console.log('CLI not found, skipping CLI build');
|
|
122
|
+
}
|
|
123
|
+
{% endif %}
|
|
124
|
+
|
|
125
|
+
{% if atom.doc.features.app.enabled !== false %}
|
|
126
|
+
// Build App if exists
|
|
127
|
+
if (fs.existsSync('./src/app/index.js')) {
|
|
128
|
+
await buildOutput('app', {
|
|
129
|
+
format: "esm",
|
|
130
|
+
target: "browser",
|
|
131
|
+
minify: false,
|
|
132
|
+
sourcemap: "external",
|
|
133
|
+
entrypoints: ["./src/app/index.js"],
|
|
134
|
+
outdir: "{{ atom.doc.features.app.dir | default('./dist/app/esm') }}",
|
|
135
|
+
packages: "bundle"
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
console.log('App not found, skipping App build');
|
|
139
|
+
}
|
|
140
|
+
{% endif %}
|
|
141
|
+
|
|
142
|
+
console.log('Build completed successfully!');
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.error('Build failed:', err);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
main();
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"fnet/input.yaml",
|
|
7
7
|
"fnet/output.yaml"
|
|
8
8
|
],
|
|
9
|
-
{# "sideEffects": false, #}
|
|
10
9
|
{% if atom.doc['npm::author'] %}
|
|
11
10
|
"author": "{{atom.doc['npm::author'] | safe}}",
|
|
12
11
|
{% endif %}
|
|
@@ -57,10 +56,18 @@
|
|
|
57
56
|
{% endif %}
|
|
58
57
|
"license": "{{atom.doc.license or 'MIT'}}",
|
|
59
58
|
"scripts": {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
|
|
60
|
+
{% if atom.doc.features.runtime.type === 'bun' %}
|
|
61
|
+
"build": "bun ./build.js",
|
|
62
|
+
"build:dev": "bun ./build.js --dev",
|
|
63
|
+
"watch": "bun --watch --watch-mode=poll --watch-ignore-dirs=node_modules,dist --watch-paths=./src ./build.js --dev",
|
|
64
|
+
"serve": "bunx serve ./"
|
|
65
|
+
{% else %}
|
|
66
|
+
"build": "rollup --config",
|
|
67
|
+
"build:dev": "rollup --config --sourcemap --environment DEVELOPMENT",
|
|
68
|
+
"watch": "rollup --config --watch --sourcemap --environment DEVELOPMENT --environment FLOWNET_WATCH",
|
|
69
|
+
"serve": "bunx serve ./"
|
|
70
|
+
{% endif %}
|
|
64
71
|
|
|
65
72
|
{% if atom.doc.features.cli.enabled %}
|
|
66
73
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
@@ -70,33 +77,34 @@
|
|
|
70
77
|
,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
71
78
|
{% endif %}
|
|
72
79
|
{% else %}
|
|
73
|
-
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
80
|
+
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}}"
|
|
74
81
|
,"cli:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
|
|
75
82
|
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
76
|
-
,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
77
|
-
,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.
|
|
83
|
+
,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
84
|
+
,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
78
85
|
,"cli:mcp:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
|
|
79
86
|
,"cli:mcp:inspect:dev": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
|
|
80
87
|
{% endif %}
|
|
81
88
|
{% endif %}
|
|
82
|
-
,"cli:compile": "fbin compile {{atom.doc.features.cli.
|
|
89
|
+
,"cli:compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
83
90
|
,"cli:compile:dev": "fbin compile {{atom.doc.features.cli.input.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
84
91
|
,"cli:install": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
85
92
|
|
|
86
|
-
,"compile": "fbin compile {{atom.doc.features.cli.
|
|
93
|
+
,"compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
87
94
|
,"install-bin": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
88
95
|
{% endif %}
|
|
89
96
|
|
|
90
97
|
{% if atom.doc.features.app.enabled %}
|
|
91
98
|
,"app": "bunx serve {{atom.doc.features.app.dir}}/"
|
|
92
|
-
{# ,"app:dev": "bunx serve {{atom.doc.features.app.input.dir}}" #}
|
|
93
99
|
{% endif %}
|
|
94
100
|
},
|
|
101
|
+
|
|
95
102
|
"devDependencies": {
|
|
96
103
|
{% for dep in packageDevDependencies %}
|
|
97
104
|
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
98
105
|
{% endfor%}
|
|
99
106
|
},
|
|
107
|
+
|
|
100
108
|
"dependencies": {
|
|
101
109
|
{% for dep in packageDependencies %}
|
|
102
110
|
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
@@ -108,7 +116,7 @@
|
|
|
108
116
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
109
117
|
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
|
|
110
118
|
{% else %}
|
|
111
|
-
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.
|
|
119
|
+
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.output.file}}"
|
|
112
120
|
{% endif %}
|
|
113
121
|
}
|
|
114
122
|
{% endif %}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"node:fs";import t from"node:path";import a from"nunjucks";import i from"@flownet/lib-parse-imports-js";import s from"@flownet/lib-parse-node-url";import{B as r,c as o,a as n}from"./index.BTXKZRR5.js";import p from"lodash.merge";import{i as l,a as c,b as d,c as m,d as f,p as u,e as h,g as y,h as _,j as b,k as x,l as g,m as j,r as w}from"./index.BqI7rTjk.js";import v from"@fnet/npm-list-versions";import"node:crypto";import"yaml";import"chalk";import"@flownet/lib-atom-api-js";import"@fnet/config";import"@fnet/list-files";import"redis";import"@flownet/lib-is-redis-online";import"@fnet/yaml";import"@flownet/lib-render-templates-dir";import"@fnet/npm-pick-versions";import"object-hash";import"ajv/dist/2020.js";import"ajv/dist/standalone/index.js";import"ajv-formats";import"@fnet/shelljs";import"./index.js";import"yargs";import"node:util";import"tree-kill";import"node:url";import"node:child_process";import"node:os";import"@fnet/prompt";function k({dir:a,name:i="index"}){let s=t.resolve(a,`./${i}.tsx`);if(e.existsSync(s)||(s=t.resolve(a,`./${i}.ts`)),e.existsSync(s)||(s=t.resolve(a,`./${i}.jsx`)),e.existsSync(s)||(s=t.resolve(a,`./${i}.js`)),!e.existsSync(s))return{};const r=s,o=t.extname(s);return{file:r,ext:o,ts:".ts"===o||".tsx"===o,name:i}}class D extends r{async initRuntime(){await async function({atom:e,context:a,setProgress:s}){await s({message:"Initializing features..."}),e.doc.features=e.doc.features||{};const r=e.doc.features;r.project=r.project||{},r.project.format=r.project.format||r.project_format||"esm",r.project_format=r.project.format,r.dts_enabled=!0===r.dts||void 0!==r.dts&&!1!==r.dts;const o=t.resolve(a.project.projectDir),n=k({dir:t.resolve(o,"./app")});if(n.file){s("Parsing app entry imports...");let e=await i({file:n.file,recursive:!0}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.app_uses_jsx=t,r.app_has_entry=!0,e=await i({file:n.file}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.app_entry_uses_jsx=t,r.app_entry_is_ts=n.ts,r.app_entry_ext=n.ext}const u=k({dir:t.resolve(o,"./cli")});if(u.file){s("Parsing cli entry imports...");let e=await i({file:u.file,recursive:!0}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.cli_uses_jsx=t,r.cli_has_entry=!0,e=await i({file:u.file}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.cli_entry_uses_jsx=t,r.cli_entry_is_ts=u.ts,r.cli_entry_ext=u.ext}if("workflow.lib"===e.type){const e=k({dir:t.resolve(o,"./src")});if(e.file){s("Parsing src entry imports...");let t=await i({file:e.file,recursive:!0}),a=t.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.src_uses_jsx=a,r.src_has_entry=!0,t=await i({file:e.file}),a=t.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.src_entry_uses_jsx=a,r.src_entry_is_ts=e.ts,r.src_entry_ext=e.ext}}const h=Reflect.has(r,"app_entry_uses_jsx")?!0===r.app_entry_uses_jsx:!0===r.src_entry_uses_jsx,y=Reflect.has(r,"cli_entry_uses_jsx")?!0===r.cli_entry_uses_jsx:!0===r.src_entry_uses_jsx;r.form_enabled=h||y||!0===r.form||!0===r.form?.enabled,r.multiple_enabled=r.multiple_enabled||!0===r.multiple||!0===r.multiple?.enabled,!1===r.app?r.app={enabled:!1}:!0===r.app?r.app={enabled:!0,extend:!0===r.app_has_entry,export:!0,react:h}:r.app={enabled:!0,extend:!0===r.app_has_entry,export:!0,react:h,...r.app||{}},r.app.enabled=!0===r.app.enabled&&(!0===e.doc.features.form_enabled||!0===r.app.extend||!0===r.app.enabled),r.app.format=r.app.format||"esm",r.app.folder=r.app.folder||r.app.format||"esm",r.app.dir=`./dist/app/${r.app.folder}`,r.app.html=!1!==r.app.html,!1===r.cli?r.cli={enabled:!1}:!0===r.cli?r.cli={enabled:!0,extend:!0===r.cli_has_entry,export:!0,react:y}:r.cli={enabled:!0,extend:!0===r.cli_has_entry,export:!0,react:y,...r.cli||{}},r.cli.enabled=!0===r.cli.enabled&&(!1===e.doc.features.form_enabled||!0===r.cli.extend||!0===r.cli.enabled),r.cli.format=r.cli.format||"esm",r.cli.folder=r.cli.folder||r.cli.folder||"esm",r.cli.dir=`./dist/cli/${r.cli.folder}`,r.cli.node_options=r.cli.node?.options||r.cli.node_options||"",r.json=r.cli.enabled||r.json,r.bun=r.bun||{},r.bun.build=r.bun.build||{};const _={default:{format:"esm",target:"browser",minify:!1,sourcemap:"external",entrypoints:["./src/default/index.js"],outdir:"./dist/default/esm"},defaultCjs:{format:"cjs",target:"node",minify:!1,sourcemap:"external",entrypoints:["./src/default/index.js"],outdir:"./dist/default/cjs"}};r.cli.enabled&&(_.cli={format:"esm",target:"node",minify:!1,sourcemap:"external",entrypoints:["./src/cli/index.js"],outdir:r.cli.dir}),r.app.enabled&&(_.app={format:"esm",target:"browser",minify:!1,sourcemap:"external",entrypoints:["./src/app/index.js"],outdir:r.app.dir}),r.bun.build=p(_,r.bun.build||{}),r.preact_enabled=!0===r.preact||r.preact&&!1!==r.preact?.enabled,r.dependency_auto_enabled=!1!==r.dependency_auto&&!1!==r.dependency_auto?.enabled,r.npm_install_flags=r.npm_install_flags||"",r.react_version=r.react_version||r.react?.version||18,r.runtime=r.runtime||{},r.runtime.type="bun",r.runtime.template="bun",l({atom:e}),c({atom:e}),d({atom:e}),m({atom:e}),f({atom:e})}(this.apiContext),await async function({atom:e,packageDependencies:t,packageDevDependencies:a,setProgress:i}){i("Initializing dependencies for Bun");const s=e.doc.dependencies||[];if(s.filter((e=>!e.dev)).forEach((e=>t.push(e))),s.filter((e=>e.dev)).forEach((e=>a.push(e))),"workflow"===e.type&&(t.push({package:"get-value",version:"^3"}),t.push({package:"set-value",version:"^4"})),e.doc.features.form_enabled&&e.doc.features.dependency_auto_enabled){let a="^18.2";i("Fetching React versions"),a=`^${(await v({name:"react",groupBy:{major:!0}})).find((t=>t[0]===e.doc.features.react_version.toString()))[0]}`,t.push({package:"react",version:a}),t.push({package:"react-dom",version:a}),"workflow"===e.type&&(t.push({package:"@fnet/react-app",version:"^0.1"}),t.push({package:"@fnet/react-app-state",version:"^0.1"}))}e.doc.features.preact_enabled&&t.push({package:"preact",version:"^10"}),!0===e.doc.features.cli.enabled&&(t.push({package:"@fnet/args",version:"^0.1"}),t.push({package:"yargs-parser",version:"^22.0"}),e.doc.features.cli.fargs&&!1!==e.doc.features.cli.fargs?.enabled&&t.push({package:"@fnet/config",version:"0.2.21"}),e.doc.features.cli.mcp&&!0===e.doc.features.cli.mcp.enabled&&(t.push({package:"@modelcontextprotocol/sdk",version:"^1.10"}),t.push({package:"express",version:"^4.18"}))),e.doc.features.render&&!1!==e.doc.features.render.enabled&&a.push({package:"@flownet/lib-render-templates-dir",version:"0.1.19"})}(this.apiContext),await this.initLibraryDir(),await this.initNunjucks(),await this.initLibs()}async initLibs(){this.setProgress({message:"Initializing external libs."});const e=[{name:this.atom.doc.name,type:"atom",parent_id:this.atom.parent_id}];this.libs=e,await this.initAtomLibsAndDeps({libs:e,packageDependencies:this.apiContext.packageDependencies})}async initAtomLibsAndDeps({libs:e,packageDependencies:t}){const a=e.filter((e=>"atom"===e.type));for(let e=0;e<a.length;e++){const i=a[e],s=await this.findAtomLibrary({url:i.name});i.atom=s;const r=s.doc.dependencies?.filter((e=>void 0===e.repo||"npm"===e.repo));r?.forEach((e=>{const a=t.find((t=>t.package===e.package));a?"string"==typeof e.path?(a.path||[]).some((t=>t===e.path))||(a.path=a.path||[],a.path.push(e.path)):Array.isArray(e.path)&&e.path.forEach((e=>{(a.path||[]).some((t=>t===e))||(a.path=a.path||[],a.path.push(e))})):t.push(e)}))}t.sort(((e,t)=>e.package?.localeCompare(t.package)))}async findAtomLibrary({url:e}){const a=s({url:e});if(!a)throw new Error(`Invalid package name: ${e}`);if(a.protocol||(a.protocol=this.context.protocol),"ac:"===a.protocol){const t=a.pathname.split("/");if(1===t.length)return await this.apiContext.Atom.first({where:{name:e,parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"workflow.lib"}});if(2===t.length){const e=await this.apiContext.Atom.first({where:{name:t[0],parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"folder"}});return await this.apiContext.Atom.first({where:{name:t[1],parent_id:e.id,type:"workflow.lib"}})}}else if("local:"===a.protocol){const e=this.atom;e.protocol="local:",e.doc.dependencies=e.doc.dependencies||[],e.name=e.doc.name;const a=t.resolve(this.context.projectSrcDir,"index.js"),s=await i({file:a,recursive:!0}),r=e.doc.dependencies,o=s.all;for await(const e of o){if("npm"!==e.type)continue;if(r.find((t=>t.package===e.package)))continue;const t=await u({name:e.package,projectDir:this.context.projectDir,setProgress:this.apiContext.setProgress});r.push({package:e.package,subpath:e.subpath,version:t.minorRange,type:"npm"})}return e}}async createAtomLibFiles({libs:a}){await this.setProgress({message:"Creating external lib files."}),this.atom.typesDir="./types";const i=a.filter((e=>"atom"===e.type));for(let a=0;a<i.length;a++){const s=i[a].atom,r=this.context.projectDir;if("local:"===s.protocol){const a=t.resolve(this.context.projectSrcDir,`${s.fileName||s.name}.js`),i=t.relative(t.join(this.context.projectDir,"src","default"),a);if(!e.existsSync(a)){e.mkdirSync(t.dirname(a),{recursive:!0});let i="export default async (input)=>{\n";i+="}",e.writeFileSync(a,i,"utf8")}s.relativePath=i.split(t.sep).join("/"),this.atom.typesDir=`./types/${t.basename(r)}/src`}else{const a=t.join(r,"src","libs",`${s.id}.js`),i=s.doc.contents?.find((e=>"esm"===e.format))||s.doc;e.writeFileSync(a,i.content,"utf8")}}}async createEngine(){await this.setProgress({message:"Creating engine file."});const i={libs:this.libs.filter((e=>"atom"===e.type)),libraryAtom:this.atom,atom:this.atom},s=this.context.templateDir,r=a.compile(e.readFileSync(t.resolve(s,t.join("src","default","engine.js.njk")),"utf8"),this.apiContext.njEnv).render(i),o=this.context.projectDir,n=t.resolve(o,t.join("src","default","index.js"));e.writeFileSync(n,r,"utf8")}async build(){try{this.fileMode&&(await this.createAtomLibFiles({libs:this.libs}),await this.createEngine(),await this.createProjectYaml(),await o(this.apiContext),await h(this.apiContext),await n(this.apiContext),await y(this.apiContext),await _(this.apiContext),await b(this.apiContext),await async function({atom:i,setProgress:s,context:r,packageDependencies:o}){await s({message:"Creating build.js file."});const n={atom:i,packageDependencies:o},p=r.templateDir,l=a.compile(e.readFileSync(t.resolve(p,"build.js.njk"),"utf8"),a.configure(p)).render(n),c=r.projectDir,d=t.resolve(c,"build.js");e.writeFileSync(d,l,"utf8"),e.chmodSync(d,"755")}(this.apiContext),await x(this.apiContext),await g(this.apiContext),this.buildMode&&(await j(this.apiContext),await w(this.apiContext),this.deployMode&&await this.deploy())),await this._cache_set(this.buildKey,{status:"COMPLETED"})}catch(e){throw await this._cache_set(this.buildKey,{status:"FAILED",message:e.message||e}),console.log(e),e}}}export{D as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"lodash.merge";import s from"node:fs";import t from"node:path";import a from"@flownet/lib-render-templates-dir";import n from"nunjucks";import o from"@flownet/lib-parse-imports-js";import r from"@fnet/npm-pick-versions";import c from"object-hash";import i from"ajv/dist/2020.js";import p from"ajv/dist/standalone/index.js";import l from"ajv-formats";import u from"@fnet/shelljs";import{w as f}from"./index.js";function d({feature:s,features:t,packageDevDependencies:a}){const{name:n,packages:o,options:r,extraCheck:c,explicit:i}=s,p=`${n}_enabled`,l=t.rollup_output||{},u=Object.keys(l);let f=r||{};const d=t[n]?.options;d&&(f=e(f,d));const m=!t[n]||!1===t[n]?.enabled;u.forEach((e=>{const s=t.rollup_output[e];if(s){if(Reflect.has(s,n)){if(m||!s[n]||!1===s[n]?.enabled)return void delete s[n];!0===s[n]&&(s[n]={enabled:!0,options:f})}else{if(m||i||!1===t[p])return;s[n]={enabled:!0}}s[n]=s[n]||{},s[n].options={...f,...s[n].options}}}));let g=u.some((e=>!0===t.rollup_output[e][n]?.enabled));c&&(g=c()&&g),t[p]=g,g&&o.forEach((e=>a.push({package:e[0],version:e[1]})))}function m(e){const{atom:s,packageDevDependencies:t}=e;d({feature:{name:"string",packages:[["rollup-plugin-string","^3"]]},features:s.doc.features,packageDevDependencies:t})}function g(e){const{atom:s,packageDevDependencies:t}=e;d({feature:{name:"image",packages:[["@rollup/plugin-image","^3"]]},features:s.doc.features,packageDevDependencies:t})}function k(e){const{atom:s,packageDevDependencies:t}=e;d({feature:{name:"json",packages:[["@rollup/plugin-json","^6"]]},features:s.doc.features,packageDevDependencies:t})}function j(e){const{atom:s,packageDevDependencies:t}=e,a=s.doc.features,n={};!0===a.app?.enabled&&(n.targets=n.targets||[],n.targets.push({src:"./src/app/index.html",dest:a.app.dir}),Reflect.has(a.app,"copy")||Reflect.has(a,"copy")||(a.copy=!0)),d({feature:{name:"copy",packages:[["rollup-plugin-copy","^3"],["chokidar","^3"]],options:n},features:a,packageDevDependencies:t})}function v(e){const{atom:s,packageDevDependencies:t}=e,a=s.doc.features,n=a.css&&!1!==a.css.enabled;let o=[];if(n){o.push(["rollup-plugin-postcss","^4"]),o.push(["sass","^1.66"]);(a.css?.options?.plugins||[]).forEach((e=>{switch(e.name){case"postcss-import":o.push(["postcss-import","^15"]);break;case"postcss-url":o.push(["postcss-url","^10"]);break;case"postcss-preset-env":o.push(["postcss-preset-env","^9"]);break;case"autoprefixer":o.push(["autoprefixer","^10"]);break;case"cssnano":o.push(["cssnano","^6"])}}))}d({feature:{name:"css",packages:o},features:a,packageDevDependencies:t})}async function D({atom:e,setProgress:n,context:o,packageDependencies:r}){if(!0!==e.doc.features.app.enabled)return;await n({message:"Creating app folder"});const c={atom:e,packageDependencies:r,ts:Date.now()},i=o.templateDir,p=t.resolve(o.projectDir,"src/app");s.existsSync(p)||s.mkdirSync(p,{recursive:!0});let l=["index.js.njk"];!1!==e.doc.features.app.html&&l.push("index.html.njk"),await a({pattern:l,dir:t.resolve(i,"src/app"),outDir:p,context:c})}async function h({projectDir:e,name:a,setProgress:n,count:o=1}){let i;const p=c(["npm-pick-versions",a,o]),l=t.join(e,".cache"),u=t.join(l,p+".json");return s.existsSync(u)?(n&&n(`Picking npm version of ${a} from cache ...`),i=JSON.parse(s.readFileSync(u,"utf8"))):(n&&n(`Picking npm version of ${a} ...`),i=await r({name:a,count:o}),s.mkdirSync(l,{recursive:!0}),s.writeFileSync(u,JSON.stringify(i),"utf8")),i}async function w({atom:e,context:a,packageDependencies:r,packageDevDependencies:c,setProgress:i}){await i({message:"Creating package.json."});r.filter((e=>!0===e.dev)).forEach((e=>{c.find((s=>s.package===e.package))||c.push(e);const s=r.findIndex((s=>s.package===e.package));r.splice(s,1)}));const p=r.find((e=>"react"===e.package)),l=r.find((e=>"react-dom"===e.package));p&&!l?r.push({package:"react-dom",version:p.version}):p&&l&&(l.version=p.version),p&&e.doc.features.react_version>=17&&(r.find((e=>"@emotion/react"===e.package))||r.push({package:"@emotion/react",version:"^11"}),r.find((e=>"@emotion/styled"===e.package))||r.push({package:"@emotion/styled",version:"^11"}));const u=[];!0===e.doc.features.app.enabled&&u.push({file:t.resolve(a.projectDir,"src/app/index.js"),dev:!1!==e.doc.features.app.dev}),!0===e.doc.features.cli.enabled&&u.push({file:t.resolve(a.projectDir,"src/cli/index.js"),dev:!1!==e.doc.features.cli.dev});for await(const e of u){const t=e.file;if(!s.existsSync(t))throw new Error(`App file not found: ${t}`);const n=(await o({file:t,recursive:!0})).all;for await(const s of n){if("npm"!==s.type)continue;if(r.find((e=>e.package===s.package)))continue;if(c.find((e=>e.package===s.package)))continue;const t=await h({name:s.package,projectDir:a.projectDir,setProgress:i});(!0===e.dev?c:r).push({package:s.package,subpath:s.subpath,version:t.minorRange,type:"npm"})}}const f={atom:e,packageDependencies:r,packageDevDependencies:c},d=a.templateDir,m=n.compile(s.readFileSync(t.resolve(d,"package.json.njk"),"utf8"),n.configure(d)).render(f),g=a.projectDir,k=t.resolve(g,"package.json");s.writeFileSync(k,m,"utf8");const j=t.resolve(a.project.projectDir,"fnet");if(s.existsSync(j)){const e=t.resolve(a.projectDir,"fnet");s.existsSync(e)||s.mkdirSync(e);const n=s.readdirSync(j);for(const a of n){const n=t.resolve(j,a);if(!s.lstatSync(n).isFile())continue;const o=t.resolve(e,a);s.copyFileSync(n,o)}}}async function y({atom:e,setProgress:n,context:o,packageDependencies:r}){if(!0!==e.doc.features.cli.enabled)return;await n({message:"Creating cli."});const c={atom:e,packageDependencies:r},i=o.templateDir,p=t.resolve(o.projectDir,"src/cli");s.existsSync(p)||s.mkdirSync(p,{recursive:!0}),await a({pattern:["index.js.njk"],dir:t.resolve(i,"src/cli"),outDir:p,context:c})}async function b({atom:e,setProgress:a,context:o,njEnv:r}){if(!0!==e.doc.features.cli.enabled)return;await a({message:"Creating input args."});let c={};if(c=e.doc.input?e.doc.input:{type:"object",properties:{},required:[]},e.doc.features.cli.fargs&&!1!==e.doc.features.cli.fargs?.enabled){const s=e.doc.features.cli.fargs;Reflect.has(s,"default")&&s.default}const u={imports:[],atom:e},f=o.templateDir,d=n.compile(s.readFileSync(t.resolve(f,"src/default/input.args.js.njk"),"utf8"),r).render(u),m=o.projectDir,g=t.resolve(m,"src/default/input.args.js");s.writeFileSync(g,d,"utf8");const k=new i({allErrors:!0,useDefaults:!0,formats:{},strict:!1,code:{esm:!0,lines:!0,optimize:!1,source:!0}});l(k);const j=k.compile(c),v=p(k,j)+"\nexport { schema31 as schema };";s.writeFileSync(t.resolve(m,"src/default/validate_input.js"),v,"utf8")}async function x({atom:e,setProgress:a,context:o,packageDependencies:r}){await a({message:"Creating tsconfig.json."});const c={atom:e,packageDependencies:r},i=o.templateDir,p=n.compile(s.readFileSync(t.resolve(i,"tsconfig.json.njk"),"utf8"),n.configure(i)).render(c),l=o.projectDir,u=t.resolve(l,"tsconfig.json");s.writeFileSync(u,p,"utf8")}async function S({setProgress:e,context:s}){const a=s.projectDir;await e({message:"Prettifiying source files."});let n=t.join("src","**","*");if(f("bun")){const e=await u(`prettier --write ${n} *.{js,cjs,mjs,json,yaml,html} --no-error-on-unmatched-pattern`,{cwd:a});if(0!==e.code)throw new Error(e.stderr)}else{const e=await u(`prettier --write ${n} *.{js,cjs,mjs,json,yaml,html} --no-error-on-unmatched-pattern`,{cwd:a});if(0!==e.code)throw new Error(e.stderr)}}async function E({setProgress:e,atom:s,context:t}){const a=t.projectDir;if(await e({message:"Installing npm packages."}),f("bun")){if(0!==(await u(`bun install ${s.doc.features.npm_install_flags}`,{cwd:a})).code)throw new Error("Couldnt install npm packages.")}else{if(0!==(await u(`npm install ${s.doc.features.npm_install_flags}`,{cwd:a})).code)throw new Error("Couldnt install npm packages.")}}async function P({setProgress:e,context:s}){const t=s.projectDir;if(await e({message:"Building main project."}),f("bun")){if(0!==(await u(s.dev?"bun run build:dev":"bun run build",{cwd:t})).code)throw new Error("Couldnt build project.")}else{if(0!==(await u(s.dev?"npm run build:dev":"npm run build",{cwd:t})).code)throw new Error("Couldnt build project.")}}export{j as a,k as b,m as c,g as d,x as e,d as f,b as g,y as h,v as i,D as j,w as k,S as l,E as m,h as p,P as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"node:fs";import t from"node:path";import a from"nunjucks";import s from"@flownet/lib-parse-imports-js";import o from"@flownet/lib-parse-node-url";import{B as i,c as r,a as n}from"./index.BTXKZRR5.js";import p from"lodash.merge";import{f as l,i as c,a as d,b as u,c as f,d as b,p as m,e as g,g as h,h as _,j as y,k as w,l as x,m as v,r as k}from"./index.BqI7rTjk.js";import j from"@fnet/npm-list-versions";import D from"@fnet/shelljs";import"node:crypto";import"yaml";import"chalk";import"@flownet/lib-atom-api-js";import"@fnet/config";import"@fnet/list-files";import"redis";import"@flownet/lib-is-redis-online";import"@fnet/yaml";import"@flownet/lib-render-templates-dir";import"@fnet/npm-pick-versions";import"object-hash";import"ajv/dist/2020.js";import"ajv/dist/standalone/index.js";import"ajv-formats";import"./index.js";import"yargs";import"node:util";import"tree-kill";import"node:url";import"node:child_process";import"node:os";import"@fnet/prompt";function C({dir:a,name:s="index"}){let o=t.resolve(a,`./${s}.tsx`);if(e.existsSync(o)||(o=t.resolve(a,`./${s}.ts`)),e.existsSync(o)||(o=t.resolve(a,`./${s}.jsx`)),e.existsSync(o)||(o=t.resolve(a,`./${s}.js`)),!e.existsSync(o))return{};const i=o,r=t.extname(o);return{file:i,ext:r,ts:".ts"===r||".tsx"===r,name:s}}async function S(e){const{atom:a,context:o,setProgress:i}=e;i("Initializing features..."),a.doc.features=a.doc.features||{};const r=a.doc.features;r.project=r.project||{},r.project.format=r.project.format||r.project_format||"esm",r.project_format=r.project.format,r.dts_enabled=!0===r.dts||void 0!==r.dts&&!1!==r.dts;const n=t.resolve(o.project.projectDir),m=C({dir:t.resolve(n,"./app")});if(m.file){i("Parsing app entry imports...");let e=await s({file:m.file,recursive:!0}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.app_uses_jsx=t,r.app_has_entry=!0,e=await s({file:m.file}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.app_entry_uses_jsx=t,r.app_entry_is_ts=m.ts,r.app_entry_ext=m.ext}const g=C({dir:t.resolve(n,"./cli")});if(g.file){i("Parsing cli entry imports...");let e=await s({file:g.file,recursive:!0}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.cli_uses_jsx=t,r.cli_has_entry=!0,e=await s({file:g.file}),t=e.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.cli_entry_uses_jsx=t,r.cli_entry_is_ts=g.ts,r.cli_entry_ext=g.ext}if("workflow.lib"===a.type){const e=C({dir:t.resolve(n,"./src")});if(e.file){i("Parsing src entry imports...");let t=await s({file:e.file,recursive:!0}),a=t.all.some((e=>!0===e.usesJSX&&"local"===e.type));r.src_uses_jsx=a,r.src_has_entry=!0,t=await s({file:e.file}),a=t.all.some((e=>!0===e.usesJSX&&"local"===e.type)),r.src_entry_uses_jsx=a,r.src_entry_is_ts=e.ts,r.src_entry_ext=e.ext}}const h=Reflect.has(r,"app_entry_uses_jsx")?!0===r.app_entry_uses_jsx:!0===r.src_entry_uses_jsx,_=Reflect.has(r,"cli_entry_uses_jsx")?!0===r.cli_entry_uses_jsx:!0===r.src_entry_uses_jsx;r.form_enabled=h||_||!0===r.form||!0===r.form?.enabled,r.multiple_enabled=r.multiple_enabled||!0===r.multiple||!0===r.multiple?.enabled,!1===r.app?r.app={enabled:!1}:!0===r.app?r.app={enabled:!0,extend:!0===r.app_has_entry,export:!0,react:h}:r.app={enabled:!0,extend:!0===r.app_has_entry,export:!0,react:h,...r.app||{}},r.app.enabled=!0===r.app.enabled&&(!0===a.doc.features.form_enabled||!0===r.app.extend||!0===r.app.enabled),r.app.format=r.app.format||"esm",r.app.folder=r.app.folder||r.app.format||"default",!1===r.cli?r.cli={enabled:!1}:!0===r.cli?r.cli={enabled:!0,extend:!0===r.cli_has_entry,export:!0,react:_}:r.cli={enabled:!0,extend:!0===r.cli_has_entry,export:!0,react:_,...r.cli||{}},r.cli.enabled=!0===r.cli.enabled&&(!1===a.doc.features.form_enabled||!0===r.cli.extend||!0===r.cli.enabled),r.cli.format=r.cli.format||"esm",r.cli.folder=r.cli.folder||r.cli.folder||"esm",r.cli.node_options=r.cli.node?.options||r.cli.node_options||"",r.cli.bin=r.cli.bin||a.doc.name,r.cli.installable=!0===r.cli.installable,r.cli.enabled&&(a.doc["npm::bin"]=r.cli.bin,console.log(`Setting npm::bin to ${r.cli.bin} from features.cli.bin`)),r.json=r.cli.enabled||r.json;const y={cjs:{format:"cjs",context:r.form_enabled?"window":"global",babel:!0===r.src_uses_jsx||!1,browser:!1,replace:!0,terser:!0,enabled:!1!==r.cjs,copy:!1},esm:{format:"esm",context:r.form_enabled?"window":"global",babel:!0===r.src_uses_jsx||!1,browser:!1,replace:!0,terser:!1,enabled:!1!==r.esm,copy:!0},iife:{format:"iife",context:r.form_enabled?"window":"global",babel:!0,browser:!0,replace:!0,enabled:!0===r.iife,terser:!0,copy:!1}};!0===r.webos&&(y.webos={format:"iife",browser:!0,babel:!0,context:"window",replace:!0,terser:!0,input:"./src/app/index.js",output_dir:"./dist/app/webos",copy:!1,babel_options:{targets:{chrome:"79"}}}),!0===r.electron&&(y.electron={format:"iife",browser:!0,babel:!0,context:"window",replace:!0,terser:!0,copy:!1,input:"./src/app/index.js",output_dir:"./dist/app/electron"}),!0===r.nextjs&&(y.nextjs={format:"esm",browser:!0,babel:!0,context:"window",replace:!0,terser:!0,copy:!1,input:"./src/app/index.js",output_dir:"./dist/app/nextjs"}),!0===r.ios&&(y.ios={format:"iife",browser:!0,babel:!0,context:"window",replace:!0,terser:!0,copy:!1,input:"./src/app/index.js",output_dir:"./dist/app/ios"}),!0===r.macos&&(y.macos={format:"iife",browser:!0,babel:!0,context:"window",replace:!0,terser:!0,copy:!1,input:"./src/app/index.js",output_dir:"./dist/app/macos"}),!0===r.app.enabled&&(r.app.dir=`./dist/app/${r.app.folder}`,r.app.output={file:`./dist/app/${r.app.folder}/index.js`,dir:`./dist/app/${r.app.folder}/`,...r.app.output||{}},r.app.input={file:"./src/app/index.js",dir:"./src/app/",...r.app.input||{}},y.app={format:r.app.format,browser:!0,babel:!0,context:"window",replace:!0,input:r.app.input.file,output_dir:r.app.dir,terser:!0,output_exports:!1===r.app.export?"none":"auto",browsersync:!0}),!0===r.cli.enabled&&(r.cli.dir=`./dist/cli/${r.cli.folder}`,r.cli.output={file:`./dist/cli/${r.cli.folder}/index.js`,dir:`./dist/cli/${r.cli.folder}/`,...r.cli.output||{}},r.cli.input={file:"./src/cli/index.js",dir:"./src/cli/",...r.cli.input||{}},y.cli={format:r.cli.format,context:"global",babel:!0===r.src_uses_jsx||!0===r.cli_uses_jsx||!1,browser:!1,replace:!0,enabled:!0,input:r.cli.input.file,output_dir:r.cli.dir,banner:"#!/usr/bin/env node",terser:!0,output_exports:!1===r.cli.export?"none":"auto"});const w={server:".",startPath:`${t.normalize(r.app.dir||".")}`,files:[t.normalize("./dist/**/*")],cors:!0,open:!1};r.babel_options=p({targets:{browsers:"last 9 versions, not dead",node:"18"}},r.babel_options||r.babel?.options),r.browsersync_options=p(w,r.browsersync_options||r.browsersync?.options||{}),r.replace_options=p({},r.replace_options||r.replace?.options||{}),Reflect.has(r.browsersync_options,"proxy")&&delete r.browsersync_options.server,r.rollup=r.rollup||{},r.rollup_output=p(y,r.rollup_output||r.rollup?.output||{}),r.preact_enabled=!0===r.preact||r.preact&&!1!==r.preact?.enabled;let x=Object.keys(y);for(const e of x){const t=y[e];t&&(!1!==r.rollup[e]?(t.babel_options=t.babel_options||r.babel_options,t.browsersync_options=p(r.browsersync_options,t.browsersync_options),t.replace_options=p(r.replace_options,t.replace_options),r.preact_enabled&&(t.alias_enabled=!0,t.alias=t.alias||{},t.alias.entries=t.alias.entries||{},t.alias.entries.react="preact/compat",t.alias.entries["react-dom"]="preact/compat"),(r.form_enabled||r.babel)&&(t.babel=!0)):delete r.rollup_output[e])}x=Object.keys(r.rollup_output),r.babel_enabled=x.some((e=>!0===r.rollup_output[e].babel)),r.browser_enabled=x.some((e=>!0===r.rollup_output[e].babel)),r.browsersync_enabled=!1!==r.browsersync&&x.some((e=>!0===r.rollup_output[e].browsersync)),r.browsersync_enabled=r.browsersync_enabled&&r.app.enabled,r.dependency_auto_enabled=!1!==r.dependency_auto&&!1!==r.dependency_auto?.enabled,r.npm_install_flags=r.npm_install_flags||"",r.react_version=r.react_version||r.react?.version||18,c(e),d(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"wasm",packages:[["@rollup/plugin-wasm","^6"]]},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"terser",packages:[["@rollup/plugin-terser","^0.4"]]},features:s,packageDevDependencies:a})}(e),u(e),f(e),b(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"analyzer",packages:[["rollup-plugin-analyzer","^3"]],options:{summaryOnly:!0,limit:12},explicit:!0},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"visualizer",packages:[["rollup-plugin-visualizer","^5"]]},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"polyfill",packages:[["rollup-plugin-node-polyfills","^0.2"]]},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"nunjucks",packages:[["@fnet/rollup-plugin-nunjucks","0.1.8"]]},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"workbox",packages:[["rollup-plugin-workbox","^8"]],options:{generate:{swDest:"dist/app/esm/sw.js",globDirectory:"dist/app/esm",globPatterns:["**/*.{html,js,css,png,jpg}"],skipWaiting:!0,clientsClaim:!0}},explicit:!0},features:s,packageDevDependencies:a})}(e),function(e){const{atom:t,packageDevDependencies:a}=e,s=t.doc.features;l({feature:{name:"gzip",packages:[["rollup-plugin-gzip","^4"]],explicit:!0},features:s,packageDevDependencies:a})}(e)}class $ extends i{async initRuntime(){await S(this.apiContext),await async function({atom:e,packageDependencies:t,packageDevDependencies:a,setProgress:s}){s("Initializing dependencies");const o=e.doc.dependencies||[];if(o.filter((e=>!e.dev)).forEach((e=>t.push(e))),o.filter((e=>e.dev)).forEach((e=>a.push(e))),"workflow"===e.type&&(t.push({package:"get-value",version:"^3"}),t.push({package:"set-value",version:"^4"})),e.doc.features.form_enabled&&e.doc.features.dependency_auto_enabled){let a="^18.2";s("Fetching React versions"),a=`^${(await j({name:"react",groupBy:{major:!0}})).find((t=>t[0]===e.doc.features.react_version.toString()))[0]}`,t.push({package:"react",version:a}),t.push({package:"react-dom",version:a}),"workflow"===e.type&&(t.push({package:"@fnet/react-app",version:"^0.1"}),t.push({package:"@fnet/react-app-state",version:"^0.1"}))}e.doc.features.preact_enabled&&t.push({package:"preact",version:"^10"}),!0===e.doc.features.cli.enabled&&(t.push({package:"@fnet/args",version:"^0.1"}),t.push({package:"yargs-parser",version:"^22.0"}),e.doc.features.cli.fargs&&!1!==e.doc.features.cli.fargs?.enabled&&t.push({package:"@fnet/config",version:"0.2.21"}),e.doc.features.cli.mcp&&!0===e.doc.features.cli.mcp.enabled&&(t.push({package:"@modelcontextprotocol/sdk",version:"^1.10"}),t.push({package:"express",version:"^4.18"}))),e.doc.features.render&&!1!==e.doc.features.render.enabled&&a.push({package:"@flownet/lib-render-templates-dir",version:"0.1.19"}),a.push({package:"@babel/core",version:"^7"}),a.push({package:"@rollup/plugin-commonjs",version:"^28"}),a.push({package:"@rollup/plugin-node-resolve",version:"^16"}),a.push({package:"@rollup/plugin-replace",version:"^6"}),a.push({package:"rollup",version:"^4"}),e.doc.features.dts_enabled&&a.push({package:"rollup-plugin-dts",version:"^6"}),a.push({package:"rollup-plugin-peer-deps-external",version:"^2"}),a.push({package:"@rollup/plugin-alias",version:"^5"}),a.push({package:"fs-extra",version:"^11"}),e.doc.features.babel_enabled&&(a.push({package:"@rollup/plugin-babel",version:"^6"}),a.push({package:"@babel/preset-env",version:"^7"}),a.push({package:"@babel/preset-react",version:"^7"}),e.doc.features.babel?.options?.plugins?.forEach((e=>{switch(e[0]){case"@babel/plugin-proposal-decorators":a.push({package:"@babel/plugin-proposal-decorators",version:"^7"});break;case"@babel/plugin-proposal-class-properties":a.push({package:"@babel/plugin-proposal-class-properties",version:"^7"});break;case"@babel/plugin-proposal-private-methods":a.push({package:"@babel/plugin-proposal-private-methods",version:"^7"});break;case"@babel/plugin-proposal-private-property-in-object":a.push({package:"@babel/plugin-proposal-private-property-in-object",version:"^7"});break;case"@babel/plugin-proposal-optional-chaining":a.push({package:"@babel/plugin-proposal-optional-chaining",version:"^7"})}}))),a.push({package:"@fnet/rollup-plugin-delete",version:"0.1.10"}),e.doc.features.browsersync_enabled&&a.push({package:"@fnet/rollup-plugin-browsersync",version:"0.1.11"})}(this.apiContext),await this.initLibraryDir(),await this.initNunjucks(),await this.initLibs()}async initLibs(){this.setProgress({message:"Initializing external libs."});const e=[{name:this.atom.doc.name,type:"atom",parent_id:this.atom.parent_id}];this.libs=e,await this.initAtomLibsAndDeps({libs:e,packageDependencies:this.apiContext.packageDependencies})}async initAtomLibsAndDeps({libs:e,packageDependencies:t}){const a=e.filter((e=>"atom"===e.type));for(let e=0;e<a.length;e++){const s=a[e],o=await this.findAtomLibrary({url:s.name});s.atom=o;const i=o.doc.dependencies?.filter((e=>void 0===e.repo||"npm"===e.repo));i?.forEach((e=>{const a=t.find((t=>t.package===e.package));a?"string"==typeof e.path?(a.path||[]).some((t=>t===e.path))||(a.path=a.path||[],a.path.push(e.path)):Array.isArray(e.path)&&e.path.forEach((e=>{(a.path||[]).some((t=>t===e))||(a.path=a.path||[],a.path.push(e))})):t.push(e)}))}t.sort(((e,t)=>e.package?.localeCompare(t.package)))}async findAtomLibrary({url:e}){const a=o({url:e});if(!a)throw new Error(`Invalid package name: ${e}`);if(a.protocol||(a.protocol=this.context.protocol),"ac:"===a.protocol){const t=a.pathname.split("/");if(1===t.length)return await this.apiContext.Atom.first({where:{name:e,parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"workflow.lib"}});if(2===t.length){const e=await this.apiContext.Atom.first({where:{name:t[0],parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"folder"}});return await this.apiContext.Atom.first({where:{name:t[1],parent_id:e.id,type:"workflow.lib"}})}}else if("local:"===a.protocol){const e=this.atom;e.protocol="local:",e.doc.dependencies=e.doc.dependencies||[],e.name=e.doc.name;const a=t.resolve(this.context.projectSrcDir,"index.js"),o=await s({file:a,recursive:!0}),i=e.doc.dependencies,r=o.all;for await(const e of r){if("npm"!==e.type)continue;if(i.find((t=>t.package===e.package)))continue;const t=await m({name:e.package,projectDir:this.context.projectDir,setProgress:this.apiContext.setProgress});i.push({package:e.package,subpath:e.subpath,version:t.minorRange,type:"npm"})}return e}}async createAtomLibFiles({libs:a}){await this.setProgress({message:"Creating external lib files."}),this.atom.typesDir="./types";const s=a.filter((e=>"atom"===e.type));for(let a=0;a<s.length;a++){const o=s[a].atom,i=this.context.projectDir;if("local:"===o.protocol){const a=t.resolve(this.context.projectSrcDir,`${o.fileName||o.name}.js`),s=t.relative(t.join(this.context.projectDir,"src","default"),a);if(!e.existsSync(a)){e.mkdirSync(t.dirname(a),{recursive:!0});let s="export default async (input)=>{\n";s+="}",e.writeFileSync(a,s,"utf8")}o.relativePath=s.split(t.sep).join("/"),this.atom.typesDir=`./types/${t.basename(i)}/src`}else{const a=t.join(i,"src","libs",`${o.id}.js`),s=o.doc.contents?.find((e=>"esm"===e.format))||o.doc;e.writeFileSync(a,s.content,"utf8")}}}async createEngine(){await this.setProgress({message:"Creating engine file."});const s={libs:this.libs.filter((e=>"atom"===e.type)),libraryAtom:this.atom,atom:this.atom},o=this.context.templateDir,i=a.compile(e.readFileSync(t.resolve(o,t.join("src","default","engine.js.njk")),"utf8"),this.apiContext.njEnv).render(s),r=this.context.projectDir,n=t.resolve(r,t.join("src","default","index.js"));e.writeFileSync(n,i,"utf8")}async build(){try{this.fileMode&&(await this.createAtomLibFiles({libs:this.libs}),await this.createEngine(),await this.createProjectYaml(),await r(this.apiContext),await g(this.apiContext),await n(this.apiContext),await h(this.apiContext),await _(this.apiContext),await y(this.apiContext),await async function({atom:o,setProgress:i,context:r,packageDependencies:n}){await i({message:"Creating rollup file."});const p={atom:o,packageDependencies:n},l=t.resolve(r.projectDir,"src","default/index.js");if(!e.existsSync(l))throw new Error(`Entry file not found: ${l}`);const c=(await s({file:l,recursive:!0})).all.filter((e=>"node"===e.type)).map((e=>e.path)),d=o.doc.features.rollup_output,u=Object.keys(d);for(let e=0;e<u.length;e++){const t=d[u[e]];if(!0===t.browser&&c.length>0){t.globals_enabled=!0,t.globals=t.globals||[],t.globals=t.globals.concat(c.map((e=>({key:e,value:e})))),t.alias_enabled=!0,t.alias=t.alias||{},t.alias.entries=t.alias.entries||{};for(let e=0;e<c.length;e++){const a=c[e];t.alias.entries[a]=`node:${a}`,t.alias.entries[`node:${a}`]=a}t.external_enabled=!0,t.external=t.external||[],t.external=t.external.concat(c)}}const f=r.templateDir;let b=a.compile(e.readFileSync(t.resolve(f,"rollup.config.mjs.njk"),"utf8"),a.configure(f)).render(p);const m=r.projectDir;let g=t.resolve(m,"rollup.config.mjs");e.writeFileSync(g,b,"utf8")}(this.apiContext),await w(this.apiContext),await x(this.apiContext),await async function({atom:e,setProgress:t,context:a}){if(!e.doc.features.dts_enabled)return;const s=a.projectDir;if(await t({message:"Creating .d.ts"}),0!==(await D("tsc",{cwd:s})).code)throw new Error("Couldnt create .d.ts files.")}(this.apiContext),this.buildMode&&(await v(this.apiContext),await k(this.apiContext),this.deployMode&&await this.deploy())),await this._cache_set(this.buildKey,{status:"COMPLETED"})}catch(e){throw await this._cache_set(this.buildKey,{status:"FAILED",message:e.message||e}),console.log(e),e}}}export{$ as default};
|
|
@@ -1,93 +0,0 @@
|
|
|
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
|
-
"flownet": {
|
|
48
|
-
"type": "node",
|
|
49
|
-
},
|
|
50
|
-
{% if atom.doc.repo.url %}
|
|
51
|
-
"repository": {
|
|
52
|
-
"type": "{{atom.doc.repo.type or 'git'}}",
|
|
53
|
-
"url": "{{atom.doc.repo.url}}"
|
|
54
|
-
},
|
|
55
|
-
{% endif %}
|
|
56
|
-
"license": "{{atom.doc.license or 'MIT'}}",
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "bun ./build.js",
|
|
59
|
-
"watch": "bun --watch --watch-mode=poll --watch-ignore-dirs=node_modules,dist --watch-paths=./src ./build.js",
|
|
60
|
-
"serve": "bunx serve ./"
|
|
61
|
-
{% if atom.doc.features.cli.enabled %}
|
|
62
|
-
{% if atom.doc.features.project.format ==='cjs' %}
|
|
63
|
-
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
|
|
64
|
-
{% else %}
|
|
65
|
-
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/"
|
|
66
|
-
{% endif %}
|
|
67
|
-
,"compile": "fbin compile {{atom.doc.features.cli.dir}}/index.js -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}}"
|
|
68
|
-
,"install-bin": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
69
|
-
{% endif %}
|
|
70
|
-
{% if atom.doc.features.app.enabled %}
|
|
71
|
-
,"app": "bun {{atom.doc.features.app.dir}}/index.html"
|
|
72
|
-
{% endif %}
|
|
73
|
-
},
|
|
74
|
-
"devDependencies": {
|
|
75
|
-
{% for dep in packageDevDependencies %}
|
|
76
|
-
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
77
|
-
{% endfor%}
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
{% for dep in packageDependencies %}
|
|
81
|
-
"{{dep.package}}":"{{dep.version}}" {% if not loop.last%},{%endif%}
|
|
82
|
-
{% endfor%}
|
|
83
|
-
}
|
|
84
|
-
{% if atom.doc.features.cli.enabled and atom.doc['npm::bin'] %}
|
|
85
|
-
,"bin":{
|
|
86
|
-
{% if atom.doc.features.project.format ==='cjs' %}
|
|
87
|
-
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.cjs"
|
|
88
|
-
{% else %}
|
|
89
|
-
"{{atom.doc['npm::bin']}}":"{{atom.doc.features.cli.dir}}/index.js"
|
|
90
|
-
{% endif %}
|
|
91
|
-
}
|
|
92
|
-
{% endif %}
|
|
93
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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 %}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{% if not atom.doc.features.react_version or atom.doc.features.react_version > 17 %}
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { createRoot } from 'react-dom/client';
|
|
4
|
-
{% else %}
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
{% endif %}
|
|
8
|
-
|
|
9
|
-
{% if atom.doc.features.react_app_state_enabled===true %}
|
|
10
|
-
import { Provider } from "@fnet/react-app-state";
|
|
11
|
-
{% endif%}
|
|
12
|
-
|
|
13
|
-
{% if atom.doc.features.app.extend===true %}
|
|
14
|
-
import Library from '../../../app';
|
|
15
|
-
{% elif atom.doc.features.multiple===true %}
|
|
16
|
-
const Library = React.Fragment;
|
|
17
|
-
{% else %}
|
|
18
|
-
import Library from '../../../src';
|
|
19
|
-
{% endif%}
|
|
20
|
-
|
|
21
|
-
export default function App(props) {
|
|
22
|
-
return (
|
|
23
|
-
{% if atom.doc.features.react_app_state_enabled===true %}
|
|
24
|
-
<Provider>
|
|
25
|
-
{% endif %}
|
|
26
|
-
<Library {...props} />
|
|
27
|
-
{% if atom.doc.features.react_app_state_enabled===true %}
|
|
28
|
-
</Provider>
|
|
29
|
-
{% endif %}
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
{% if not atom.doc.features.react_version or atom.doc.features.react_version > 17 %}
|
|
34
|
-
const createApp = ({ container }) => {
|
|
35
|
-
return (props) => {
|
|
36
|
-
const root = createRoot(container);
|
|
37
|
-
root.render(<App {...props} />);
|
|
38
|
-
return ()=> root.unmount();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
{% else %}
|
|
42
|
-
const createApp = ({ container }) => {
|
|
43
|
-
return (props) => {
|
|
44
|
-
ReactDOM.render(<App {...props} />, container);
|
|
45
|
-
return () => ReactDOM.unmountComponentAtNode(container);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
{% endif %}
|
|
49
|
-
|
|
50
|
-
export { createApp };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{% if atom.doc.features.app.export===true %}
|
|
2
|
-
{% if atom.doc.features.app.extend===true %}
|
|
3
|
-
import init from '../../../app';
|
|
4
|
-
const createApp = ({ container }) => {
|
|
5
|
-
return init({container});
|
|
6
|
-
};
|
|
7
|
-
export { createApp };
|
|
8
|
-
{% else %}
|
|
9
|
-
import Node from "../default";
|
|
10
|
-
const createApp = ({ container }) => {
|
|
11
|
-
return (props) => Node({ ...props, container });
|
|
12
|
-
};
|
|
13
|
-
export { createApp };
|
|
14
|
-
{% endif %}
|
|
15
|
-
{% else %}
|
|
16
|
-
{% if atom.doc.features.app.extend===true %}
|
|
17
|
-
import run from '../../../app';
|
|
18
|
-
run();
|
|
19
|
-
{% else %}
|
|
20
|
-
import Node from "../default";
|
|
21
|
-
Node();
|
|
22
|
-
{% endif %}
|
|
23
|
-
{% endif %}
|