create-octane-xplat 0.19.0 → 0.20.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.
Files changed (63) hide show
  1. package/README.md +2 -147
  2. package/compatibility.json +74 -61
  3. package/compatibility.ts +134 -79
  4. package/dist/compatibility.js +45 -13
  5. package/dist/index.js +127 -64
  6. package/dist/package-manager.js +62 -0
  7. package/dist/scaffold.js +362 -57
  8. package/index.ts +256 -156
  9. package/library-template/AGENTS.md +1 -1
  10. package/library-template/README.md +4 -3
  11. package/library-template/bunfig +4 -0
  12. package/library-template/package.json +73 -70
  13. package/library-template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
  14. package/library-template/patches/@nativescript__core@9.1.3.patch +98 -0
  15. package/library-template/patches/@nativescript__vite@8.0.20.patch +532 -17
  16. package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  17. package/library-template/patches/octane@0.16.3.patch +56 -2
  18. package/library-template/src/Badge.tsx +5 -5
  19. package/library-template/src/Badge.web.tsx +5 -5
  20. package/library-template/src/Welcome.stories.tsx +12 -0
  21. package/library-template/src/normalizeBadgeLabel.ts +1 -1
  22. package/library-template/src/props.ts +11 -11
  23. package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
  24. package/library-template/tests/packed-consumer.mjs +140 -123
  25. package/library-template/tsconfig.envs.json +1 -0
  26. package/library-template/tsconfig.json +1 -0
  27. package/library-template/tsconfig.types.json +15 -1
  28. package/library-template/tsrx-typegen.json +1 -1
  29. package/library-template/workshop.config.ts +3 -0
  30. package/package-manager.ts +93 -0
  31. package/package.json +10 -5
  32. package/scaffold.ts +1061 -449
  33. package/template/.agents/skills/xplat/SKILL.md +1 -1
  34. package/template/.agents/skills/xplat/references/styling.md +10 -10
  35. package/template/AGENTS.md +2 -2
  36. package/template/bunfig +4 -0
  37. package/template/nativescript.config.ts +13 -13
  38. package/template/package.json +69 -64
  39. package/template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
  40. package/template/patches/@nativescript__core@9.1.3.patch +98 -0
  41. package/template/patches/@nativescript__vite@8.0.20.patch +532 -17
  42. package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  43. package/template/patches/octane@0.16.3.patch +56 -2
  44. package/template/src/App.tsrx +66 -64
  45. package/template/src/Welcome.stories.tsx +22 -0
  46. package/template/src/app.spec.tsrx +168 -158
  47. package/template/src/app.web.test.tsx +18 -13
  48. package/template/src/failure-reporting.spec.ts +3 -3
  49. package/template/src/main.ts +14 -13
  50. package/template/src/main.tsrx +2 -0
  51. package/template/src/native-runtime.spec.ts +13 -11
  52. package/template/src/test-setup.web.ts +9 -8
  53. package/template/src/test.ts +6 -6
  54. package/template/tsconfig.json +17 -1
  55. package/template/vite.config.native.mts +1 -2
  56. package/template/vite.config.ts +29 -23
  57. package/template/vitest.config.mts +17 -17
  58. package/template/vitest.web.config.mts +7 -7
  59. package/template/workshop.config.ts +3 -0
  60. package/library-template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
  61. package/template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
  62. /package/library-template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
  63. /package/template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
@@ -9,14 +9,14 @@ import { describe, expect, it } from 'vitest'
9
9
  import { useEffect, useState, useSyncExternalStore } from 'octane'
10
10
  import { Pressable, Text, TextInput, View } from '@octane-xplat/ui'
11
11
  import {
12
- type TextInputView,
13
- enterText,
14
- findByTestId,
15
- mountXplat,
16
- nextRenderPass,
17
- tap,
18
- viewText,
19
- waitUntil,
12
+ type TextInputView,
13
+ enterText,
14
+ findByTestId,
15
+ mountXplat,
16
+ nextRenderPass,
17
+ tap,
18
+ viewText,
19
+ waitUntil,
20
20
  } from '@octane-xplat/platform/testing'
