@nativue/core 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.
package/AGENTS.md CHANGED
@@ -99,7 +99,8 @@ Import the runtime from `vue`: `ref`, `computed`, `StyleSheet`, `Animated`, `Lay
99
99
  `clear`; promise-based, string values. Store objects as JSON. For large data or queries, use
100
100
  `@nativue/sqlite`.
101
101
  - `fetch`, `XMLHttpRequest`, `Blob`, `FileReader`, `URL`, `URLSearchParams`, timers and `console`
102
- work as on the web, with no import.
102
+ work as on the web, with no import. Release builds leave out `console.log`, `info`, `debug`,
103
+ `trace`, `table`, `dir` and `group` calls; `warn`, `error` and `assert` stay.
103
104
  - Accessibility: `role` and `aria-*` attributes (`aria-label`, `aria-hidden`...) on any component.
104
105
 
105
106
  ## Project
@@ -119,7 +120,12 @@ Import the runtime from `vue`: `ref`, `computed`, `StyleSheet`, `Animated`, `Lay
119
120
  `@nativue/network` (`useNetworkState()`: `{ isConnected, isInternetReachable, type, isExpensive }`, live),
120
121
  `@nativue/share` (`Share.share({ text, url, files })` opens the system's share sheet),
121
122
  `@nativue/auth-session` (OAuth: `AuthSession.open(url, 'myapp://oauth')` with `createPKCE()`; keep tokens in secure-store),
122
- `@nativue/biometrics` (`Biometrics.authenticate({ reason })` resolves `{ success }` or `{ success: false, error }`).
123
+ `@nativue/biometrics` (`Biometrics.authenticate({ reason })` resolves `{ success }` or `{ success: false, error }`),
124
+ `@nativue/location` (`usePermission(Location.getPermission, Location.requestPermission)`, then
125
+ `Location.getCurrentPosition({ accuracy })` or `Location.watchPosition(options, onPosition)`; iOS texts and
126
+ `background` in `location({...})` from `@nativue/location/plugin`),
127
+ `@nativue/webview` (`<WebView :source="{ uri }" @message>`, sized by its style; a ref has `goBack`, `reload`,
128
+ `evaluateJavaScript(expression)`, `postMessage(data)`; the page posts with `window.nativueWebView.postMessage`).
123
129
  A package with native code needs the app
124
130
  rebuilt with `npm run ios` or `npm run android`, not just a reload.
125
131
  - Notifications: `Notifications.schedule({ title, body, data }, { seconds } | { date } | { hour, minute } | null)`
package/cli/nativue.mjs CHANGED
@@ -36,6 +36,19 @@ const BUNDLE_PATH = `${BUNDLE_DIRECTORY}/main.bundle.js`
36
36
  const ANDROID_ASSETS_DIRECTORY = 'android/app/src/main/assets'
37
37
  const KEEPALIVE_INTERVAL_MS = 15000
38
38
  const UNANSWERED_UPDATE_TIMEOUT_MS = 10000
39
+ // What a release build leaves out: logs slow the JavaScript thread and land in the device's log, which
40
+ // Android keeps readable. warn, error and assert stay, for problems in the field.
41
+ const DEVELOPMENT_CONSOLE_METHODS = [
42
+ 'log',
43
+ 'info',
44
+ 'debug',
45
+ 'trace',
46
+ 'table',
47
+ 'dir',
48
+ 'group',
49
+ 'groupCollapsed',
50
+ 'groupEnd',
51
+ ]
39
52
 
40
53
  const NATIVE_COMPONENT_TAGS = [
41
54
  'View',
@@ -165,6 +178,19 @@ const APP_VITE_PLUGINS = [
165
178
  ...appPlugins.flatMap((plugin) => plugin.vite ?? []),
166
179
  ]
167
180
 
181
+ /**
182
+ * Each method an empty function the minifier then drops with its call, even where the call's value is
183
+ * used (`onPress: () => console.log(item)`). Arguments that do something still run.
184
+ */
185
+ function withoutDevelopmentLogs() {
186
+ return Object.fromEntries(
187
+ DEVELOPMENT_CONSOLE_METHODS.flatMap((method) => [
188
+ [`console.${method}`, '(() => {})'],
189
+ [`globalThis.console.${method}`, '(() => {})'],
190
+ ]),
191
+ )
192
+ }
193
+
168
194
  function viteConfig({ mode, plugins = [] }) {
169
195
  // Vite reads the mode from NODE_ENV: development builds keep each component's file (for errors).
170
196
  process.env.NODE_ENV = mode
@@ -199,7 +225,10 @@ function viteConfig({ mode, plugins = [] }) {
199
225
  { find: /^@\//, replacement: `${process.cwd()}/src/` },
200
226
  ],
201
227
  },
202
- define: { 'process.env.NODE_ENV': JSON.stringify(mode) },
228
+ define: {
229
+ 'process.env.NODE_ENV': JSON.stringify(mode),
230
+ ...(mode === 'production' ? withoutDevelopmentLogs() : {}),
231
+ },
203
232
  build: {
204
233
  lib: {
205
234
  entry: frameworkPath('src/entry.ts'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativue/core",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Vue rendering real native views on iOS and Android",
5
5
  "keywords": [
6
6
  "vue",