@stackable-labs/cli-app-extension 1.6.3 → 1.7.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/index.js +33 -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,19 @@ var readDevContext = async (projectRoot) => {
|
|
|
1799
1799
|
previewPort
|
|
1800
1800
|
};
|
|
1801
1801
|
};
|
|
1802
|
+
var DEV_LOCAL_ENV = ".env.development.local";
|
|
1803
|
+
var patchProjectEnv = async (projectRoot, key, value) => {
|
|
1804
|
+
const envPath = join3(projectRoot, DEV_LOCAL_ENV);
|
|
1805
|
+
const existing = await readEnvFile(envPath);
|
|
1806
|
+
existing[key] = value;
|
|
1807
|
+
await writeEnvFile2(envPath, existing);
|
|
1808
|
+
};
|
|
1809
|
+
var removeProjectEnvKey = async (projectRoot, key) => {
|
|
1810
|
+
const envPath = join3(projectRoot, DEV_LOCAL_ENV);
|
|
1811
|
+
const existing = await readEnvFile(envPath);
|
|
1812
|
+
delete existing[key];
|
|
1813
|
+
await writeEnvFile2(envPath, existing);
|
|
1814
|
+
};
|
|
1802
1815
|
var writeDevContext = async (projectRoot, ctx) => {
|
|
1803
1816
|
const env = {
|
|
1804
1817
|
APP_ID: ctx.appId || "",
|
|
@@ -1910,8 +1923,6 @@ var DevDashboard = ({
|
|
|
1910
1923
|
onQuit();
|
|
1911
1924
|
}
|
|
1912
1925
|
});
|
|
1913
|
-
const localPreviewUrl = `http://localhost:${previewPort}`;
|
|
1914
|
-
const previewUrl = tunnelUrl ? `${tunnelUrl.replace(/\/$/, "")}/preview` : localPreviewUrl;
|
|
1915
1926
|
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
|
|
1916
1927
|
/* @__PURE__ */ jsx15(Banner, {}),
|
|
1917
1928
|
/* @__PURE__ */ jsxs15(
|
|
@@ -1940,24 +1951,23 @@ var DevDashboard = ({
|
|
|
1940
1951
|
] })
|
|
1941
1952
|
] }),
|
|
1942
1953
|
/* @__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
1954
|
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1952
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "
|
|
1953
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Preview:" }),
|
|
1956
|
+
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1957
|
+
"http://localhost:",
|
|
1958
|
+
previewPort
|
|
1959
|
+
] })
|
|
1954
1960
|
] }),
|
|
1955
1961
|
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1956
|
-
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local
|
|
1962
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local:" }),
|
|
1957
1963
|
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1958
1964
|
"http://localhost:",
|
|
1959
1965
|
extensionPort
|
|
1960
1966
|
] })
|
|
1967
|
+
] }),
|
|
1968
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1969
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel:" }),
|
|
1970
|
+
/* @__PURE__ */ jsx15(Text15, { children: tunnelUrl || "Connecting\u2026" })
|
|
1961
1971
|
] })
|
|
1962
1972
|
] })
|
|
1963
1973
|
]
|
|
@@ -1999,9 +2009,6 @@ var DevApp = ({ options = {} }) => {
|
|
|
1999
2009
|
});
|
|
2000
2010
|
const extensionPort = options.extensionPort ? parseInt(options.extensionPort, 10) : devContext.extensionPort;
|
|
2001
2011
|
await patchViteAllowedHosts(devContext.projectRoot);
|
|
2002
|
-
console.log(`[dev] Starting dev server in ${devContext.projectRoot}`);
|
|
2003
|
-
const serverHandle = startDevServer(devContext.projectRoot);
|
|
2004
|
-
setDevServerHandle(serverHandle);
|
|
2005
2012
|
if (useTunnel) {
|
|
2006
2013
|
try {
|
|
2007
2014
|
console.log(`[dev] Starting tunnel on port ${extensionPort}...`);
|
|
@@ -2009,6 +2016,8 @@ var DevApp = ({ options = {} }) => {
|
|
|
2009
2016
|
console.log(`[dev] Tunnel ready: ${tunnelResult.url}`);
|
|
2010
2017
|
setTunnelHandle(tunnelResult);
|
|
2011
2018
|
setTunnelUrl(tunnelResult.url);
|
|
2019
|
+
console.log(`[dev] Writing VITE_EXTENSION_BUNDLE_URL=${tunnelResult.url} to .env`);
|
|
2020
|
+
await patchProjectEnv(devContext.projectRoot, "VITE_EXTENSION_BUNDLE_URL", tunnelResult.url);
|
|
2012
2021
|
if (useUpdate) {
|
|
2013
2022
|
const originalUrl = `http://localhost:${extensionPort}`;
|
|
2014
2023
|
setOriginalBundleUrl(originalUrl);
|
|
@@ -2025,6 +2034,9 @@ var DevApp = ({ options = {} }) => {
|
|
|
2025
2034
|
} else {
|
|
2026
2035
|
console.log("[dev] Tunnel disabled (--no-tunnel)");
|
|
2027
2036
|
}
|
|
2037
|
+
console.log(`[dev] Starting dev server in ${devContext.projectRoot}`);
|
|
2038
|
+
const serverHandle = startDevServer(devContext.projectRoot);
|
|
2039
|
+
setDevServerHandle(serverHandle);
|
|
2028
2040
|
console.log("[dev] Ready");
|
|
2029
2041
|
setState("running");
|
|
2030
2042
|
}, [devContext, options.extensionPort, useTunnel, useUpdate]);
|
|
@@ -2048,6 +2060,8 @@ var DevApp = ({ options = {} }) => {
|
|
|
2048
2060
|
});
|
|
2049
2061
|
console.log("[dev] bundleUrl restored");
|
|
2050
2062
|
}
|
|
2063
|
+
console.log("[dev] Removing VITE_EXTENSION_BUNDLE_URL from .env");
|
|
2064
|
+
await removeProjectEnvKey(devContext.projectRoot, "VITE_EXTENSION_BUNDLE_URL");
|
|
2051
2065
|
if (tunnelHandle) {
|
|
2052
2066
|
console.log("[dev] Stopping tunnel");
|
|
2053
2067
|
tunnelHandle.stop();
|