21
21
 
22
22
  import { App } from './App.tsrx'
@@ -24,108 +24,114 @@ import { App } from './App.tsrx'
24
24
  // Controlled input — typing flows up through onChange and back down as the
25
25
  // rendered value, and parent writes reach the native field.
26
26
  function NameForm() @{
27
- const [name, setName] = useState('')
28
-
29
- <View>
30
- <TextInput testID="greeting.name" value={name} onChange={setName} placeholder="Your name" />
31
- <Pressable testID="greeting.reset" onPress={() => setName('Bob')}>
32
- <Text>set bob</Text>
33
- </Pressable>
34
- <Text>{'greeting: ' + (name || 'stranger')}</Text>
35
- </View>
27
+ const [name, setName] = useState('')
28
+
29
+ <View>
30
+ <TextInput testID="greeting.name" value={name} onChange={setName} placeholder="Your name" />
31
+ <Pressable testID="greeting.reset" onPress={() => setName('Bob')}>
32
+ <Text>set bob</Text>
33
+ </Pressable>
34
+ <Text>{'greeting: ' + (name || 'stranger')}</Text>
35
+ </View>
36
36
  }
37
37
 
38
38
  // Conditional mount — a subtree exists only while its state says so.
39
39
  function Details() @{
40
- const [open, setOpen] = useState(false)
41
-
42
- <View>
43
- <Pressable testID="details.toggle" onPress={() => setOpen(!open)}>
44
- <Text>toggle</Text>
45
- </Pressable>
46
- @if (open) {
47
- <Text>detail: open</Text>
48
- }
49
- </View>
40
+ const [open, setOpen] = useState(false)
41
+
42
+ <View>
43
+ <Pressable testID="details.toggle" onPress={() => setOpen(!open)}>
44
+ <Text>toggle</Text>
45
+ </Pressable>
46
+ @if (open) {
47
+ <Text>detail: open</Text>
48
+ }
49
+ </View>
50
50
  }
51
51
 
52
52
  // Async states — loading first, then a settled value or an error. The
53
53
  // cleanup flag keeps a late timer from writing into an unmounted tree.
54
54
  function FetchLabel(props: { fail?: boolean }) @{
55
- const [state, setState] = useState('loading')
56
- useEffect(() => {
57
- let live = true
58
- const timer = setTimeout(() => {
59
- if (live) {
60
- setState(props.fail ? 'error' : 'ready')
61
- }
62
- }, 30)
63
-
64
- return () => {
65
- live = false
66
- clearTimeout(timer)
67
- }
68
- }, [])
69
-
70
- <Text>{'fetch: ' + state}</Text>
55
+ const [state, setState] = useState('loading')
56
+
57
+ useEffect(() => {
58
+ let live = true
59
+ const timer = setTimeout(() => {
60
+ if (live) {
61
+ setState(props.fail ? 'error' : 'ready')
62
+ }
63
+ }, 30)
64
+
65
+ return () => {
66
+ live = false
67
+ clearTimeout(timer)
68
+ }
69
+ }, [])
70
+
71
+ <Text>{'fetch: ' + state}</Text>
71
72
  }
72
73
 
