@pulse-editor/cli 0.1.1-beta.6 → 0.1.1-beta.7
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/components/commands/preview copy.d.ts +5 -0
- package/dist/components/commands/preview copy.js +14 -0
- package/dist/components/commands/start copy.d.ts +5 -0
- package/dist/components/commands/start copy.js +14 -0
- package/dist/lib/deps.d.ts +1 -0
- package/dist/lib/deps.js +5 -0
- package/dist/lib/node_module_bin.d.ts +1 -0
- package/dist/lib/node_module_bin.js +7 -0
- package/dist/lib/server/express.js +6 -6
- package/dist/lib/server/preview/backend/load-remote.cjs +23 -23
- package/dist/lib/server/preview/frontend/index.html +11 -11
- package/package.json +6 -6
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
export default function Preview({ cli }) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
// Start dev server
|
|
8
|
+
execa('npm run preview', {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
shell: true,
|
|
11
|
+
});
|
|
12
|
+
}, []);
|
|
13
|
+
return (_jsx(_Fragment, { children: _jsx(Text, { children: "Starting preview server..." }) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
export default function Start({ cli }) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
// Start dev server
|
|
8
|
+
execa('npm run start', {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
shell: true,
|
|
11
|
+
});
|
|
12
|
+
}, []);
|
|
13
|
+
return (_jsx(_Fragment, { children: _jsx(Text, { children: "Starting prod server..." }) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDepsBinPath(name: string): string;
|
package/dist/lib/deps.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Get deps bin at node_modules/@pulse-editor/cli/node_modules
|
|
2
|
+
export function getDepsBinPath(name) {
|
|
3
|
+
const workingDir = process.cwd();
|
|
4
|
+
return `${workingDir}/node_modules/@pulse-editor/cli/node_modules/.bin/${process.platform === 'win32' ? `${name}.cmd` : name}`;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bin(name: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = path.dirname(__filename);
|
|
5
|
+
export function bin(name) {
|
|
6
|
+
return path.join(__dirname, 'node_modules', '.bin', process.platform === 'win32' ? `${name}.cmd` : name);
|
|
7
|
+
}
|
|
@@ -94,12 +94,12 @@ else {
|
|
|
94
94
|
/* Production mode */
|
|
95
95
|
app.use(`/${pulseConfig.id}/${pulseConfig.version}`, express.static('dist'));
|
|
96
96
|
app.listen(3030, '0.0.0.0', () => {
|
|
97
|
-
console.log(`\
|
|
98
|
-
🎉 Your Pulse extension \x1b[1m${pulseConfig.displayName}\x1b[0m is LIVE!
|
|
99
|
-
|
|
100
|
-
⚡️ Local: http://localhost:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
101
|
-
⚡️ Network: http://${getLocalNetworkIP()}:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
102
|
-
|
|
97
|
+
console.log(`\
|
|
98
|
+
🎉 Your Pulse extension \x1b[1m${pulseConfig.displayName}\x1b[0m is LIVE!
|
|
99
|
+
|
|
100
|
+
⚡️ Local: http://localhost:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
101
|
+
⚡️ Network: http://${getLocalNetworkIP()}:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
102
|
+
|
|
103
103
|
✨ Try it out in the Pulse Editor and let the magic happen! 🚀`);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const { createInstance } = require("@module-federation/runtime");
|
|
2
|
-
|
|
3
|
-
async function loadAndCall(func, req, appId, origin, version) {
|
|
4
|
-
// here we assign the return value of the init() function, which can be used to do some more complex
|
|
5
|
-
// things with the module federation runtime
|
|
6
|
-
const instance = createInstance({
|
|
7
|
-
name: "server_function_runner",
|
|
8
|
-
remotes: [
|
|
9
|
-
{
|
|
10
|
-
name: appId + "_server",
|
|
11
|
-
entry: `${origin}/${appId}/${version}/server/remoteEntry.js`,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const loadedFunc = (await instance.loadRemote(`${appId}_server/${func}`))
|
|
17
|
-
.default;
|
|
18
|
-
|
|
19
|
-
const res = await loadedFunc(req);
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = { loadAndCall };
|
|
1
|
+
const { createInstance } = require("@module-federation/runtime");
|
|
2
|
+
|
|
3
|
+
async function loadAndCall(func, req, appId, origin, version) {
|
|
4
|
+
// here we assign the return value of the init() function, which can be used to do some more complex
|
|
5
|
+
// things with the module federation runtime
|
|
6
|
+
const instance = createInstance({
|
|
7
|
+
name: "server_function_runner",
|
|
8
|
+
remotes: [
|
|
9
|
+
{
|
|
10
|
+
name: appId + "_server",
|
|
11
|
+
entry: `${origin}/${appId}/${version}/server/remoteEntry.js`,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const loadedFunc = (await instance.loadRemote(`${appId}_server/${func}`))
|
|
17
|
+
.default;
|
|
18
|
+
|
|
19
|
+
const res = await loadedFunc(req);
|
|
20
|
+
return res;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { loadAndCall };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Pulse App</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body style="height: 100vh; width: 100vw">
|
|
9
|
-
<div id="root" style="height: 100%; width: 100%"></div>
|
|
10
|
-
</body>
|
|
11
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Pulse App</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body style="height: 100vh; width: 100vw">
|
|
9
|
+
<div id="root" style="height: 100%; width: 100%"></div>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-editor/cli",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pulse": "dist/cli.js"
|
|
@@ -19,9 +19,6 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@module-federation/enhanced": "0.19.1",
|
|
23
|
-
"@module-federation/node": "2.7.17",
|
|
24
|
-
"@module-federation/runtime": "0.19.1",
|
|
25
22
|
"concurrently": "^9.2.1",
|
|
26
23
|
"connect-livereload": "^0.6.1",
|
|
27
24
|
"cors": "^2.8.5",
|
|
@@ -42,12 +39,15 @@
|
|
|
42
39
|
"tsx": "^4.20.6"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
42
|
+
"@module-federation/enhanced": "0.21.4",
|
|
43
|
+
"@module-federation/node": "2.7.23",
|
|
44
|
+
"@module-federation/runtime": "0.21.4",
|
|
45
45
|
"@sindresorhus/tsconfig": "^8.1.0",
|
|
46
46
|
"@types/connect-livereload": "^0.6.3",
|
|
47
47
|
"@types/cors": "^2.8.19",
|
|
48
48
|
"@types/express": "^5.0.5",
|
|
49
49
|
"@types/livereload": "^0.9.5",
|
|
50
|
-
"@types/react": "^19.2.
|
|
50
|
+
"@types/react": "^19.2.6",
|
|
51
51
|
"@types/react-dom": "^19.2.3",
|
|
52
52
|
"@vdemedes/prettier-config": "^2.0.1",
|
|
53
53
|
"ava": "^6.4.1",
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"prettier": "@vdemedes/prettier-config"
|
|
81
|
-
}
|
|
81
|
+
}
|