@hitch42/applet 0.1.1-beta.18 → 0.1.1-beta.19
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/vite.js
CHANGED
|
@@ -572,6 +572,7 @@ function applet(sourceDefinition) {
|
|
|
572
572
|
}
|
|
573
573
|
const { dependencies: _dependencies, devDependencies: _devDependencies, ...definition } = parsedSourceDefinition.data;
|
|
574
574
|
const parsedDefinition = { data: definition };
|
|
575
|
+
const mountPath = definition.public ? `app/${definition.code}` : definition.code;
|
|
575
576
|
let appletConfig;
|
|
576
577
|
let buildRootOutDir;
|
|
577
578
|
let clearedOutDir = false;
|
|
@@ -589,7 +590,7 @@ function applet(sourceDefinition) {
|
|
|
589
590
|
children: [{
|
|
590
591
|
type: "physical",
|
|
591
592
|
directory: ".",
|
|
592
|
-
pathPrefix:
|
|
593
|
+
pathPrefix: mountPath
|
|
593
594
|
}]
|
|
594
595
|
};
|
|
595
596
|
const resolveAppletConfig = (root) => {
|
|
@@ -738,7 +739,7 @@ function applet(sourceDefinition) {
|
|
|
738
739
|
if (colocated.length > 0) throw new Error(`Applet tests run only from the test folder. Move ${colocated.map((path) => `src/${path}`).join(", ")} to test/.`);
|
|
739
740
|
}
|
|
740
741
|
return {
|
|
741
|
-
base: `/${
|
|
742
|
+
base: `/${mountPath}/`,
|
|
742
743
|
test: { include: ["test/**/*.test.{ts,tsx}"] },
|
|
743
744
|
resolve: { alias: {
|
|
744
745
|
"clsx/lite": "cn/lite",
|
|
@@ -776,7 +777,7 @@ function applet(sourceDefinition) {
|
|
|
776
777
|
invoke: async (workflow, body) => {
|
|
777
778
|
const address = server.httpServer?.address();
|
|
778
779
|
if (address === null || address === void 0 || typeof address === "string") throw new Error("The dev server has no port.");
|
|
779
|
-
const response = await fetch(`http://localhost:${address.port}/${
|
|
780
|
+
const response = await fetch(`http://localhost:${address.port}/${mountPath}/api/__hitch/workflows/${encodeURIComponent(workflow)}`, {
|
|
780
781
|
method: "POST",
|
|
781
782
|
headers: { "content-type": "application/json" },
|
|
782
783
|
body: JSON.stringify(body)
|
|
@@ -818,7 +819,7 @@ function applet(sourceDefinition) {
|
|
|
818
819
|
process.off("exit", removeDevServerFile);
|
|
819
820
|
removeDevServerFile();
|
|
820
821
|
});
|
|
821
|
-
const mount = `/${
|
|
822
|
+
const mount = `/${mountPath}`;
|
|
822
823
|
const apiPrefix = `${mount}/api`;
|
|
823
824
|
server.middlewares.use((request, response, next) => {
|
|
824
825
|
if (request.url === mount || request.url?.startsWith(`${mount}?`)) request.url = `${mount}/${request.url.slice(mount.length)}`;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ Treat each applet as an isolated microfrontend. Keep it separate from the data s
|
|
|
11
11
|
|
|
12
12
|
## Public applets
|
|
13
13
|
|
|
14
|
-
Set `public: true` for an applet that anonymous visitors can use. It runs as the applet identity. Its manifest grants cap its access.
|
|
14
|
+
Set `public: true` for an applet that anonymous visitors can use. It is served at `https://{org}.hitch42.app/app/{code}`. It runs as the applet identity. Its manifest grants cap its access.
|
|
15
15
|
|
|
16
16
|
A public applet cannot use schedules, email, telephony, workflows, or `@hitch42/applet/client/hitch`. Client code calls its server procedures with `api` from `@hitch42/applet/client`.
|
|
17
17
|
|