73
74
  describe('starter app on device', () => {
74
- it('mounts, reacts to a tap, and unmounts cleanly', async () => {
75
- const { view, host, unmount } = await mountXplat(App)
76
-
77
- const increment = findByTestId(view, 'counter.increment')
78
- const count = findByTestId<TextInputView>(view, 'counter.value')
79
- expect(increment?.isLoaded, 'counter.increment resolves to a loaded native view').toBe(true)
80
-
81
- await tap(increment!)
82
- await waitUntil(() => count?.text === '1', {
83
- message: 'tap did not reach the increment Pressable',
84
- })
85
-
86
- await unmount()
87
- await nextRenderPass()
88
- expect(host.content).toBe(null)
89
- })
90
-
91
- it('round-trips a controlled TextInput', async () => {
92
- const { view } = await mountXplat(NameForm)
93
- const field = findByTestId<TextInputView>(view, 'greeting.name')
94
- expect(field?.isLoaded).toBe(true)
95
-
96
- await enterText(field!, 'Ada')
97
- await waitUntil(() => viewText(view).includes('greeting: Ada'), {
98
- message: 'onChange did not deliver the typed text',
99
- })
100
-
101
- await tap(findByTestId(view, 'greeting.reset')!)
102
- await waitUntil(() => field?.text === 'Bob', {
103
- message: 'parent write did not reach the native field',
104
- })
105
- })
106
-
107
- it('mounts and unmounts a conditional subtree', async () => {
108
- const { view } = await mountXplat(Details)
109
- expect(viewText(view).includes('detail: open')).toBe(false)
110
-
111
- await tap(findByTestId(view, 'details.toggle')!)
112
- await waitUntil(() => viewText(view).includes('detail: open'))
113
-
114
- await tap(findByTestId(view, 'details.toggle')!)
115
- await waitUntil(() => !viewText(view).includes('detail: open'))
116
- })
117
-
118
- it('settles async loading and error states', async () => {
119
- const ready = await mountXplat(FetchLabel)
120
- await waitUntil(() => viewText(ready.view).includes('fetch: ready'), {
121
- message: 'loading state never settled',
122
- })
123
-
124
- const failed = await mountXplat(FetchLabel, { fail: true })
125
- await waitUntil(() => viewText(failed.view).includes('fetch: error'), {
126
- message: 'error state never surfaced',
127
- })
128
- })
75
+ it('mounts, reacts to a tap, and unmounts cleanly', async () => {
76
+ const { view, host, unmount } = await mountXplat(App)
77
+
78
+ const increment = findByTestId(view, 'counter.increment')
79
+ const count = findByTestId<TextInputView>(view, 'counter.value')
80
+
81
+ expect(increment?.isLoaded, 'counter.increment resolves to a loaded native view').toBe(true)
82
+
83
+ await tap(increment!)
84
+ await waitUntil(() => count?.text === '1', {
85
+ message: 'tap did not reach the increment Pressable',
86
+ })
87
+
88
+ await unmount()
89
+ await nextRenderPass()
90
+ expect(host.content).toBe(null)
91
+ })
92
+
93
+ it('round-trips a controlled TextInput', async () => {
94
+ const { view } = await mountXplat(NameForm)
95
+ const field = findByTestId<TextInputView>(view, 'greeting.name')
96
+
97
+ expect(field?.isLoaded).toBe(true)
98
+
99
+ await enterText(field!, 'Ada')
100
+ await waitUntil(() => viewText(view).includes('greeting: Ada'), {
101
+ message: 'onChange did not deliver the typed text',
102
+ })
103
+
104
+ await tap(findByTestId(view, 'greeting.reset')!)
105
+ await waitUntil(() => field?.text === 'Bob', {
106
+ message: 'parent write did not reach the native field',
107
+ })
108
+ })
109
+
110
+ it('mounts and unmounts a conditional subtree', async () => {
111
+ const { view } = await mountXplat(Details)
112
+
113
+ expect(viewText(view).includes('detail: open')).toBe(false)
114
+
115
+ await tap(findByTestId(view, 'details.toggle')!)
116
+ await waitUntil(() => viewText(view).includes('detail: open'))
117
+
118
+ await tap(findByTestId(view, 'details.toggle')!)
119
+ await waitUntil(() => !viewText(view).includes('detail: open'))
120
+ })
121
+
122
+ it('settles async loading and error states', async () => {
123
+ const ready = await mountXplat(FetchLabel)
124
+
125
+ await waitUntil(() => viewText(ready.view).includes('fetch: ready'), {
126
+ message: 'loading state never settled',
127
+ })
128
+
129
+ const failed = await mountXplat(FetchLabel, { fail: true })
130
+
131
+ await waitUntil(() => viewText(failed.view).includes('fetch: error'), {
132
+ message: 'error state never surfaced',
133
+ })
134
+ })
129
135
  })
130
136
 
131
137
  // Observable cleanup contracts: every effect subscribe must pair with a
