@stackable-labs/cli-app-extension 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +32 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1247,7 +1247,7 @@ const extensions: ExtensionRegistryEntry[] = [
|
|
|
1247
1247
|
{
|
|
1248
1248
|
id: manifest.name.toLowerCase().replace(/\\s+/g, '-'),
|
|
1249
1249
|
manifest,
|
|
1250
|
-
bundleUrl: \`http://localhost:\${import.meta.env.VITE_EXTENSION_PORT || '5173'}\`,
|
|
1250
|
+
bundleUrl: import.meta.env.VITE_EXTENSION_BUNDLE_URL || \`http://localhost:\${import.meta.env.VITE_EXTENSION_PORT || '5173'}\`,
|
|
1251
1251
|
enabled: true,
|
|
1252
1252
|
},
|
|
1253
1253
|
]
|
|
@@ -1297,7 +1297,7 @@ var patchViteAllowedHosts = async (rootDir) => {
|
|
|
1297
1297
|
if (content.includes("allowedHosts")) continue;
|
|
1298
1298
|
const patched = content.replace(
|
|
1299
1299
|
/server:\s*\{/,
|
|
1300
|
-
"server: {\n allowedHosts:
|
|
1300
|
+
"server: {\n allowedHosts: true,"
|
|
1301
1301
|
);
|
|
1302
1302
|
if (patched !== content) {
|
|
1303
1303
|
await writeFile(configPath, patched);
|
|
@@ -1309,7 +1309,7 @@ var rewriteTurboJson = async (rootDir) => {
|
|
|
1309
1309
|
const raw = await readFile(turboPath, "utf8");
|
|
1310
1310
|
const turbo = JSON.parse(raw);
|
|
1311
1311
|
delete turbo["extends"];
|
|
1312
|
-
turbo["globalEnv"] = ["VITE_EXTENSION_PORT", "VITE_PREVIEW_PORT"];
|
|
1312
|
+
turbo["globalEnv"] = ["VITE_EXTENSION_PORT", "VITE_PREVIEW_PORT", "VITE_EXTENSION_BUNDLE_URL"];
|
|
1313
1313
|
await writeFile(turboPath, `${JSON.stringify(turbo, null, 2)}
|
|
1314
1314
|
`);
|
|
1315
1315
|
};
|
|
@@ -1799,6 +1799,18 @@ var readDevContext = async (projectRoot) => {
|
|
|
1799
1799
|
previewPort
|
|
1800
1800
|
};
|
|
1801
1801
|
};
|
|
1802
|
+
var patchProjectEnv = async (projectRoot, key, value) => {
|
|
1803
|
+
const envPath = join3(projectRoot, ".env");
|
|
1804
|
+
const existing = await readEnvFile(envPath);
|
|
1805
|
+
existing[key] = value;
|
|
1806
|
+
await writeEnvFile2(envPath, existing);
|
|
1807
|
+
};
|
|
1808
|
+
var removeProjectEnvKey = async (projectRoot, key) => {
|
|
1809
|
+
const envPath = join3(projectRoot, ".env");
|
|
1810
|
+
const existing = await readEnvFile(envPath);
|
|
1811
|
+
delete existing[key];
|
|
1812
|
+
await writeEnvFile2(envPath, existing);
|
|
1813
|
+
};
|
|
1802
1814
|
var writeDevContext = async (projectRoot, ctx) => {
|
|
1803
1815
|
const env = {
|
|
1804
1816
|
APP_ID: ctx.appId || "",
|
|
@@ -1910,8 +1922,6 @@ var DevDashboard = ({
|
|
|
1910
1922
|
onQuit();
|
|
1911
1923
|
}
|
|
1912
1924
|
});
|
|
1913
|
-
const localPreviewUrl = `http://localhost:${previewPort}`;
|
|
1914
|
-
const previewUrl = tunnelUrl ? `${tunnelUrl.replace(/\/$/, "")}/preview` : localPreviewUrl;
|
|
1915
1925
|
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
|
|
1916
1926
|
/* @__PURE__ */ jsx15(Banner, {}),
|
|
1917
1927
|
/* @__PURE__ */ jsxs15(
|
|
@@ -1940,24 +1950,23 @@ var DevDashboard = ({
|
|
|
1940
1950
|
] })
|
|
1941
1951
|
] }),
|
|
1942
1952
|
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
|
|
1943
|
-
tunnelUrl && /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1944
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel Dev - Preview:" }),
|
|
1945
|
-
/* @__PURE__ */ jsx15(Text15, { children: previewUrl })
|
|
1946
|
-
] }),
|
|
1947
|
-
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1948
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local Dev - Preview:" }),
|
|
1949
|
-
/* @__PURE__ */ jsx15(Text15, { children: localPreviewUrl })
|
|
1950
|
-
] }),
|
|
1951
1953
|
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1952
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Preview:" }),
|
|
1955
|
+
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1956
|
+
"http://localhost:",
|
|
1957
|
+
previewPort
|
|
1958
|
+
] })
|
|
1954
1959
|
] }),
|
|
1955
1960
|
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1956
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local
|
|
1961
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local:" }),
|
|
1957
1962
|
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1958
1963
|
"http://localhost:",
|
|
1959
1964
|
extensionPort
|
|
1960
1965
|
] })
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1968
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel:" }),
|
|
1969
|
+
/* @__PURE__ */ jsx15(Text15, { children: tunnelUrl || "Connecting\u2026" })
|
|
1961
1970
|
] })
|
|
1962
1971
|
] })
|
|
1963
1972
|
]
|
|
@@ -1999,9 +2008,6 @@ var DevApp = ({ options = {} }) => {
|
|
|
1999
2008
|
});
|
|
2000
2009
|
const extensionPort = options.extensionPort ? parseInt(options.extensionPort, 10) : devContext.extensionPort;
|
|
2001
2010
|
await patchViteAllowedHosts(devContext.projectRoot);
|
|
2002
|
-
console.log(`[dev] Starting dev server in ${devContext.projectRoot}`);
|
|
2003
|
-
const serverHandle = startDevServer(devContext.projectRoot);
|
|
2004
|
-
setDevServerHandle(serverHandle);
|
|
2005
2011
|
if (useTunnel) {
|
|
2006
2012
|
try {
|
|
2007
2013
|
console.log(`[dev] Starting tunnel on port ${extensionPort}...`);
|
|
@@ -2009,6 +2015,8 @@ var DevApp = ({ options = {} }) => {
|
|
|
2009
2015
|
console.log(`[dev] Tunnel ready: ${tunnelResult.url}`);
|
|
2010
2016
|
setTunnelHandle(tunnelResult);
|
|
2011
2017
|
setTunnelUrl(tunnelResult.url);
|
|
2018
|
+
console.log(`[dev] Writing VITE_EXTENSION_BUNDLE_URL=${tunnelResult.url} to .env`);
|
|
2019
|
+
await patchProjectEnv(devContext.projectRoot, "VITE_EXTENSION_BUNDLE_URL", tunnelResult.url);
|
|
2012
2020
|
if (useUpdate) {
|
|
2013
2021
|
const originalUrl = `http://localhost:${extensionPort}`;
|
|
2014
2022
|
setOriginalBundleUrl(originalUrl);
|
|
@@ -2025,6 +2033,9 @@ var DevApp = ({ options = {} }) => {
|
|
|
2025
2033
|
} else {
|
|
2026
2034
|
console.log("[dev] Tunnel disabled (--no-tunnel)");
|
|
2027
2035
|
}
|
|
2036
|
+
console.log(`[dev] Starting dev server in ${devContext.projectRoot}`);
|
|
2037
|
+
const serverHandle = startDevServer(devContext.projectRoot);
|
|
2038
|
+
setDevServerHandle(serverHandle);
|
|
2028
2039
|
console.log("[dev] Ready");
|
|
2029
2040
|
setState("running");
|
|
2030
2041
|
}, [devContext, options.extensionPort, useTunnel, useUpdate]);
|
|
@@ -2048,6 +2059,8 @@ var DevApp = ({ options = {} }) => {
|
|
|
2048
2059
|
});
|
|
2049
2060
|
console.log("[dev] bundleUrl restored");
|
|
2050
2061
|
}
|
|
2062
|
+
console.log("[dev] Removing VITE_EXTENSION_BUNDLE_URL from .env");
|
|
2063
|
+
await removeProjectEnvKey(devContext.projectRoot, "VITE_EXTENSION_BUNDLE_URL");
|
|
2051
2064
|
if (tunnelHandle) {
|
|
2052
2065
|
console.log("[dev] Stopping tunnel");
|
|
2053
2066
|
tunnelHandle.stop();
|