@nativue/core 0.20.0 → 0.21.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
@@ -124,6 +124,11 @@ Import the runtime from `vue`: `ref`, `computed`, `StyleSheet`, `Animated`, `Lay
124
124
  `@nativue/location` (`usePermission(Location.getPermission, Location.requestPermission)`, then
125
125
  `Location.getCurrentPosition({ accuracy })` or `Location.watchPosition(options, onPosition)`; iOS texts and
126
126
  `background` in `location({...})` from `@nativue/location/plugin`),
127
+ `@nativue/maps` (`<MapView :initial-camera="{ center, zoom }">` with `<Marker :coordinate>` (or Vue content
128
+ inside it), `<Polyline>`, `<Polygon>`, `<Circle>`; `:clustering="true"` and a `#cluster="{ count }"` slot; a ref has
129
+ `animateCamera`, `fitToCoordinates`, `getCamera`; coordinates are `{ latitude, longitude }`; Apple Maps on iOS,
130
+ Android draws with the provider package named in `maps({ provider: { android } })` from `@nativue/maps/plugin`:
131
+ `@nativue/maps-maplibre`, whose `mapLibre({ style })` sets the style, OpenFreeMap's by default),
127
132
  `@nativue/webview` (`<WebView :source="{ uri }" @message>`, sized by its style; a ref has `goBack`, `reload`,
128
133
  `evaluateJavaScript(expression)`, `postMessage(data)`; the page posts with `window.nativueWebView.postMessage`).
129
134
  A package with native code needs the app
@@ -54,7 +54,8 @@ fun androidPlugin(name: String, directory: File, nativue: Map<*, *>?): AndroidPl
54
54
  val projectPath = ":" + name.removePrefix("@").replace('/', '-')
55
55
 
56
56
  include(projectPath)
57
- project(projectPath).projectDir = File(directory, android["sources"] as String)
57
+ // The real path: through node_modules links (workspaces), Kotlin's incremental builds lose track of files.
58
+ project(projectPath).projectDir = File(directory, android["sources"] as String).canonicalFile
58
59
 
59
60
  return AndroidPlugin(projectPath, android["plugin"] as String)
60
61
  }
package/cli/link.mjs CHANGED
@@ -62,7 +62,11 @@ export function nativuePackages(appDirectory) {
62
62
  const manifest = directory && readJson(join(directory, 'package.json'))
63
63
  const isForNativue = manifest?.nativue || manifest?.peerDependencies?.['@nativue/core']
64
64
 
65
- if (manifest?.nativue) found.push({ name, directory, nativue: manifest.nativue })
65
+ if (manifest?.nativue) {
66
+ const requires = Object.keys({ ...manifest.dependencies, ...manifest.peerDependencies })
67
+
68
+ found.push({ name, directory, nativue: manifest.nativue, requires })
69
+ }
66
70
  if (isForNativue) {
67
71
  Object.keys(manifest.dependencies ?? {}).forEach((dependency) =>
68
72
  pending.push([dependency, directory]),
@@ -76,19 +80,17 @@ export function nativuePackages(appDirectory) {
76
80
  }
77
81
 
78
82
  function iosPlugins(appDirectory) {
79
- return nativuePackages(appDirectory).flatMap(({ name, directory, nativue }) => {
80
- const ios = nativue.ios
81
- if (!ios) return []
82
-
83
- return [
84
- {
85
- module: moduleName(name),
86
- sources: join(directory, ios.sources),
87
- plugin: ios.plugin,
88
- dependencies: ios.dependencies ?? [],
89
- },
90
- ]
91
- })
83
+ const packages = nativuePackages(appDirectory).filter(({ nativue }) => nativue.ios)
84
+ const linkedNames = new Set(packages.map(({ name }) => name))
85
+
86
+ return packages.map(({ name, directory, nativue, requires }) => ({
87
+ module: moduleName(name),
88
+ sources: join(directory, nativue.ios.sources),
89
+ plugin: nativue.ios.plugin,
90
+ dependencies: nativue.ios.dependencies ?? [],
91
+ // Linked packages it depends on (a map provider on @nativue/maps): their modules, to import.
92
+ modules: requires.filter((required) => linkedNames.has(required)).map(moduleName),
93
+ }))
92
94
  }
93
95
 
94
96
  /** native/<name>/ios: module App<Name> (not <Name>, which could hide a system module like Photos). */
@@ -140,11 +142,13 @@ function swiftPackages(plugins) {
140
142
 
141
143
  function packageManifest(plugins, corePath) {
142
144
  const nativue = '.product(name: "Nativue", package: "core")'
143
- const pluginTargets = plugins.map(({ module, dependencies }) => {
145
+ const pluginTargets = plugins.map(({ module, dependencies, modules = [] }) => {
144
146
  const products = dependencies.flatMap(({ url, products }) =>
145
147
  products.map((product) => `.product(name: "${product}", package: "${packageIdentity(url)}")`),
146
148
  )
147
- const targetDependencies = [nativue, ...products].join(', ')
149
+ const targetDependencies = [nativue, ...modules.map((name) => `"${name}"`), ...products].join(
150
+ ', ',
151
+ )
148
152
 
149
153
  return ` .target(name: "${module}", dependencies: [${targetDependencies}], path: "Sources/${module}"),\n`
150
154
  })
package/cli/nativue.mjs CHANGED
@@ -291,6 +291,8 @@ async function dev() {
291
291
  build: {
292
292
  ...config.build,
293
293
  lib: false,
294
+ // As the lib build does: an imported image is a data: URL, which the app loads with no server.
295
+ assetsInlineLimit: () => true,
294
296
  rolldownOptions: {
295
297
  input: frameworkPath('src/entry.ts'),
296
298
  experimental: { devMode: { lazy: false } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativue/core",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Vue rendering real native views on iOS and Android",
5
5
  "keywords": [
6
6
  "vue",