@@ -135,72 +141,76 @@ let activeEffects = 0
135
141
  let ticks = 0
136
142
 
137
143
  function IntervalCounter() @{
138
- useEffect(() => {
139
- activeEffects += 1
140
- const timer = setInterval(() => {
141
- ticks += 1
142
- }, 15)
143
-
144
- return () => {
145
- activeEffects -= 1
146
- clearInterval(timer)
147
- }
148
- }, [])
149
-
150
- <Text>interval</Text>
144
+ useEffect(() => {
145
+ activeEffects += 1
146
+
147
+ const timer = setInterval(() => {
148
+ ticks += 1
149
+ }, 15)
150
+
151
+ return () => {
152
+ activeEffects -= 1
153
+ clearInterval(timer)
154
+ }
155
+ }, [])
156
+
157
+ <Text>interval</Text>
151
158
  }
152
159
 
153
160
  const listeners = new Set<() => void>()
154
161
 
155
162
  function StoreReader() @{
156
- const count = useSyncExternalStore(
157
- (callback) => {
158
- listeners.add(callback)
159
- return () => {
160
- listeners.delete(callback)
161
- }
162
- },
163
- () => listeners.size,
164
- )
165
-
166
- <Text>{'subs: ' + count}</Text>
163
+ const count = useSyncExternalStore(
164
+ (callback) => {
165
+ listeners.add(callback)
166
+ return () => {
167
+ listeners.delete(callback)
168
+ }
169
+ },
170
+ () => listeners.size,
171
+ )
172
+
173
+ <Text>{'subs: ' + count}</Text>
167
174
  }
168
175
 
169
176
  describe('mount/unmount cleanup', () => {
170
- it('runs effect cleanups and stops delayed work at unmount', async () => {
171
- ticks = 0
172
- for (let i = 0; i < 3; i++) {
173
- const { unmount } = await mountXplat(IntervalCounter)
174
- expect(activeEffects, 'each mount subscribes exactly once').toBe(1)
175
- await unmount()
176
- expect(activeEffects, 'unmount runs the effect cleanup').toBe(0)
177
- }
178
-
179
- // The cleared interval must not fire after the last unmount.
180
- const settled = ticks
181
- await new Promise((resolve) => setTimeout(resolve, 60))
182
- expect(ticks, 'interval work continued after unmount').toBe(settled)
183
- })
184
-
185
- it('releases external-store subscriptions at unmount', async () => {
186
- for (let i = 0; i < 3; i++) {
187
- const { unmount } = await mountXplat(StoreReader)
188
- expect(listeners.size, 'each mount subscribes exactly once').toBe(1)
189
- await unmount()
190
- expect(listeners.size, 'unmount releases the subscription').toBe(0)
191
- }
192
- })
193
-
194
- it('re-mounting replaces the previous root instead of leaking it', async () => {
195
- await mountXplat(IntervalCounter)
196
- expect(activeEffects).toBe(1)
197
- // mountXplat drops the previous root — its cleanup must already have run.
198
- await mountXplat(IntervalCounter)
199
- expect(activeEffects, 'previous root stayed subscribed after re-mount').toBe(1)
200
- })
201
-
202
- it('finishes automatic cleanup before the next case', () => {
203
- expect(activeEffects).toBe(0)
204
- expect(listeners.size).toBe(0)
205
- })
177
+ it('runs effect cleanups and stops delayed work at unmount', async () => {
178
+ ticks = 0
179
+ for (let i = 0; i < 3; i++) {
180
+ const { unmount } = await mountXplat(IntervalCounter)
181
+
182
+ expect(activeEffects, 'each mount subscribes exactly once').toBe(1)
183
+ await unmount()
184
+ expect(activeEffects, 'unmount runs the effect cleanup').toBe(0)
185
+ }
186
+
187
+ // The cleared interval must not fire after the last unmount.
188
+ const settled = ticks
189
+
190
+ await new Promise((resolve) => setTimeout(resolve, 60))
191
+ expect(ticks, 'interval work continued after unmount').toBe(settled)
192
+ })
193
+
194
+ it('releases external-store subscriptions at unmount', async () => {
195
+ for (let i = 0; i < 3; i++) {
196
+ const { unmount } = await mountXplat(StoreReader)
197
+
198
+ expect(listeners.size, 'each mount subscribes exactly once').toBe(1)
199
+ await unmount()
200
+ expect(listeners.size, 'unmount releases the subscription').toBe(0)
201
+ }
202
+ })
203
+
204
+ it('re-mounting replaces the previous root instead of leaking it', async () => {
205
+ await mountXplat(IntervalCounter)
206
+ expect(activeEffects).toBe(1)
207
+ // mountXplat drops the previous root — its cleanup must already have run.
208
+ await mountXplat(IntervalCounter)
209
+ expect(activeEffects, 'previous root stayed subscribed after re-mount').toBe(1)
210
+ })
211
+
212
+ it('finishes automatic cleanup before the next case', () => {
213
+ expect(activeEffects).toBe(0)
214
+ expect(listeners.size).toBe(0)
215
+ })
206
216
  })
