@open-pioneer/vite-plugin-pioneer 7.1.0-dev.20261029075349 → 7.1.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/CHANGELOG.md +86 -86
- package/dist/index.js +47 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Changelog @open-pioneer/vite-plugin-pioneer
|
|
2
2
|
|
|
3
|
-
## 7.1.0
|
|
3
|
+
## 7.1.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- 5b85124: Add the virtual module `open-pioneer:test-support` for tests of Trails packages.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
The module exports `messages`, the i18n messages of the importing package and of all its dependencies.
|
|
10
|
+
The record can be passed to the `messages` property of `PackageContextProvider` from `@open-pioneer/test-utils/react`.
|
|
11
|
+
It also exports `messageLocale`, the locale of these messages.
|
|
12
|
+
Both properties can be helpful when implementing browser tests for React components based on Trails.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Messages are returned in the first locale of the package's `i18n` array in `build.config.mjs` by default.
|
|
15
|
+
A different locale can be requested with a query, for example `open-pioneer:test-support?locale=de`.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
The module can only be imported from tests.
|
|
18
|
+
`vite dev` and `vite build` fail with an error when they encounter the import.
|
|
19
19
|
|
|
20
20
|
### Patch Changes
|
|
21
21
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
The plugin should now resolve the root-relative module ids requested by the warm cache correctly.
|
|
25
25
|
- Updated dependencies [4e657f0]
|
|
26
26
|
- Updated dependencies [5b85124]
|
|
27
|
-
|
|
27
|
+
- @open-pioneer/build-common@5.1.0
|
|
28
28
|
|
|
29
29
|
## 7.0.1
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
- 9e63026: Replace the `@babel/*` dependencies used for code generation with `esrap`.
|
|
34
34
|
- 4337957: Update dependencies
|
|
35
35
|
- Updated dependencies [4337957]
|
|
36
|
-
|
|
36
|
+
- @open-pioneer/build-common@5.0.1
|
|
37
37
|
|
|
38
38
|
## 7.0.0
|
|
39
39
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
- Updated dependencies [8e38b33]
|
|
48
48
|
- Updated dependencies [8e38b33]
|
|
49
49
|
- Updated dependencies [8e38b33]
|
|
50
|
-
|
|
50
|
+
- @open-pioneer/build-common@5.0.0
|
|
51
51
|
|
|
52
52
|
## 6.0.3
|
|
53
53
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
- 3b1f9cf: Migrate from eslint to oxlint and from prettier to oxfmt
|
|
57
57
|
- Updated dependencies [3b1f9cf]
|
|
58
|
-
|
|
58
|
+
- @open-pioneer/build-common@4.0.3
|
|
59
59
|
|
|
60
60
|
## 6.0.2
|
|
61
61
|
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
- 82b4559: Fix parsing of `qualifier` for services defined by dependencies in `node_modules`.
|
|
66
66
|
- Updated dependencies [1a78924]
|
|
67
67
|
- Updated dependencies [82b4559]
|
|
68
|
-
|
|
68
|
+
- @open-pioneer/build-common@4.0.2
|
|
69
69
|
|
|
70
70
|
## 6.0.1
|
|
71
71
|
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
- 78e38e2: Bump various dependencies
|
|
75
75
|
- 7d706a3: Refactor: use private javascript properties instead of typescript private keyword
|
|
76
76
|
- Updated dependencies [78e38e2]
|
|
77
|
-
|
|
77
|
+
- @open-pioneer/build-common@4.0.1
|
|
78
78
|
|
|
79
79
|
## 6.0.0
|
|
80
80
|
|
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
|
|
87
87
|
- 9dda91c: Support a new virtual module to get the current deployment's base URL both during development and production:
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
```ts
|
|
90
|
+
import { baseUrl } from "open-pioneer:deployment";
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
// Base URL of the deployed application, for example:
|
|
93
|
+
// - http://localhost:5173/ or http://localhost:5173/optional/path/ (during development)
|
|
94
|
+
// - https://example.com/path/to/root/ (during production)
|
|
95
|
+
console.log(baseUrl);
|
|
96
|
+
```
|
|
97
97
|
|
|
98
98
|
- 18c9d75: Add codegen support for hot reloading of i18n message during development.
|
|
99
99
|
HMR of i18n messages requires the latest version of the runtime package.
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
- Updated dependencies [9dda91c]
|
|
108
108
|
- Updated dependencies [9dda91c]
|
|
109
109
|
- Updated dependencies [9dda91c]
|
|
110
|
-
|
|
110
|
+
- @open-pioneer/build-common@4.0.0
|
|
111
111
|
|
|
112
112
|
## 5.1.2
|
|
113
113
|
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
|
|
116
116
|
- 50ddcbd: Fix default package property values not being applied correctly when using a trails package from node modules.
|
|
117
117
|
- Updated dependencies [50ddcbd]
|
|
118
|
-
|
|
118
|
+
- @open-pioneer/build-common@3.2.2
|
|
119
119
|
|
|
120
120
|
## 5.1.1
|
|
121
121
|
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
- fa84b0e: Bump dependencies
|
|
125
125
|
- 093ae42: Prevent detection of duplicated packages on windows
|
|
126
126
|
- Updated dependencies [fa84b0e]
|
|
127
|
-
|
|
127
|
+
- @open-pioneer/build-common@3.2.1
|
|
128
128
|
|
|
129
129
|
## 5.1.0
|
|
130
130
|
|
|
@@ -132,27 +132,27 @@
|
|
|
132
132
|
|
|
133
133
|
- eac3ef4: Add service modules of trails packages from `node_modules` to the modules optimized by vite's deps optimizer.
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
This can reduce the number of events like this:
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
```
|
|
138
|
+
5:14:21 PM [vite] (client) ✨ new dependencies optimized: <...>
|
|
139
|
+
5:14:21 PM [vite] (client) ✨ optimized dependencies changed. reloading
|
|
140
|
+
```
|
|
141
141
|
|
|
142
142
|
- 19aa36f: Implement sourceId helper which provides an easy way to obtain an id for the current source file:
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
```ts
|
|
145
|
+
import { sourceId } from "open-pioneer:source-info";
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
// If imported from foo/bar/baz.ts in package my-package: my-package/foo/bar/baz
|
|
148
|
+
console.log(sourceId);
|
|
149
|
+
```
|
|
150
150
|
|
|
151
151
|
### Patch Changes
|
|
152
152
|
|
|
153
153
|
- eac3ef4: Switch from fast-glob to tinyglobby (it has fewer dependencies).
|
|
154
154
|
- Updated dependencies [19aa36f]
|
|
155
|
-
|
|
155
|
+
- @open-pioneer/build-common@3.2.0
|
|
156
156
|
|
|
157
157
|
## 5.0.3
|
|
158
158
|
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
|
|
161
161
|
- 2c45a18: Bump dependencies
|
|
162
162
|
- Updated dependencies [2c45a18]
|
|
163
|
-
|
|
163
|
+
- @open-pioneer/build-common@3.1.2
|
|
164
164
|
|
|
165
165
|
## 5.0.2
|
|
166
166
|
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
- fe37e18: Remove obsolete eslint directive from typings.
|
|
170
170
|
- f229f63: Bump dependencies
|
|
171
171
|
- Updated dependencies [f229f63]
|
|
172
|
-
|
|
172
|
+
- @open-pioneer/build-common@3.1.1
|
|
173
173
|
|
|
174
174
|
## 5.0.1
|
|
175
175
|
|
|
@@ -178,17 +178,17 @@
|
|
|
178
178
|
- 1b99d82: Update eslint to version 9.
|
|
179
179
|
- f12e73f: Emit better errors when an application's i18n configuration does not match the supported locales of its dependencies.
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
This can happen if:
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
- An application does not list the `i18n` option in its `build.config.mjs` at all, or if
|
|
184
|
+
- there is no overlap between the application's locales and the locales supported by one of its dependencies.
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
The vite plugin will now throw errors such as this to make it easier to detect the issue:
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
```
|
|
189
|
+
[plugin:pioneer:codegen] Invalid i18n configuration in application at <...>/src/samples/chakra-sample/chakra-app:
|
|
190
|
+
There is no match between the locales supported by the application (none) and the locales supported by the packages '@open-pioneer/chakra-snippets' (de, en).
|
|
191
|
+
```
|
|
192
192
|
|
|
193
193
|
## 5.0.0
|
|
194
194
|
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
- 6dc999e: Refactor caching of package.json, build.config.mjs and i18n files. Manual caching code was removed.
|
|
207
207
|
- Updated dependencies [340c415]
|
|
208
208
|
- Updated dependencies [ba600ea]
|
|
209
|
-
|
|
209
|
+
- @open-pioneer/build-common@3.1.0
|
|
210
210
|
|
|
211
211
|
## 4.0.2
|
|
212
212
|
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
|
|
215
215
|
- 26cb9d8: Bump dependencies
|
|
216
216
|
- Updated dependencies [26cb9d8]
|
|
217
|
-
|
|
217
|
+
- @open-pioneer/build-common@3.0.2
|
|
218
218
|
|
|
219
219
|
## 4.0.1
|
|
220
220
|
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
- 67ba039: Bump dependencies
|
|
226
226
|
- Updated dependencies [23c031a]
|
|
227
227
|
- Updated dependencies [67ba039]
|
|
228
|
-
|
|
228
|
+
- @open-pioneer/build-common@3.0.1
|
|
229
229
|
|
|
230
230
|
## 4.0.0
|
|
231
231
|
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
|
|
243
243
|
- Updated dependencies [798ef0b]
|
|
244
244
|
- Updated dependencies [798ef0b]
|
|
245
|
-
|
|
245
|
+
- @open-pioneer/build-common@3.0.0
|
|
246
246
|
|
|
247
247
|
## 3.0.5
|
|
248
248
|
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
- 7668cd9: Update dependencies.
|
|
253
253
|
- Updated dependencies [2526935]
|
|
254
254
|
- Updated dependencies [7668cd9]
|
|
255
|
-
|
|
255
|
+
- @open-pioneer/build-common@2.0.5
|
|
256
256
|
|
|
257
257
|
## 3.0.4
|
|
258
258
|
|
|
@@ -260,11 +260,11 @@
|
|
|
260
260
|
|
|
261
261
|
- 1b84a49: Fix a problem that may produce dev server errors on newer versions of vite:
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
```
|
|
264
|
+
11:11:21 AM [vite] Internal server error: Failed to resolve services entry point for package $DIR/src/samples/showcase/showcase-app
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
Caused by: Cannot read properties of undefined (reading 'resolveId')
|
|
267
|
+
```
|
|
268
268
|
|
|
269
269
|
## 3.0.3
|
|
270
270
|
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
|
|
273
273
|
- 3550ca8: Update dependencies
|
|
274
274
|
- Updated dependencies [d9a0c1b]
|
|
275
|
-
|
|
275
|
+
- @open-pioneer/build-common@2.0.4
|
|
276
276
|
|
|
277
277
|
## 3.0.2
|
|
278
278
|
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
|
|
287
287
|
- 017b8f3: Harmonize naming of Open Pioneer Trails in READMEs, package.json files and error messages.
|
|
288
288
|
- Updated dependencies [017b8f3]
|
|
289
|
-
|
|
289
|
+
- @open-pioneer/build-common@2.0.3
|
|
290
290
|
|
|
291
291
|
## 3.0.0
|
|
292
292
|
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
- c08520d: Update dependencies
|
|
302
302
|
- Updated dependencies [c08520d]
|
|
303
303
|
- Updated dependencies [c08520d]
|
|
304
|
-
|
|
304
|
+
- @open-pioneer/build-common@2.0.2
|
|
305
305
|
|
|
306
306
|
## 2.0.1
|
|
307
307
|
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
- 9d4a9d5: Bump dependencies
|
|
311
311
|
- 715b45e: Update package.json metadata
|
|
312
312
|
- Updated dependencies [715b45e]
|
|
313
|
-
|
|
313
|
+
- @open-pioneer/build-common@2.0.1
|
|
314
314
|
|
|
315
315
|
## 2.0.0
|
|
316
316
|
|
|
@@ -320,17 +320,17 @@
|
|
|
320
320
|
- c15512c: **Breaking Change:** A trails package's `devDependencies` are no longer included in the build (fixes #43).
|
|
321
321
|
For normal dependencies, service classes are automatically picked up and compiled into the application.
|
|
322
322
|
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
This behavior is surprising for `devDependencies`: license scanners and cve scanner sometimes chose to exclude
|
|
324
|
+
`devDependencies`; which would have been invalid prior to this change (as the code was compiled in anyway).
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
If your package depends on another trails package at runtime, configure an entry in `peerDependencies` instead.
|
|
327
327
|
|
|
328
328
|
### Patch Changes
|
|
329
329
|
|
|
330
330
|
- 5601a5e: Bump dependencies
|
|
331
331
|
- Updated dependencies [5601a5e]
|
|
332
332
|
- Updated dependencies [5601a5e]
|
|
333
|
-
|
|
333
|
+
- @open-pioneer/build-common@2.0.0
|
|
334
334
|
|
|
335
335
|
## 1.1.2
|
|
336
336
|
|
|
@@ -355,29 +355,29 @@
|
|
|
355
355
|
- 99354bf: Improve error message when two versions of the same Trails package are encountered.
|
|
356
356
|
Only a single version per Trails package per app is supported: all packages must share the same version and location on disk.
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
The vite overlay in the browser now shows a comprehensible error message such as this:
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
360
|
+
```text
|
|
361
|
+
[plugin:pioneer:codegen] Encountered the package '@open-pioneer/runtime' at two different locations.
|
|
362
|
+
Trails packages cannot be used more than once in the same application.
|
|
363
|
+
All packages must use a common version of '@open-pioneer/runtime'.
|
|
364
364
|
|
|
365
|
-
|
|
365
|
+
1. @open-pioneer/runtime@1.0.0 at $HOME/projects/pioneer/starter/node_modules/.pnpm/@open-pioneer+runtime@1.0.0_@formatjs+intl@2.9.0_@open-pioneer+chakra-integration@1.0.0_@open_4cza3noe47gq2v2rsqn2cypo4q/node_modules/@open-pioneer/runtime
|
|
366
366
|
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
2. @open-pioneer/runtime@0.1.5 at $HOME/projects/pioneer/starter/node_modules/.pnpm/@open-pioneer+runtime@0.1.5_@formatjs+intl@2.9.0_@open-pioneer+chakra-integration@0.1.4_@open_m544g2vyxvedm3ipuqpqhltgfy/node_modules/@open-pioneer/runtime
|
|
368
|
+
```
|
|
369
369
|
|
|
370
370
|
- 146743d: Bump dependencies
|
|
371
371
|
- Updated dependencies [3a0fb62]
|
|
372
372
|
- Updated dependencies [146743d]
|
|
373
|
-
|
|
373
|
+
- @open-pioneer/build-common@1.0.2
|
|
374
374
|
|
|
375
375
|
## 1.0.2
|
|
376
376
|
|
|
377
377
|
### Patch Changes
|
|
378
378
|
|
|
379
379
|
- Updated dependencies [1a8c745]
|
|
380
|
-
|
|
380
|
+
- @open-pioneer/build-common@1.0.1
|
|
381
381
|
|
|
382
382
|
## 1.0.1
|
|
383
383
|
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
### Patch Changes
|
|
395
395
|
|
|
396
396
|
- Updated dependencies [991be0f]
|
|
397
|
-
|
|
397
|
+
- @open-pioneer/build-common@1.0.0
|
|
398
398
|
|
|
399
399
|
## 0.8.7
|
|
400
400
|
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
|
|
403
403
|
- f0cd283: Add package.json metadata
|
|
404
404
|
- Updated dependencies [f0cd283]
|
|
405
|
-
|
|
405
|
+
- @open-pioneer/build-common@0.6.1
|
|
406
406
|
|
|
407
407
|
## 0.8.6
|
|
408
408
|
|
|
@@ -410,9 +410,9 @@
|
|
|
410
410
|
|
|
411
411
|
- cf32df5: Add another workaround that unfortunately currently requires pnpm's `shamefully-hoist` option.
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
[`shamefully-hoist`](https://pnpm.io/npmrc#shamefully-hoist) allows the application to 'see' all other installed node packages.
|
|
414
|
+
This is usually a bad practice but we currently require it for the virtual module that imports all Open Pioneer Trails services.
|
|
415
|
+
For more details see the linked commit.
|
|
416
416
|
|
|
417
417
|
## 0.8.5
|
|
418
418
|
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
- e6bbbfb: Simplify license comment in README
|
|
435
435
|
- Updated dependencies [b6f55fe]
|
|
436
436
|
- Updated dependencies [e6bbbfb]
|
|
437
|
-
|
|
437
|
+
- @open-pioneer/build-common@0.6.0
|
|
438
438
|
|
|
439
439
|
## 0.8.2
|
|
440
440
|
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
|
|
443
443
|
- fdb5347: Use unresolved module ids for generated code.
|
|
444
444
|
- Updated dependencies [fdb5347]
|
|
445
|
-
|
|
445
|
+
- @open-pioneer/build-common@0.5.1
|
|
446
446
|
|
|
447
447
|
## 0.8.1
|
|
448
448
|
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
|
|
451
451
|
- 9f82090: Use react hooks code generation from @open-pioneer/build-common
|
|
452
452
|
- Updated dependencies [9f82090]
|
|
453
|
-
|
|
453
|
+
- @open-pioneer/build-common@0.5.0
|
|
454
454
|
|
|
455
455
|
## 0.8.0
|
|
456
456
|
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
- 38c8ee0: Don't re-emit warnings when a cached metadata entry is returned.
|
|
466
466
|
- Updated dependencies [348afd8]
|
|
467
467
|
- Updated dependencies [aeb702c]
|
|
468
|
-
|
|
468
|
+
- @open-pioneer/build-common@0.4.0
|
|
469
469
|
|
|
470
470
|
## 0.7.0
|
|
471
471
|
|
|
@@ -479,7 +479,7 @@
|
|
|
479
479
|
|
|
480
480
|
- 0692aa2: Revert back to commonjs
|
|
481
481
|
- Updated dependencies [0692aa2]
|
|
482
|
-
|
|
482
|
+
- @open-pioneer/build-common@0.3.1
|
|
483
483
|
|
|
484
484
|
## 0.6.0
|
|
485
485
|
|
|
@@ -493,7 +493,7 @@
|
|
|
493
493
|
- Updated dependencies [393b294]
|
|
494
494
|
- Updated dependencies [454ea2b]
|
|
495
495
|
- Updated dependencies [39855ce]
|
|
496
|
-
|
|
496
|
+
- @open-pioneer/build-common@0.3.0
|
|
497
497
|
|
|
498
498
|
## 0.5.3
|
|
499
499
|
|
|
@@ -503,7 +503,7 @@
|
|
|
503
503
|
- Updated dependencies [ef54f35]
|
|
504
504
|
- Updated dependencies [125fd57]
|
|
505
505
|
- Updated dependencies [37413f4]
|
|
506
|
-
|
|
506
|
+
- @open-pioneer/build-common@0.2.0
|
|
507
507
|
|
|
508
508
|
## 0.5.2
|
|
509
509
|
|
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
- 434cc23: Migrate all tests to vitest.
|
|
513
513
|
- 41399fa: Use new shared package to validate build.config.mjs
|
|
514
514
|
- Updated dependencies [41399fa]
|
|
515
|
-
|
|
515
|
+
- @open-pioneer/build-common@0.1.0
|
|
516
516
|
|
|
517
517
|
## 0.5.1
|
|
518
518
|
|
package/dist/index.js
CHANGED
|
@@ -1196,16 +1196,43 @@ var MetadataRepository = class {
|
|
|
1196
1196
|
*/
|
|
1197
1197
|
async getAppMetadata(ctx, appDirectory) {
|
|
1198
1198
|
isDebug$2 && debug$2(`Request for app metadata of ${appDirectory}`);
|
|
1199
|
-
const
|
|
1199
|
+
const graph = await this.#analyzeDependencyGraph(ctx, appDirectory);
|
|
1200
|
+
if (!graph) throw new ReportableError(`Failed to parse app metadata in ${appDirectory}. Ensure that the app is a valid source package.`);
|
|
1201
|
+
const { rootPackage: appPackage, packages } = graph;
|
|
1202
|
+
return {
|
|
1203
|
+
name: appPackage.name,
|
|
1204
|
+
directory: appPackage.directory,
|
|
1205
|
+
locales: appPackage.locales,
|
|
1206
|
+
packageJsonPath: appPackage.packageJsonPath,
|
|
1207
|
+
appPackage,
|
|
1208
|
+
packages,
|
|
1209
|
+
runtimeMetadataVersion: detectRuntimeMetadataVersion(packages)
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns the dependency graph of the package in `packageDirectory` that imports `open-pioneer:test-support`.
|
|
1214
|
+
* The package is not an app, so none of the app-only checks (such as the runtime metadata version) run.
|
|
1215
|
+
*/
|
|
1216
|
+
async getTestSupportMetadata(ctx, packageDirectory) {
|
|
1217
|
+
isDebug$2 && debug$2(`Request for test support metadata of ${packageDirectory}`);
|
|
1218
|
+
const graph = await this.#analyzeDependencyGraph(ctx, packageDirectory);
|
|
1219
|
+
if (!graph) throw new ReportableError(`'open-pioneer:test-support' can only be imported from a Trails package. The package in ${packageDirectory} has neither a ${BUILD_CONFIG_NAME} nor package metadata.`);
|
|
1220
|
+
return graph;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Visits the root package in `rootDirectory` and its dependencies recursively.
|
|
1224
|
+
* Returns undefined when the root package is a plain package.
|
|
1225
|
+
*/
|
|
1226
|
+
async #analyzeDependencyGraph(ctx, rootDirectory) {
|
|
1227
|
+
const rootPackage = await this.#getPackageMetadata(ctx, {
|
|
1200
1228
|
type: "absolute",
|
|
1201
|
-
directory:
|
|
1229
|
+
directory: rootDirectory
|
|
1202
1230
|
});
|
|
1203
|
-
if (!
|
|
1204
|
-
const appLocales = Array.from(appPackageMetadata.i18nPaths.keys());
|
|
1231
|
+
if (!rootPackage) return;
|
|
1205
1232
|
const packageMetadataByName = /* @__PURE__ */ new Map();
|
|
1206
1233
|
const packageSeenByDirectory = /* @__PURE__ */ new Set();
|
|
1207
|
-
packageMetadataByName.set(
|
|
1208
|
-
packageSeenByDirectory.add(
|
|
1234
|
+
packageMetadataByName.set(rootPackage.name, rootPackage);
|
|
1235
|
+
packageSeenByDirectory.add(rootPackage.directory);
|
|
1209
1236
|
const visitDependencies = async (dependencies, importedFrom) => {
|
|
1210
1237
|
const jobs = dependencies.map(async (dependency) => {
|
|
1211
1238
|
const packageMetadata = await this.#getPackageMetadata(ctx, {
|
|
@@ -1222,17 +1249,10 @@ var MetadataRepository = class {
|
|
|
1222
1249
|
});
|
|
1223
1250
|
return await Promise.all(jobs);
|
|
1224
1251
|
};
|
|
1225
|
-
await visitDependencies(
|
|
1226
|
-
const packages = Array.from(packageMetadataByName.values());
|
|
1227
|
-
const runtimeMetadataVersion = detectRuntimeMetadataVersion(packages);
|
|
1252
|
+
await visitDependencies(rootPackage.dependencies, rootPackage.packageJsonPath);
|
|
1228
1253
|
return {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
locales: appLocales,
|
|
1232
|
-
packageJsonPath: appPackageMetadata.packageJsonPath,
|
|
1233
|
-
appPackage: appPackageMetadata,
|
|
1234
|
-
packages,
|
|
1235
|
-
runtimeMetadataVersion
|
|
1254
|
+
rootPackage,
|
|
1255
|
+
packages: Array.from(packageMetadataByName.values())
|
|
1236
1256
|
};
|
|
1237
1257
|
}
|
|
1238
1258
|
/**
|
|
@@ -1529,6 +1549,17 @@ function codegenPlugin() {
|
|
|
1529
1549
|
return jsModule(RuntimeSupport.generateSourceInfo(packageName, mod.modulePath));
|
|
1530
1550
|
}
|
|
1531
1551
|
const ctx = createMetadataContextFromRolldown(this);
|
|
1552
|
+
if (mod.type === "test-support") {
|
|
1553
|
+
const { rootPackage, packages } = await repository.getTestSupportMetadata(ctx, dirname(packageJsonPath));
|
|
1554
|
+
const generatedSourceCode = await generateTestSupport({
|
|
1555
|
+
rootPackage,
|
|
1556
|
+
locale: mod.locale,
|
|
1557
|
+
packages,
|
|
1558
|
+
loadI18n: createI18nLoader(ctx, repository)
|
|
1559
|
+
});
|
|
1560
|
+
isDebug && debug("Generated test support: %O", generatedSourceCode);
|
|
1561
|
+
return jsModule(generatedSourceCode);
|
|
1562
|
+
}
|
|
1532
1563
|
const appMetadata = await repository.getAppMetadata(ctx, dirname(packageJsonPath));
|
|
1533
1564
|
if (mod.type === "app-meta") {
|
|
1534
1565
|
const runtimeVersion = appMetadata.runtimeMetadataVersion;
|
|
@@ -1566,16 +1597,6 @@ function codegenPlugin() {
|
|
|
1566
1597
|
isDebug && debug("Generated i18n messages: %O", generatedSourceCode);
|
|
1567
1598
|
return jsModule(generatedSourceCode);
|
|
1568
1599
|
}
|
|
1569
|
-
case "test-support": {
|
|
1570
|
-
const generatedSourceCode = await generateTestSupport({
|
|
1571
|
-
rootPackage: appMetadata.appPackage,
|
|
1572
|
-
locale: mod.locale,
|
|
1573
|
-
packages: appMetadata.packages,
|
|
1574
|
-
loadI18n: createI18nLoader(ctx, repository)
|
|
1575
|
-
});
|
|
1576
|
-
isDebug && debug("Generated test support: %O", generatedSourceCode);
|
|
1577
|
-
return jsModule(generatedSourceCode);
|
|
1578
|
-
}
|
|
1579
1600
|
default: assertNever(mod.type);
|
|
1580
1601
|
}
|
|
1581
1602
|
} catch (e) {
|