@tileflow/vite 0.1.0-alpha.21 → 0.1.0-alpha.22

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 (2) hide show
  1. package/README.md +91 -44
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,73 +1,120 @@
1
1
  # @tileflow/vite
2
2
 
3
- Vite plugin for local Tileflow style development and static build artifacts.
3
+ Prepare Tileflow styles and assets inside a Vite application. Development watches config and asset
4
+ changes; production emits the same prepared manifest, concrete-theme styles, sprites, and fonts.
5
+ Use a browser adapter separately to render the map.
6
+
7
+ > Related packages and guides: [documentation index](https://raw.githubusercontent.com/tileflow/tileflow-sdk/main/llms.txt).
8
+
9
+ ## Install
10
+
11
+ Use an existing Vite 5–8 application. Tileflow requires Node.js 22 or newer; the selected Vite release
12
+ may impose a higher Node.js minor version.
13
+
14
+ ```sh
15
+ npm install --save-dev @tileflow/vite@alpha
16
+ npm install @tileflow/core@alpha @tileflow/maps@alpha
17
+ ```
18
+
19
+ For the browser component and its peers, follow the
20
+ [React](https://github.com/tileflow/tileflow-sdk/blob/main/packages/react/README.md),
21
+ [Vue](https://github.com/tileflow/tileflow-sdk/blob/main/packages/vue/README.md), or
22
+ [Svelte](https://github.com/tileflow/tileflow-sdk/blob/main/packages/svelte/README.md) guide. Those
23
+ adapters support MapLibre GL JS `>=6.4.1 <7`.
24
+
25
+ ## Configure a map
26
+
27
+ Create `tileflow.config.ts` at the application root:
28
+
29
+ <!-- docs:check -->
30
+
31
+ ```ts
32
+ import {defineMap} from '@tileflow/core';
33
+ import {streets} from '@tileflow/maps';
34
+
35
+ export default defineMap({id: 'madrid', version: 1, extends: streets});
36
+ ```
37
+
38
+ Add `tileflow()` to the existing Vite plugins in `vite.config.ts`. Keep your existing framework
39
+ plugins; this minimal configuration shows only the Tileflow integration:
40
+
41
+ <!-- docs:check -->
4
42
 
5
43
  ```ts
6
- import react from '@vitejs/plugin-react';
7
44
  import {defineConfig} from 'vite';
8
45
  import {tileflow} from '@tileflow/vite';
9
46
 
10
- export default defineConfig({
11
- plugins: [react(), tileflow()],
12
- });
47
+ export default defineConfig({plugins: [tileflow()]});
13
48
  ```
14
49
 
15
- Omitting a component's `manifestUrl` is valid only when the public URL is exactly
16
- `/tileflow/manifest.json`. With a Vite or Tileflow base, pass the resulting public URL explicitly;
17
- the browser runtime deliberately does not guess bundler configuration:
50
+ Run the application's normal development or production-build command. At the default base, the
51
+ component can use `source={{kind: 'tileflow', map: 'madrid'}}`; it reads
52
+ `/tileflow/manifest.json`. Do not also run a CLI build that overwrites the same delivery manifest.
53
+ Config loading executes trusted imports and is not a sandbox.
54
+
55
+ ## Configure the worker
56
+
57
+ In a React application's client entry, before mounting an interactive map:
18
58
 
19
59
  ```ts
60
+ import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
61
+ import {configureTileflowMapLibre} from '@tileflow/react';
62
+
63
+ configureTileflowMapLibre({workerUrl});
64
+ ```
65
+
66
+ Vue and Svelte import the configuration function from their own adapter. This URL import is
67
+ Vite-specific. Keep the worker and main module from the same installed MapLibre version, and import
68
+ `maplibre-gl/dist/maplibre-gl.css` in the client. The browser needs the emitted worker closure, not
69
+ a CDN worker from another version.
70
+
71
+ ## Serve under a subpath
72
+
73
+ Set the build bases in `vite.config.ts`:
74
+
75
+ <!-- docs:check -->
76
+
77
+ ```ts
78
+ import {defineConfig} from 'vite';
79
+ import {tileflow} from '@tileflow/vite';
80
+
20
81
  export default defineConfig({
21
82
  base: '/app/',
22
- plugins: [react(), tileflow({base: '/maps'})],
83
+ plugins: [tileflow({base: '/maps'})],
23
84
  });
85
+ ```
86
+
87
+ In the application, pass the resulting public URL explicitly:
24
88
 
25
- // React; Vue and Svelte use the same source value.
89
+ ```ts
26
90
  const source = {
27
91
  kind: 'tileflow' as const,
28
- map: 'main',
92
+ map: 'madrid',
29
93
  manifestUrl: '/app/maps/manifest.json',
30
94
  };
31
95
  ```
32
96
 
33
- Development and production expose that same prefixed URL.
97
+ Development and production expose the same prefixed URL. The browser does not infer Vite's base;
98
+ omitting `manifestUrl` is correct only for exactly `/tileflow/manifest.json`.
34
99
 
35
- ## MapLibre 6 worker
100
+ ## Assets and capture
36
101
 
37
- Vite applications configure the MapLibre worker in their client entry before mounting an interactive
38
- Tileflow map:
102
+ Development watches transitive config imports and local icon/font inputs, and serves the latest
103
+ valid generation. Invalid edits retain the last good snapshot. Local PMTiles are snapshotted for
104
+ coherent requests. Production rejects unresolved local PMTiles; publish managed data explicitly or
105
+ supply an application-owned production source. The plugin does not copy, hash, or publish datasets.
39
106
 
40
- ```ts
41
- import {configureTileflowMapLibre} from '@tileflow/react';
42
- import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
43
-
44
- configureTileflowMapLibre({workerUrl});
45
- ```
46
-
47
- Import `configureTileflowMapLibre` from the adapter in use (`@tileflow/react`, `@tileflow/vue`, or
48
- `@tileflow/svelte`). Vite emits the matching worker closure from the application's installed
49
- MapLibre package. MapLibre GL JS 6.4.1-6.x is supported.
50
-
51
- Development snapshots local `hostedTileset()` archives for coherent preview requests. Production
52
- builds reject unresolved local PMTiles before emitting Tileflow assets; they never copy, hash, or
53
- deduplicate user datasets. Publish a managed tileset explicitly or provide an application-owned
54
- production source. Development Style URLs remain stable by logical tileset ID while the served
55
- snapshot changes by generation.
56
-
57
- The Vite process is the only application server needed. It watches config, transitive imports, and
58
- local icon/font files, serves the Tileflow manifest, styles, sprites, and prepared fonts, and reloads
59
- from the latest valid generation. To capture an application scene, keep `vite` running and point the
60
- short-lived headless command at that same loopback origin; do not start `tileflow dev`:
107
+ The normal Vite process is the only application server needed. Keep it running in one terminal.
108
+ With the [CLI](https://github.com/tileflow/tileflow-sdk/blob/main/packages/cli/README.md) installed
109
+ and an `app-desktop` application scene defined, run in another terminal:
61
110
 
62
111
  ```sh
63
- npm run dev
64
- TILEFLOW_APP_ORIGIN=http://127.0.0.1:5173 npx tileflow capture app-desktop
112
+ npx tileflow capture app-desktop --url http://127.0.0.1:5173/ --json
65
113
  ```
66
114
 
67
- ## Compatibility
68
-
69
- The supported peer window is Vite 5-8 on Node.js 22 or newer. CI installs the exact first release
70
- of each accepted Vite major with packed Tileflow tarballs, typechecks the plugin contract, and runs
71
- a production Vite build. Future majors remain excluded until the same smoke passes.
115
+ Use the application's actual loopback URL. Do not start a second `tileflow dev` listener.
116
+ Local preparation needs no Tileflow key; rendering can still fetch remote map resources.
72
117
 
73
- Docs: https://tileflow.dev/docs
118
+ CI tests the accepted Vite major boundaries with packed packages and production builds. Future
119
+ majors remain excluded until verified. For a published release, prefer its installed README and types
120
+ rather than newer source on `main`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/vite",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Vite plugin for Tileflow map style development and static artifacts.",
6
6
  "engines": {
@@ -41,14 +41,14 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@tileflow/dev": ">=0.1.0-alpha.23 <0.1.0-beta.0"
44
+ "@tileflow/dev": ">=0.1.0-alpha.24 <0.1.0-beta.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vite": ">=5 <9"
48
48
  },
49
49
  "devDependencies": {
50
50
  "vite": "^8.0.16",
51
- "@tileflow/maps": "0.1.0-alpha.3"
51
+ "@tileflow/maps": "0.1.0-alpha.4"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tsup src/index.ts --format esm --dts --clean --external vite --platform node",