@@ -4,17 +4,22 @@ import { createRoot } from 'octane'
4
4
  import { App } from './App.tsrx'
5
5
 
6
6
  it('updates the counter when its button is pressed', async () => {
7
- const container = document.createElement('div')
8
- document.body.append(container)
9
- const root = createRoot(container)
10
- try {
11
- root.render(<App />)
12
- const value = () => container.querySelector('[data-testid="counter.value"]')?.textContent
13
- await vi.waitFor(() => expect(value()).toBe('0'))
14
- container.querySelector<HTMLElement>('[data-testid="counter.increment"]')!.click()
15
- await vi.waitFor(() => expect(value()).toBe('1'))
16
- } finally {
17
- root.unmount()
18
- container.remove()
19
- }
7
+ const container = document.createElement('div')
8
+
9
+ document.body.append(container)
10
+
11
+ const root = createRoot(container)
12
+
13
+ try {
14
+ root.render(<App />)
15
+
16
+ const value = () => container.querySelector('[data-testid="counter.value"]')?.textContent
17
+
18
+ await vi.waitFor(() => expect(value()).toBe('0'))
19
+ container.querySelector<HTMLElement>('[data-testid="counter.increment"]')!.click()
20
+ await vi.waitFor(() => expect(value()).toBe('1'))
21
+ } finally {
22
+ root.unmount()
23
+ container.remove()
24
+ }
20
25
  })
@@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest'
5
5
  // real Vitest failures (it.fails inverts the outcome, keeping the committed
6
6
  // suite green while pinning the failure-reporting path).
7
7
  describe('failure reporting', () => {
8
- it.fails('a failed assertion on device is reported as a failure', () => {
9
- expect('octane-xplat').toBe('a different string entirely')
10
- })
8
+ it.fails('a failed assertion on device is reported as a failure', () => {
9
+ expect('octane-xplat').toBe('a different string entirely')
10
+ })
11
11
  })
@@ -8,17 +8,18 @@ import '@octane-xplat/ui/theme/tokens.css'
8
8
  import './style.css'
9
9
 
10
10
  const entry = {
11
- create: () => {
12
- // A Frame hosts the root Page. RouteOutlet binds canonical routing
13
- // to this Frame when the app adds generated routes.
14
- const frame = new Frame()
15
- // Full-screen page: SafeArea owns safe-area padding.
16
- const page = prepareFullScreenPage(new Page())
17
- page.actionBarHidden = true
18
- renderNativeScriptApp(page, App)
19
- frame.navigate({ create: () => page })
20
- return frame
21
- },
11
+ create: () => {
12
+ // A Frame hosts the root Page. RouteOutlet binds canonical routing
13
+ // to this Frame when the app adds generated routes.
14
+ const frame = new Frame()
15
+ // Full-screen page: SafeArea owns safe-area padding.
16
+ const page = prepareFullScreenPage(new Page())
17
+
18
+ page.actionBarHidden = true
19
+ renderNativeScriptApp(page, App)
20
+ frame.navigate({ create: () => page })
21
+ return frame
22
+ },
22
23
  }
