@lotics/cli 0.39.0 → 0.41.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.
@@ -153,11 +153,15 @@ import react from "@vitejs/plugin-react";
153
153
  // is identical to RN-SVG when running under RN-Web.
154
154
  export default defineConfig({
155
155
  plugins: [react()],
156
- // RN libraries (react-native-web, @react-native-picker's UnimplementedView)
157
- // reference the \`__DEV__\` global that Metro injects but Vite does not —
158
- // undefined ⇒ the bundle throws at load and the iframe renders blank. Define
159
- // it (false = production RN behaviour) so dev and the deployed build both boot.
160
- define: { __DEV__: "false" },
156
+ // RN libraries reference globals Metro injects but Vite does not — undefined
157
+ // the bundle throws. \`__DEV__\` (react-native-web, @react-native-picker's
158
+ // UnimplementedView): throws at load, blank iframe. \`global\` (rn-web
159
+ // Animated's \`global.cancelAnimationFrame\`): throws when a spring animation is
160
+ // interrupted/torn down e.g. toggling @lotics/ui's Switch. rollup hits it;
161
+ // the dev esbuild path masks it, so it only surfaces in the deployed app.
162
+ // rn-web only reads \`global.x\` as a free var, so mapping it to \`globalThis\`
163
+ // is safe. Define both so dev and the deployed build behave identically.
164
+ define: { __DEV__: "false", global: "globalThis" },
161
165
  resolve: {
162
166
  alias: [
163
167
  {
@@ -195,7 +199,7 @@ export default defineConfig({
195
199
  // \`resolve.extensions\`, so \`.web.js\` must be repeated here or a pre-bundled
196
200
  // RN dep still resolves \`./Picker\` to the native build.
197
201
  esbuildOptions: {
198
- define: { __DEV__: "false" },
202
+ define: { __DEV__: "false", global: "globalThis" },
199
203
  resolveExtensions: [".web.tsx", ".web.ts", ".web.js", ".tsx", ".ts", ".jsx", ".js", ".json"],
200
204
  },
201
205
  },
@@ -30,6 +30,16 @@ describe("buildStarterTemplate", () => {
30
30
  // deps under `lotics app dev`).
31
31
  expect(config).toMatch(/esbuildOptions:\s*\{\s*define:\s*\{\s*__DEV__:\s*"false"/);
32
32
  });
33
+ test("vite.config.ts maps the RN `global` to globalThis (else rn-web Animated throws when a spring is torn down)", () => {
34
+ // react-native-web's Animated reads `global.cancelAnimationFrame` (free var)
35
+ // when a spring animation is interrupted — e.g. toggling @lotics/ui's Switch.
36
+ // Undefined in a web bundle ⇒ "global is not defined". The rollup build hits
37
+ // it; the dev esbuild path masks it, so it only surfaces in the deployed app
38
+ // and no typecheck/lint/build catches it. Pin both define sites.
39
+ const config = fileNamed(buildStarterTemplate(baseArgs), "vite.config.ts");
40
+ expect(config).toMatch(/define:\s*\{\s*__DEV__:\s*"false",\s*global:\s*"globalThis"/);
41
+ expect(config).toMatch(/esbuildOptions:\s*\{\s*define:\s*\{\s*__DEV__:\s*"false",\s*global:\s*"globalThis"/);
42
+ });
33
43
  test("package.json pins react-native to the monorepo version (so apps typecheck @lotics/ui against the same RN types)", () => {
34
44
  const pkg = JSON.parse(fileNamed(buildStarterTemplate(baseArgs), "package.json"));
35
45
  expect(pkg.dependencies["react-native"]).toBe(STARTER_REACT_NATIVE_VERSION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {