@lotics/cli 0.42.0 → 0.44.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.
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* wrapper (different port), so the app gets its own real origin (and Web
|
|
9
9
|
* Storage) without being able to reach the wrapper. `allow-downloads` lets
|
|
10
10
|
* apps trigger file downloads (generated xlsx / pdf etc.) — Chrome blocks
|
|
11
|
-
* every download path from sandboxed iframes without it.
|
|
11
|
+
* every download path from sandboxed iframes without it. `allow="...; geolocation"`
|
|
12
|
+
* delegates the host's location permission to the app so geofenced actions can
|
|
13
|
+
* read the device position — matching production. The iframe sends postMessage RPCs to
|
|
12
14
|
* this wrapper, which forwards them to the local /_rpc endpoint, which
|
|
13
15
|
* dispatches to api.lotics.ai with the CLI's API key.
|
|
14
16
|
*
|
package/dist/dev/wrapper_page.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* wrapper (different port), so the app gets its own real origin (and Web
|
|
9
9
|
* Storage) without being able to reach the wrapper. `allow-downloads` lets
|
|
10
10
|
* apps trigger file downloads (generated xlsx / pdf etc.) — Chrome blocks
|
|
11
|
-
* every download path from sandboxed iframes without it.
|
|
11
|
+
* every download path from sandboxed iframes without it. `allow="...; geolocation"`
|
|
12
|
+
* delegates the host's location permission to the app so geofenced actions can
|
|
13
|
+
* read the device position — matching production. The iframe sends postMessage RPCs to
|
|
12
14
|
* this wrapper, which forwards them to the local /_rpc endpoint, which
|
|
13
15
|
* dispatches to api.lotics.ai with the CLI's API key.
|
|
14
16
|
*
|
|
@@ -60,7 +62,7 @@ export function buildWrapperPage(args) {
|
|
|
60
62
|
<span>workspace <code>${escapeHtml(workspace_id)}</code></span>
|
|
61
63
|
<span>RPC → <code>${escapeHtml(api_url)}</code></span>
|
|
62
64
|
</header>
|
|
63
|
-
<iframe id="app" sandbox="allow-scripts allow-same-origin allow-downloads" allow="clipboard-write"></iframe>
|
|
65
|
+
<iframe id="app" sandbox="allow-scripts allow-same-origin allow-downloads" allow="clipboard-write; geolocation"></iframe>
|
|
64
66
|
<script>
|
|
65
67
|
(function () {
|
|
66
68
|
const APP_ID = ${JSON.stringify(app_id)};
|
package/dist/src/cli.js
CHANGED
|
@@ -30179,7 +30179,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
30179
30179
|
import { tmpdir } from "node:os";
|
|
30180
30180
|
|
|
30181
30181
|
// src/starter_template.ts
|
|
30182
|
-
var STARTER_FALLBACK_UI_VERSION = "
|
|
30182
|
+
var STARTER_FALLBACK_UI_VERSION = "2.0.0";
|
|
30183
30183
|
var STARTER_FALLBACK_SDK_VERSION = "0.11.0";
|
|
30184
30184
|
var STARTER_REACT_NATIVE_VERSION = "0.85.3";
|
|
30185
30185
|
function buildStarterTemplate(args) {
|
|
@@ -30322,13 +30322,6 @@ export default defineConfig({
|
|
|
30322
30322
|
dedupe: ["react", "react-dom", "react-native-web"],
|
|
30323
30323
|
},
|
|
30324
30324
|
optimizeDeps: {
|
|
30325
|
-
// \`recharts\` (used by @lotics/ui chart_* + sparkline) imports
|
|
30326
|
-
// \`es-toolkit/compat/get\` as a default-export CJS module. Vite's dev
|
|
30327
|
-
// server treats \`compat/*\` as ESM and won't synthesize a default,
|
|
30328
|
-
// so \`import get from "es-toolkit/compat/get"\` fails to resolve.
|
|
30329
|
-
// Pre-bundling forces Vite to convert it to an ESM shim with a default
|
|
30330
|
-
// export. Production build (rollup) handles it correctly without this.
|
|
30331
|
-
include: ["recharts", "es-toolkit", "es-toolkit/compat"],
|
|
30332
30325
|
// The dep optimizer pre-bundles deps with a SEPARATE esbuild pass that
|
|
30333
30326
|
// top-level \`define\` doesn't always reach, so a pre-bundled RN dep can
|
|
30334
30327
|
// still hit \`__DEV__ is not defined\` under \`lotics app dev\`. Define it
|
|
@@ -30766,7 +30759,7 @@ function buildWrapperPage(args) {
|
|
|
30766
30759
|
<span>workspace <code>${escapeHtml2(workspace_id)}</code></span>
|
|
30767
30760
|
<span>RPC \u2192 <code>${escapeHtml2(api_url)}</code></span>
|
|
30768
30761
|
</header>
|
|
30769
|
-
<iframe id="app" sandbox="allow-scripts allow-same-origin allow-downloads" allow="clipboard-write"></iframe>
|
|
30762
|
+
<iframe id="app" sandbox="allow-scripts allow-same-origin allow-downloads" allow="clipboard-write; geolocation"></iframe>
|
|
30770
30763
|
<script>
|
|
30771
30764
|
(function () {
|
|
30772
30765
|
const APP_ID = ${JSON.stringify(app_id)};
|
|
@@ -39,7 +39,7 @@ export interface StarterFile {
|
|
|
39
39
|
* scaffolds resolve the live version via `fetchLatestNpmVersion` and only
|
|
40
40
|
* fall back here when the lookup fails.
|
|
41
41
|
*/
|
|
42
|
-
export declare const STARTER_FALLBACK_UI_VERSION = "
|
|
42
|
+
export declare const STARTER_FALLBACK_UI_VERSION = "2.0.0";
|
|
43
43
|
export declare const STARTER_FALLBACK_SDK_VERSION = "0.11.0";
|
|
44
44
|
/**
|
|
45
45
|
* react-native pin for scaffolded apps. Matches the monorepo frontend's pin so
|
package/dist/starter_template.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* scaffolds resolve the live version via `fetchLatestNpmVersion` and only
|
|
36
36
|
* fall back here when the lookup fails.
|
|
37
37
|
*/
|
|
38
|
-
export const STARTER_FALLBACK_UI_VERSION = "
|
|
38
|
+
export const STARTER_FALLBACK_UI_VERSION = "2.0.0";
|
|
39
39
|
export const STARTER_FALLBACK_SDK_VERSION = "0.11.0";
|
|
40
40
|
/**
|
|
41
41
|
* react-native pin for scaffolded apps. Matches the monorepo frontend's pin so
|
|
@@ -184,13 +184,6 @@ export default defineConfig({
|
|
|
184
184
|
dedupe: ["react", "react-dom", "react-native-web"],
|
|
185
185
|
},
|
|
186
186
|
optimizeDeps: {
|
|
187
|
-
// \`recharts\` (used by @lotics/ui chart_* + sparkline) imports
|
|
188
|
-
// \`es-toolkit/compat/get\` as a default-export CJS module. Vite's dev
|
|
189
|
-
// server treats \`compat/*\` as ESM and won't synthesize a default,
|
|
190
|
-
// so \`import get from "es-toolkit/compat/get"\` fails to resolve.
|
|
191
|
-
// Pre-bundling forces Vite to convert it to an ESM shim with a default
|
|
192
|
-
// export. Production build (rollup) handles it correctly without this.
|
|
193
|
-
include: ["recharts", "es-toolkit", "es-toolkit/compat"],
|
|
194
187
|
// The dep optimizer pre-bundles deps with a SEPARATE esbuild pass that
|
|
195
188
|
// top-level \`define\` doesn't always reach, so a pre-bundled RN dep can
|
|
196
189
|
// still hit \`__DEV__ is not defined\` under \`lotics app dev\`. Define it
|
|
@@ -8,14 +8,15 @@ function fileNamed(files, path) {
|
|
|
8
8
|
}
|
|
9
9
|
describe("buildStarterTemplate", () => {
|
|
10
10
|
const baseArgs = { app_name: "Demo", app_id: "app_test", workspace_id: "wsp_test" };
|
|
11
|
-
test("vite.config.ts pre-bundles
|
|
11
|
+
test("vite.config.ts pre-bundles RN deps with __DEV__ + .web.js for the dev server", () => {
|
|
12
12
|
const config = fileNamed(buildStarterTemplate(baseArgs), "vite.config.ts");
|
|
13
|
-
//
|
|
14
|
-
//
|
|
13
|
+
// The optimizer runs a SEPARATE esbuild pass that ignores `resolve.extensions`
|
|
14
|
+
// and the top-level `define`, so `__DEV__` + `.web.js` must be repeated here —
|
|
15
|
+
// else a pre-bundled RN dep (e.g. react-native-svg, which @lotics/ui charts
|
|
16
|
+
// use) resolves to its native build and `__DEV__` is undefined.
|
|
15
17
|
expect(config).toMatch(/optimizeDeps:\s*\{/);
|
|
16
|
-
expect(config).toContain('"
|
|
17
|
-
expect(config).toContain('"
|
|
18
|
-
expect(config).toContain('"es-toolkit/compat"');
|
|
18
|
+
expect(config).toContain('__DEV__: "false"');
|
|
19
|
+
expect(config).toContain('".web.js"');
|
|
19
20
|
});
|
|
20
21
|
test("vite.config.ts defines the RN __DEV__ global (else the bundle throws at load → blank iframe)", () => {
|
|
21
22
|
// `__DEV__` is a Metro-injected global that RN-ecosystem deps reference at
|