@flighthq/host-tauri 0.5.1-next.1295.2b6bfa3 → 0.5.1-next.1345.0995dc5

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/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/host-tauri`. The `@f
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/host-tauri@0.5.1-next.1295.2b6bfa3](https://github.com/flighthq/flight/tree/2b6bfa33110e26cbdd959441a6c36a4c78109ab8/packages/host-tauri)
17
- - [License](https://github.com/flighthq/flight/blob/2b6bfa33110e26cbdd959441a6c36a4c78109ab8/LICENSE.md)
16
+ - [Source for @flighthq/host-tauri@0.5.1-next.1345.0995dc5](https://github.com/flighthq/flight/tree/0995dc5f840e6b57c3e85ecd2123aa798cf60b29/packages/host-tauri)
17
+ - [License](https://github.com/flighthq/flight/blob/0995dc5f840e6b57c3e85ecd2123aa798cf60b29/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/host-tauri",
3
- "version": "0.5.1-next.1295.2b6bfa3",
3
+ "version": "0.5.1-next.1345.0995dc5",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,19 +38,19 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/app": "0.5.1-next.1295.2b6bfa3",
42
- "@flighthq/application": "0.5.1-next.1295.2b6bfa3",
43
- "@flighthq/clipboard": "0.5.1-next.1295.2b6bfa3",
44
- "@flighthq/dialog": "0.5.1-next.1295.2b6bfa3",
45
- "@flighthq/entity": "0.5.1-next.1295.2b6bfa3",
46
- "@flighthq/menu": "0.5.1-next.1295.2b6bfa3",
47
- "@flighthq/notification": "0.5.1-next.1295.2b6bfa3",
48
- "@flighthq/platform": "0.5.1-next.1295.2b6bfa3",
49
- "@flighthq/shortcut": "0.5.1-next.1295.2b6bfa3",
50
- "@flighthq/shell": "0.5.1-next.1295.2b6bfa3",
51
- "@flighthq/signals": "0.5.1-next.1295.2b6bfa3",
52
- "@flighthq/tray": "0.5.1-next.1295.2b6bfa3",
53
- "@flighthq/types": "0.5.1-next.1295.2b6bfa3"
41
+ "@flighthq/app": "0.5.1-next.1345.0995dc5",
42
+ "@flighthq/application": "0.5.1-next.1345.0995dc5",
43
+ "@flighthq/clipboard": "0.5.1-next.1345.0995dc5",
44
+ "@flighthq/dialog": "0.5.1-next.1345.0995dc5",
45
+ "@flighthq/entity": "0.5.1-next.1345.0995dc5",
46
+ "@flighthq/menu": "0.5.1-next.1345.0995dc5",
47
+ "@flighthq/notification": "0.5.1-next.1345.0995dc5",
48
+ "@flighthq/platform": "0.5.1-next.1345.0995dc5",
49
+ "@flighthq/shortcut": "0.5.1-next.1345.0995dc5",
50
+ "@flighthq/shell": "0.5.1-next.1345.0995dc5",
51
+ "@flighthq/signals": "0.5.1-next.1345.0995dc5",
52
+ "@flighthq/tray": "0.5.1-next.1345.0995dc5",
53
+ "@flighthq/types": "0.5.1-next.1345.0995dc5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "typescript": "^5.3.0"
@@ -1,4 +1,5 @@
1
1
  import { readClipboardText } from '@flighthq/clipboard/contract';
2
+ import { createHost } from '@flighthq/entity/contract';
2
3
  import { getPlatformName } from '@flighthq/platform/contract';
3
4
  import { EntityRuntimeKey } from '@flighthq/types/contract';
4
5
  import type { TauriApi } from '@flighthq/types/contract';
@@ -123,11 +124,12 @@ function fakeTauri(): TauriApi {
123
124
  }
124
125
 
125
126
  describe('tauriHost', () => {
126
- it('constructs one Entity with all 26 direct groups and exact supported slots', async () => {
127
+ it('constructs one Entity with every Host group and exact supported slots', async () => {
127
128
  const host = publicApi.tauriHost(fakeTauri(), 'linux');
129
+ const hostGroups = Object.keys(createHost()).sort();
128
130
  expect(EntityRuntimeKey in host).toBe(true);
129
- expect(GROUPS).toHaveLength(26);
130
- expect(Object.keys(host).sort()).toEqual(GROUPS.map(([group]) => group).sort());
131
+ expect(GROUPS.map(([group]) => group).sort()).toEqual(hostGroups);
132
+ expect(Object.keys(host).sort()).toEqual(hostGroups);
131
133
  for (const group of UNSUPPORTED_GROUPS) expect(host[group], group).toEqual({});
132
134
  expect(Object.keys(host.app).sort()).toEqual(['hide', 'locale', 'name', 'quit', 'relaunch', 'show', 'version']);
133
135
  expect(Object.keys(host.clipboard)).toEqual(['text']);
@@ -149,7 +151,6 @@ describe('tauriHost', () => {
149
151
  const publicNames = Object.keys(publicApi).sort();
150
152
  const contractNames = Object.keys(contractApi).sort();
151
153
 
152
- expect(expected).toHaveLength(59);
153
154
  expect(publicNames).toEqual(expected);
154
155
  expect(contractNames).toEqual(expected);
155
156
  for (const name of expected) {
@@ -1,5 +1,5 @@
1
1
  import { execFileSync } from 'node:child_process';
2
- import { readFileSync } from 'node:fs';
2
+ import { readFileSync, readdirSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
4
 
5
5
  import { rollup } from 'rollup';
@@ -14,23 +14,6 @@ const PACKAGE_ROOT = resolve(__dirname, '..');
14
14
  const DIST_ROOT = resolve(PACKAGE_ROOT, 'dist');
15
15
  const PACK_TIMEOUT_MS = 120_000;
16
16
 
17
- const PACKED_MODULES = [
18
- 'contract',
19
- 'index',
20
- 'tauriApp',
21
- 'tauriClipboard',
22
- 'tauriDialog',
23
- 'tauriHost',
24
- 'tauriMenu',
25
- 'tauriNotification',
26
- 'tauriPlatform',
27
- 'tauriShell',
28
- 'tauriShortcut',
29
- 'tauriTray',
30
- 'tauriUnsupportedHostGroups',
31
- 'tauriWindow',
32
- ] as const;
33
-
34
17
  const ENTITY_CONSTRUCTORS = [
35
18
  'tauriHost',
36
19
  'tauriHostApp',
@@ -115,8 +98,17 @@ interface PackResult {
115
98
 
116
99
  let packedFiles: string[];
117
100
 
101
+ // `npm pack` would run this package's `prepack`, whose `tsc -b --clean` walks every project reference and
102
+ // deletes then rebuilds thousands of files across the referenced packages (all of `types/dist` included)
103
+ // on every test run, while other workers read them. Cleaning only this package's outputs and letting
104
+ // `tsc -b` rebuild incrementally still packs a fresh, clean build of the surface under test.
118
105
  beforeAll(() => {
119
- const output = execFileSync('npm', ['pack', '--dry-run', '--json'], {
106
+ execFileSync('npm', ['run', 'clean:dist'], { cwd: PACKAGE_ROOT, stdio: 'ignore' });
107
+ execFileSync(process.execPath, [resolve(ROOT, 'node_modules/typescript/bin/tsc'), '-b'], {
108
+ cwd: PACKAGE_ROOT,
109
+ stdio: 'ignore',
110
+ });
111
+ const output = execFileSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], {
120
112
  cwd: PACKAGE_ROOT,
121
113
  encoding: 'utf8',
122
114
  });
@@ -124,11 +116,16 @@ beforeAll(() => {
124
116
  packedFiles = packed[0]!.files.map((file) => file.path).sort();
125
117
  }, PACK_TIMEOUT_MS);
126
118
 
127
- describe('packed Tauri host surface', () => {
128
- it('ships exactly the clean canonical production modules', () => {
129
- const expected = PACKED_MODULES.flatMap((module) =>
130
- ['d.ts', 'd.ts.map', 'js', 'js.map'].map((extension) => `dist/${module}.${extension}`),
131
- ).sort();
119
+ // These build TypeScript programs over the emitted declarations: a few hundred milliseconds alone, but they
120
+ // share the CPU with every other worker in the aggregate run. The budget is contention headroom, not a deadline.
121
+ describe('packed Tauri host surface', { timeout: 30_000 }, () => {
122
+ it('ships exactly one clean build of every production source module', () => {
123
+ const sourceModules = readdirSync(resolve(PACKAGE_ROOT, 'src'))
124
+ .filter((name) => name.endsWith('.ts') && !name.endsWith('.test.ts'))
125
+ .map((name) => name.slice(0, -'.ts'.length));
126
+ const expected = sourceModules
127
+ .flatMap((module) => ['d.ts', 'd.ts.map', 'js', 'js.map'].map((extension) => `dist/${module}.${extension}`))
128
+ .sort();
132
129
  const emitted = packedFiles.filter((path) => path.startsWith('dist/'));
133
130
 
134
131
  expect(emitted).toEqual(expected);
@@ -155,7 +152,6 @@ describe('packed Tauri host surface', () => {
155
152
 
156
153
  expect(moduleExportNames(checker, publicSource)).toEqual(runtimeNames);
157
154
  expect(moduleExportNames(checker, contractSource)).toEqual(runtimeNames);
158
- expect(runtimeNames).toHaveLength(59);
159
155
  });
160
156
 
161
157
  it('emits Entity return types for exactly the constructors that allocate entities', () => {
@@ -118,13 +118,11 @@ async function acquire(hostTrayLifecycle: ReturnType<typeof tauriHostTray>['life
118
118
  }
119
119
 
120
120
  describe('tauriHostTray', () => {
121
- it('exposes only the slots supported by the injected OS profile', () => {
121
+ it('exposes the slots supported by the injected OS profile and none exclusive to another', () => {
122
122
  const { tauri } = fakeTauri();
123
- expect(Object.keys(tauriHostTray(tauri, 'linux')).sort()).toEqual(
124
- ['image', 'lifecycle', 'menu', 'menuSelectionEvents', 'title'].sort(),
125
- );
126
- expect(Object.keys(tauriHostTray(tauri, 'macos')).sort()).toEqual(
127
- [
123
+ const supported = {
124
+ linux: ['image', 'lifecycle', 'menu', 'menuSelectionEvents', 'title'],
125
+ macos: [
128
126
  'image',
129
127
  'interactionEvents',
130
128
  'lifecycle',
@@ -133,11 +131,21 @@ describe('tauriHostTray', () => {
133
131
  'templateImage',
134
132
  'title',
135
133
  'tooltip',
136
- ].sort(),
137
- );
138
- expect(Object.keys(tauriHostTray(tauri, 'windows')).sort()).toEqual(
139
- ['image', 'interactionEvents', 'lifecycle', 'menu', 'menuSelectionEvents', 'tooltip'].sort(),
140
- );
134
+ ],
135
+ windows: ['image', 'interactionEvents', 'lifecycle', 'menu', 'menuSelectionEvents', 'tooltip'],
136
+ } as const;
137
+ for (const profile of ['linux', 'macos', 'windows'] as const) {
138
+ const slots = Object.keys(tauriHostTray(tauri, profile));
139
+ const exclusiveElsewhere: readonly string[] = Object.entries(supported)
140
+ .filter(([other]) => other !== profile)
141
+ .flatMap(([, others]) => others)
142
+ .filter((slot) => !(supported[profile] as readonly string[]).includes(slot));
143
+ expect(slots, profile).toEqual(expect.arrayContaining([...supported[profile]]));
144
+ expect(
145
+ slots.filter((slot) => exclusiveElsewhere.includes(slot)),
146
+ profile,
147
+ ).toEqual([]);
148
+ }
141
149
  });
142
150
 
143
151
  it('publishes only after asynchronous native acquisition resolves', async () => {
@@ -98,41 +98,42 @@ function methods(state: FakeWindowState): string[] {
98
98
  }
99
99
 
100
100
  describe('tauriHostWindow', () => {
101
- it('adapter-roster axis: publishes exactly 24 P1 operations and omits the four false members', () => {
101
+ it('adapter-roster axis: publishes the supported P1 operations and omits the four false members', () => {
102
102
  const { tauri } = fakeTauri();
103
103
  const backend = tauriHostWindow(tauri);
104
104
 
105
105
  expect(EntityRuntimeKey in backend).toBe(true);
106
- expect(
107
- Object.keys(backend)
108
- .filter((operation) => operation !== 'attach')
109
- .sort(),
110
- ).toEqual([
111
- 'center',
112
- 'close',
113
- 'flashWindowFrame',
114
- 'focus',
115
- 'getBounds',
116
- 'hide',
117
- 'maximize',
118
- 'minimize',
119
- 'open',
120
- 'requestAttention',
121
- 'restore',
122
- 'setAlwaysOnTop',
123
- 'setContentProtection',
124
- 'setFullscreen',
125
- 'setHasShadow',
126
- 'setIcon',
127
- 'setMaximumSize',
128
- 'setMinimumSize',
129
- 'setPosition',
130
- 'setResizable',
131
- 'setSize',
132
- 'setSkipTaskbar',
133
- 'setTitle',
134
- 'show',
135
- ]);
106
+ expect(Object.keys(backend)).toEqual(
107
+ expect.arrayContaining([
108
+ 'center',
109
+ 'close',
110
+ 'flashWindowFrame',
111
+ 'focus',
112
+ 'getBounds',
113
+ 'hide',
114
+ 'maximize',
115
+ 'minimize',
116
+ 'open',
117
+ 'requestAttention',
118
+ 'restore',
119
+ 'setAlwaysOnTop',
120
+ 'setContentProtection',
121
+ 'setFullscreen',
122
+ 'setHasShadow',
123
+ 'setIcon',
124
+ 'setMaximumSize',
125
+ 'setMinimumSize',
126
+ 'setPosition',
127
+ 'setResizable',
128
+ 'setSize',
129
+ 'setSkipTaskbar',
130
+ 'setTitle',
131
+ 'show',
132
+ ]),
133
+ );
134
+ for (const falseMember of ['setMenuBarVisible', 'setOpacity', 'setParent', 'setProgress']) {
135
+ expect(backend, falseMember).not.toHaveProperty(falseMember);
136
+ }
136
137
  });
137
138
 
138
139
  it('opens the current window and applies options', () => {