23
24
 
24
25
  // Under the vite dev session the placeholder bootstrap has already run
@@ -27,7 +28,7 @@ const entry = {
27
28
  // (iOS core handles the placeholder handoff internally); resetRootView is
28
29
  // the documented way to swap the root of a running app.
29
30
  if (Application.started) {
30
- Application.resetRootView(entry)
31
+ Application.resetRootView(entry)
31
32
  } else {
32
- Application.run(entry)
33
+ Application.run(entry)
33
34
  }
@@ -0,0 +1,2 @@
1
+ // Type contract only.
2
+ export {}
@@ -4,15 +4,17 @@ import { Device, isAndroid, isIOS, knownFolders } from '@nativescript/core'
4
4
  // This executes NativeScript's filesystem bridge in the actual mobile host.
5
5
  // Only this test's uniquely named temporary file is written and removed.
6
6
  describe('native runtime', () => {
7
- it('round-trips a file through the native bridge', () => {
8
- expect(isAndroid || isIOS).toBe(true)
9
- expect(Device.os).toBe(isAndroid ? 'Android' : 'iOS')
10
- const file = knownFolders.temp().getFile(`xplat-native-test-${Date.now()}.txt`)
11
- try {
12
- file.writeTextSync('octane-xplat')
13
- expect(file.readTextSync()).toBe('octane-xplat')
14
- } finally {
15
- file.removeSync()
16
- }
17
- })
7
+ it('round-trips a file through the native bridge', () => {
8
+ expect(isAndroid || isIOS).toBe(true)
9
+ expect(Device.os).toBe(isAndroid ? 'Android' : 'iOS')
10
+
11
+ const file = knownFolders.temp().getFile(`xplat-native-test-${Date.now()}.txt`)
12
+
13
+ try {
14
+ file.writeTextSync('octane-xplat')
15
+ expect(file.readTextSync()).toBe('octane-xplat')
16
+ } finally {
17
+ file.removeSync()
18
+ }
19
+ })
18
20
  })
@@ -2,16 +2,17 @@ import { vi } from 'vitest'
2
2
 
3
3
  // jsdom has no system color-scheme producer. Keep component tests in light mode.
4
4
  globalThis.matchMedia ??= (query: string) => ({
5
- media: query,
6
- matches: false,
7
- onchange: null,
8
- addListener() {},
9
- removeListener() {},
10
- addEventListener() {},
11
- removeEventListener() {},
12
- dispatchEvent: () => true,
5
+ media: query,
6
+ matches: false,
7
+ onchange: null,
8
+ addListener() {},
9
+ removeListener() {},
10
+ addEventListener() {},
11
+ removeEventListener() {},
12
+ dispatchEvent: () => true,
13
13
  })
14
14
 
15
15
  // Node 26 also exposes a host localStorage getter. Use jsdom's window storage.
16
16
  declare const jsdom: { window: Window }
17
+
17
18
  vi.stubGlobal('localStorage', jsdom.window.localStorage)
@@ -4,17 +4,17 @@
4
4
  import '@valor/nativescript-websockets'
5
5
  import { Application } from '@nativescript/core'
6
6
  import {
7
- NativeScriptVitestCoordinator,
8
- createNativeScriptTestRegistry,
7
+ NativeScriptVitestCoordinator,
8
+ createNativeScriptTestRegistry,
9
9
  } from '@nativescript/unit-test-runner/runtime'
10
10
 
11
11
  import { createVitestHostPage } from '@nativescript/unit-test-runner/testing'
12
12
 
13
13
  const coordinator = new NativeScriptVitestCoordinator({
14
- // Every spec matched by vitest.config.mts `include` must also match this
15
- // glob — vite statically bundles each as a lazily imported chunk that the
16
- // registry loads on demand.
17
- registry: createNativeScriptTestRegistry(import.meta.glob('./**/*.spec.{ts,tsx,tsrx}')),
14
+ // Every spec matched by vitest.config.mts `include` must also match this
15
+ // glob — vite statically bundles each as a lazily imported chunk that the
16
+ // registry loads on demand.
17
+ registry: createNativeScriptTestRegistry(import.meta.glob('./**/*.spec.{ts,tsx,tsrx}')),
18
18
  })
19
19
 
20
20
  void coordinator.start()
@@ -1,4 +1,12 @@
1
1
  {
2
+ "contentMappers": [
3
+ {
4
+ "package": "octane-xplat",
5
+ "extensions": [
6
+ ".tsrx"
7
+ ]
8
+ }
9
+ ],
2
10
  "compilerOptions": {
3
11
  "strict": true,
4
12
  "target": "ESNext",
@@ -28,7 +36,15 @@
28
36
  ],
29
37
  "noEmit": true,
30
38
  "skipLibCheck": true,
31
- "allowImportingTsExtensions": true
39
+ "allowImportingTsExtensions": true,
40
+ "paths": {
41
+ "@nativescript/core": [
42
+ "./node_modules/@nativescript/core"
43
+ ],
44
+ "@nativescript/core/*": [
45
+ "./node_modules/@nativescript/core/*"
46
+ ]
47
+ }
32
48
  },
33
49
  "include": [
34
50
  "src/**/*"
@@ -1,5 +1,4 @@
1
- import { defineConfig } from 'vite'
2
- import { xplatNative } from '@octane-xplat/cli/vite'
1
+ import { defineConfig, xplatNative } from 'octane-xplat/vite'
3
2
 
4
3
  // The shared preset owns the renderer rules, octane→universal/native alias,
5
4
  // suffix extension chain, deps-bundle plugin exclusions, the HMR watchdog,
@@ -1,30 +1,36 @@
1
- import { defineConfig } from 'vite'
2
- import { octane } from '@octanejs/vite-plugin'
3
- import { xplatCss, xplatBoundary, xplatDevBridge, xplatNodeEnvDefine } from '@octane-xplat/cli/vite'
1
+ import {
2
+ defineConfig,
3
+ octane,
4
+ xplatCss,
5
+ xplatBoundary,
6
+ xplatDevBridge,
7
+ xplatNodeEnvDefine,
8
+ } from 'octane-xplat/vite'
4
9
 
5
10
  // The web build. For native (iOS/Android), the same source runs through
6
11
  // @nativescript-community/vite-octane with `conditions: ['native']`, the
7
12
  // .ios/.android/.mobile suffix chain, and the unsuffixed native default — see
8
13
  // the octane-xplat repo's apps/mobile/vite.config.mts.
9
14
  export default defineConfig(({ mode }) => ({
10
- plugins: [xplatCss('web'), ...octane(), xplatBoundary('web'), xplatDevBridge()],
11
- define: xplatNodeEnvDefine(mode),
12
- server: { port: 5200 },
13
- resolve: {
14
- conditions: ['web'],
15
- // Suffix chain (first match wins): .web → shared → fallback.
16
- extensions: [
17
- '.web.tsrx',
18
- '.tsrx',
19
- '.web.tsx',
20
- '.tsx',
21
- '.web.ts',
22
- '.mjs',
23
- '.mts',
24
- '.ts',
25
- '.jsx',
26
- '.js',
27
- '.json',
28
- ],
29
- },
15
+ plugins: [xplatCss('web'), ...octane(), xplatBoundary('web'), xplatDevBridge()],
16
+ define: xplatNodeEnvDefine(mode),
17
+ server: { port: 5200 },
18
+ resolve: {
19
+ conditions: ['web'],
20
+ // Suffix chain (first match wins): .web → shared → fallback.
21
+ // xplatBoundary also uses this order for dependency optimization in dev.
22
+ extensions: [
23
+ '.web.tsrx',
24
+ '.tsrx',
25
+ '.web.tsx',
26
+ '.tsx',
27
+ '.web.ts',
28
+ '.mjs',
29
+ '.mts',
30
+ '.ts',
31
+ '.jsx',
32
+ '.js',
33
+ '.json',
34
+ ],
35
+ },
30
36
  }))