@agimon-ai/po 0.0.0-alpha.0 → 0.0.0-alpha.1
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/dist/catalog/index.json +47 -47
- package/dist/src/builders/web/webPluginManifest.cjs +11 -10
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.d.mts +7 -7
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginManifest.mjs +11 -10
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.cjs +1 -1
- package/dist/src/builders/web/webPluginScan.cjs.map +1 -1
- package/dist/src/builders/web/webPluginScan.mjs +1 -1
- package/dist/src/builders/web/webPluginScan.mjs.map +1 -1
- package/dist/src/cli/server/run.cjs +2 -0
- package/dist/src/cli/server/run.cjs.map +1 -1
- package/dist/src/cli/server/run.mjs +2 -0
- package/dist/src/cli/server/run.mjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.cjs +2 -1
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -1
- package/dist/src/composition/layerPackageInstaller/index.mjs +2 -1
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
- package/package.json +18 -18
package/dist/catalog/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"packages": {
|
|
4
4
|
"@agimon-ai/po": {
|
|
5
|
-
"version": "0.0.0-alpha.
|
|
5
|
+
"version": "0.0.0-alpha.1",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"@agimon-ai/po-autostop",
|
|
8
8
|
"@agimon-ai/po-cache",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"@agimon-ai/po-author": {
|
|
25
|
-
"version": "0.0.0-alpha.
|
|
25
|
+
"version": "0.0.0-alpha.1",
|
|
26
26
|
"dependencies": [
|
|
27
27
|
"@agimon-ai/po-core",
|
|
28
28
|
"@agimon-ai/po-minor-mode",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"@agimon-ai/po-autocompact": {
|
|
34
|
-
"version": "0.0.0-alpha.
|
|
34
|
+
"version": "0.0.0-alpha.1",
|
|
35
35
|
"dependencies": [
|
|
36
36
|
"@agimon-ai/po-config",
|
|
37
37
|
"@agimon-ai/po-core",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"@agimon-ai/po-autostop": {
|
|
42
|
-
"version": "0.0.0-alpha.
|
|
42
|
+
"version": "0.0.0-alpha.1",
|
|
43
43
|
"dependencies": [
|
|
44
44
|
"@agimon-ai/po-core",
|
|
45
45
|
"@agimon-ai/po-telemetry"
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
"@agimon-ai/po-build": {
|
|
49
|
-
"version": "0.0.0-alpha.
|
|
49
|
+
"version": "0.0.0-alpha.1",
|
|
50
50
|
"dependencies": []
|
|
51
51
|
},
|
|
52
52
|
"@agimon-ai/po-cache": {
|
|
53
|
-
"version": "0.0.0-alpha.
|
|
53
|
+
"version": "0.0.0-alpha.1",
|
|
54
54
|
"dependencies": [
|
|
55
55
|
"@agimon-ai/po-config",
|
|
56
56
|
"@agimon-ai/po-core",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"@agimon-ai/po-computer-use": {
|
|
61
|
-
"version": "0.0.0-alpha.
|
|
61
|
+
"version": "0.0.0-alpha.1",
|
|
62
62
|
"dependencies": [
|
|
63
63
|
"@agimon-ai/po-config",
|
|
64
64
|
"@agimon-ai/po-core",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"@agimon-ai/po-config": {
|
|
71
|
-
"version": "0.0.0-alpha.
|
|
71
|
+
"version": "0.0.0-alpha.1",
|
|
72
72
|
"dependencies": [
|
|
73
73
|
"@agimon-ai/po-core",
|
|
74
74
|
"@agimon-ai/po-telemetry",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
]
|
|
77
77
|
},
|
|
78
78
|
"@agimon-ai/po-core": {
|
|
79
|
-
"version": "0.0.0-alpha.
|
|
79
|
+
"version": "0.0.0-alpha.1",
|
|
80
80
|
"dependencies": [
|
|
81
81
|
"@agimon-ai/po-telemetry",
|
|
82
82
|
"@agimon-ai/po-web-security"
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
"@agimon-ai/po-domain": {
|
|
86
|
-
"version": "0.0.0-alpha.
|
|
86
|
+
"version": "0.0.0-alpha.1",
|
|
87
87
|
"dependencies": [
|
|
88
88
|
"@agimon-ai/po-config",
|
|
89
89
|
"@agimon-ai/po-core",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
94
|
"@agimon-ai/po-edit": {
|
|
95
|
-
"version": "0.0.0-alpha.
|
|
95
|
+
"version": "0.0.0-alpha.1",
|
|
96
96
|
"dependencies": [
|
|
97
97
|
"@agimon-ai/po-core",
|
|
98
98
|
"@agimon-ai/po-hashline",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
103
|
"@agimon-ai/po-file-edit": {
|
|
104
|
-
"version": "0.0.0-alpha.
|
|
104
|
+
"version": "0.0.0-alpha.1",
|
|
105
105
|
"dependencies": [
|
|
106
106
|
"@agimon-ai/po-config",
|
|
107
107
|
"@agimon-ai/po-core",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
]
|
|
112
112
|
},
|
|
113
113
|
"@agimon-ai/po-git": {
|
|
114
|
-
"version": "0.0.0-alpha.
|
|
114
|
+
"version": "0.0.0-alpha.1",
|
|
115
115
|
"dependencies": [
|
|
116
116
|
"@agimon-ai/po-core",
|
|
117
117
|
"@agimon-ai/po-session",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
]
|
|
121
121
|
},
|
|
122
122
|
"@agimon-ai/po-goal": {
|
|
123
|
-
"version": "0.0.0-alpha.
|
|
123
|
+
"version": "0.0.0-alpha.1",
|
|
124
124
|
"dependencies": [
|
|
125
125
|
"@agimon-ai/po-core",
|
|
126
126
|
"@agimon-ai/po-minor-mode",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
]
|
|
130
130
|
},
|
|
131
131
|
"@agimon-ai/po-grep": {
|
|
132
|
-
"version": "0.0.0-alpha.
|
|
132
|
+
"version": "0.0.0-alpha.1",
|
|
133
133
|
"dependencies": [
|
|
134
134
|
"@agimon-ai/po-core",
|
|
135
135
|
"@agimon-ai/po-hashline",
|
|
@@ -138,11 +138,11 @@
|
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
140
|
"@agimon-ai/po-hashline": {
|
|
141
|
-
"version": "0.0.0-alpha.
|
|
141
|
+
"version": "0.0.0-alpha.1",
|
|
142
142
|
"dependencies": []
|
|
143
143
|
},
|
|
144
144
|
"@agimon-ai/po-help": {
|
|
145
|
-
"version": "0.0.0-alpha.
|
|
145
|
+
"version": "0.0.0-alpha.1",
|
|
146
146
|
"dependencies": [
|
|
147
147
|
"@agimon-ai/po-core",
|
|
148
148
|
"@agimon-ai/po-minor-mode",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
]
|
|
151
151
|
},
|
|
152
152
|
"@agimon-ai/po-hook": {
|
|
153
|
-
"version": "0.0.0-alpha.
|
|
153
|
+
"version": "0.0.0-alpha.1",
|
|
154
154
|
"dependencies": [
|
|
155
155
|
"@agimon-ai/po-config",
|
|
156
156
|
"@agimon-ai/po-core",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
]
|
|
159
159
|
},
|
|
160
160
|
"@agimon-ai/po-log": {
|
|
161
|
-
"version": "0.0.0-alpha.
|
|
161
|
+
"version": "0.0.0-alpha.1",
|
|
162
162
|
"dependencies": [
|
|
163
163
|
"@agimon-ai/po-core",
|
|
164
164
|
"@agimon-ai/po-telemetry",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
]
|
|
168
168
|
},
|
|
169
169
|
"@agimon-ai/po-loop": {
|
|
170
|
-
"version": "0.0.0-alpha.
|
|
170
|
+
"version": "0.0.0-alpha.1",
|
|
171
171
|
"dependencies": [
|
|
172
172
|
"@agimon-ai/po-core",
|
|
173
173
|
"@agimon-ai/po-minor-mode",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
]
|
|
177
177
|
},
|
|
178
178
|
"@agimon-ai/po-major-mode": {
|
|
179
|
-
"version": "0.0.0-alpha.
|
|
179
|
+
"version": "0.0.0-alpha.1",
|
|
180
180
|
"dependencies": [
|
|
181
181
|
"@agimon-ai/po-config",
|
|
182
182
|
"@agimon-ai/po-core",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
]
|
|
186
186
|
},
|
|
187
187
|
"@agimon-ai/po-mcp": {
|
|
188
|
-
"version": "0.0.0-alpha.
|
|
188
|
+
"version": "0.0.0-alpha.1",
|
|
189
189
|
"dependencies": [
|
|
190
190
|
"@agimon-ai/po-config",
|
|
191
191
|
"@agimon-ai/po-core",
|
|
@@ -194,33 +194,33 @@
|
|
|
194
194
|
]
|
|
195
195
|
},
|
|
196
196
|
"@agimon-ai/po-minor-mode": {
|
|
197
|
-
"version": "0.0.0-alpha.
|
|
197
|
+
"version": "0.0.0-alpha.1",
|
|
198
198
|
"dependencies": [
|
|
199
199
|
"@agimon-ai/po-core",
|
|
200
200
|
"@agimon-ai/po-telemetry"
|
|
201
201
|
]
|
|
202
202
|
},
|
|
203
203
|
"@agimon-ai/po-model-guidance": {
|
|
204
|
-
"version": "0.0.0-alpha.
|
|
204
|
+
"version": "0.0.0-alpha.1",
|
|
205
205
|
"dependencies": [
|
|
206
206
|
"@agimon-ai/po-config",
|
|
207
207
|
"@agimon-ai/po-core"
|
|
208
208
|
]
|
|
209
209
|
},
|
|
210
210
|
"@agimon-ai/po-native-components": {
|
|
211
|
-
"version": "0.0.0-alpha.
|
|
211
|
+
"version": "0.0.0-alpha.1",
|
|
212
212
|
"dependencies": [
|
|
213
213
|
"@agimon-ai/po-web-components"
|
|
214
214
|
]
|
|
215
215
|
},
|
|
216
216
|
"@agimon-ai/po-notification": {
|
|
217
|
-
"version": "0.0.0-alpha.
|
|
217
|
+
"version": "0.0.0-alpha.1",
|
|
218
218
|
"dependencies": [
|
|
219
219
|
"@agimon-ai/po-core"
|
|
220
220
|
]
|
|
221
221
|
},
|
|
222
222
|
"@agimon-ai/po-plan": {
|
|
223
|
-
"version": "0.0.0-alpha.
|
|
223
|
+
"version": "0.0.0-alpha.1",
|
|
224
224
|
"dependencies": [
|
|
225
225
|
"@agimon-ai/po-config",
|
|
226
226
|
"@agimon-ai/po-core",
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
]
|
|
232
232
|
},
|
|
233
233
|
"@agimon-ai/po-profile": {
|
|
234
|
-
"version": "0.0.0-alpha.
|
|
234
|
+
"version": "0.0.0-alpha.1",
|
|
235
235
|
"dependencies": [
|
|
236
236
|
"@agimon-ai/po-config",
|
|
237
237
|
"@agimon-ai/po-core",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
]
|
|
241
241
|
},
|
|
242
242
|
"@agimon-ai/po-prompt": {
|
|
243
|
-
"version": "0.0.0-alpha.
|
|
243
|
+
"version": "0.0.0-alpha.1",
|
|
244
244
|
"dependencies": [
|
|
245
245
|
"@agimon-ai/po-core",
|
|
246
246
|
"@agimon-ai/po-web-components",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
]
|
|
249
249
|
},
|
|
250
250
|
"@agimon-ai/po-read": {
|
|
251
|
-
"version": "0.0.0-alpha.
|
|
251
|
+
"version": "0.0.0-alpha.1",
|
|
252
252
|
"dependencies": [
|
|
253
253
|
"@agimon-ai/po-config",
|
|
254
254
|
"@agimon-ai/po-core",
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
]
|
|
259
259
|
},
|
|
260
260
|
"@agimon-ai/po-runner": {
|
|
261
|
-
"version": "0.0.0-alpha.
|
|
261
|
+
"version": "0.0.0-alpha.1",
|
|
262
262
|
"dependencies": [
|
|
263
263
|
"@agimon-ai/po-core",
|
|
264
264
|
"@agimon-ai/po-telemetry",
|
|
@@ -268,19 +268,19 @@
|
|
|
268
268
|
]
|
|
269
269
|
},
|
|
270
270
|
"@agimon-ai/po-sandbox": {
|
|
271
|
-
"version": "0.0.0-alpha.
|
|
271
|
+
"version": "0.0.0-alpha.1",
|
|
272
272
|
"dependencies": [
|
|
273
273
|
"@agimon-ai/po-core"
|
|
274
274
|
]
|
|
275
275
|
},
|
|
276
276
|
"@agimon-ai/po-session": {
|
|
277
|
-
"version": "0.0.0-alpha.
|
|
277
|
+
"version": "0.0.0-alpha.1",
|
|
278
278
|
"dependencies": [
|
|
279
279
|
"@agimon-ai/po-core"
|
|
280
280
|
]
|
|
281
281
|
},
|
|
282
282
|
"@agimon-ai/po-skill": {
|
|
283
|
-
"version": "0.0.0-alpha.
|
|
283
|
+
"version": "0.0.0-alpha.1",
|
|
284
284
|
"dependencies": [
|
|
285
285
|
"@agimon-ai/po-config",
|
|
286
286
|
"@agimon-ai/po-core",
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
]
|
|
291
291
|
},
|
|
292
292
|
"@agimon-ai/po-style-system": {
|
|
293
|
-
"version": "0.0.0-alpha.
|
|
293
|
+
"version": "0.0.0-alpha.1",
|
|
294
294
|
"dependencies": [
|
|
295
295
|
"@agimon-ai/po-core",
|
|
296
296
|
"@agimon-ai/po-web-components",
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
]
|
|
299
299
|
},
|
|
300
300
|
"@agimon-ai/po-task": {
|
|
301
|
-
"version": "0.0.0-alpha.
|
|
301
|
+
"version": "0.0.0-alpha.1",
|
|
302
302
|
"dependencies": [
|
|
303
303
|
"@agimon-ai/po-core",
|
|
304
304
|
"@agimon-ai/po-telemetry",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
]
|
|
308
308
|
},
|
|
309
309
|
"@agimon-ai/po-team": {
|
|
310
|
-
"version": "0.0.0-alpha.
|
|
310
|
+
"version": "0.0.0-alpha.1",
|
|
311
311
|
"dependencies": [
|
|
312
312
|
"@agimon-ai/po-cache",
|
|
313
313
|
"@agimon-ai/po-config",
|
|
@@ -320,11 +320,11 @@
|
|
|
320
320
|
]
|
|
321
321
|
},
|
|
322
322
|
"@agimon-ai/po-telemetry": {
|
|
323
|
-
"version": "0.0.0-alpha.
|
|
323
|
+
"version": "0.0.0-alpha.1",
|
|
324
324
|
"dependencies": []
|
|
325
325
|
},
|
|
326
326
|
"@agimon-ai/po-template-advanced": {
|
|
327
|
-
"version": "0.0.0-alpha.
|
|
327
|
+
"version": "0.0.0-alpha.1",
|
|
328
328
|
"dependencies": [
|
|
329
329
|
"@agimon-ai/po-core",
|
|
330
330
|
"@agimon-ai/po-web-components",
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
]
|
|
333
333
|
},
|
|
334
334
|
"@agimon-ai/po-template-elegant": {
|
|
335
|
-
"version": "0.0.0-alpha.
|
|
335
|
+
"version": "0.0.0-alpha.1",
|
|
336
336
|
"dependencies": [
|
|
337
337
|
"@agimon-ai/po-core",
|
|
338
338
|
"@agimon-ai/po-web-components",
|
|
@@ -340,7 +340,7 @@
|
|
|
340
340
|
]
|
|
341
341
|
},
|
|
342
342
|
"@agimon-ai/po-ui": {
|
|
343
|
-
"version": "0.0.0-alpha.
|
|
343
|
+
"version": "0.0.0-alpha.1",
|
|
344
344
|
"dependencies": [
|
|
345
345
|
"@agimon-ai/po-core",
|
|
346
346
|
"@agimon-ai/po-hashline",
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
]
|
|
351
351
|
},
|
|
352
352
|
"@agimon-ai/po-user-feedback": {
|
|
353
|
-
"version": "0.0.0-alpha.
|
|
353
|
+
"version": "0.0.0-alpha.1",
|
|
354
354
|
"dependencies": [
|
|
355
355
|
"@agimon-ai/po-core",
|
|
356
356
|
"@agimon-ai/po-minor-mode",
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
]
|
|
359
359
|
},
|
|
360
360
|
"@agimon-ai/po-voice": {
|
|
361
|
-
"version": "0.0.0-alpha.
|
|
361
|
+
"version": "0.0.0-alpha.1",
|
|
362
362
|
"dependencies": [
|
|
363
363
|
"@agimon-ai/po-config",
|
|
364
364
|
"@agimon-ai/po-core",
|
|
@@ -371,11 +371,11 @@
|
|
|
371
371
|
]
|
|
372
372
|
},
|
|
373
373
|
"@agimon-ai/po-web-components": {
|
|
374
|
-
"version": "0.0.0-alpha.
|
|
374
|
+
"version": "0.0.0-alpha.1",
|
|
375
375
|
"dependencies": []
|
|
376
376
|
},
|
|
377
377
|
"@agimon-ai/po-web-dashboard": {
|
|
378
|
-
"version": "0.0.0-alpha.
|
|
378
|
+
"version": "0.0.0-alpha.1",
|
|
379
379
|
"dependencies": [
|
|
380
380
|
"@agimon-ai/po-core",
|
|
381
381
|
"@agimon-ai/po-web-components",
|
|
@@ -383,11 +383,11 @@
|
|
|
383
383
|
]
|
|
384
384
|
},
|
|
385
385
|
"@agimon-ai/po-web-security": {
|
|
386
|
-
"version": "0.0.0-alpha.
|
|
386
|
+
"version": "0.0.0-alpha.1",
|
|
387
387
|
"dependencies": []
|
|
388
388
|
},
|
|
389
389
|
"@agimon-ai/po-workflow": {
|
|
390
|
-
"version": "0.0.0-alpha.
|
|
390
|
+
"version": "0.0.0-alpha.1",
|
|
391
391
|
"dependencies": [
|
|
392
392
|
"@agimon-ai/po-core",
|
|
393
393
|
"@agimon-ai/po-minor-mode",
|
|
@@ -16,9 +16,9 @@ node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
|
16
16
|
* Plugins are independent: a manifest names no other plugin, and the order
|
|
17
17
|
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
18
18
|
* because every relation between two plugins resolves by name once all of
|
|
19
|
-
* them are installed.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* them are installed. Web copies keep distinct slots so each mount can select its
|
|
20
|
+
* own package; only repeated declarations of the same slot are dropped. Native
|
|
21
|
+
* plugins still share one pluginId registry. Malformed blocks are scan errors.
|
|
22
22
|
*
|
|
23
23
|
* The native app's poNative blocks share this exact shape, so the same
|
|
24
24
|
* validation reads either field.
|
|
@@ -97,21 +97,22 @@ function compareCodeUnits(left, right) {
|
|
|
97
97
|
}
|
|
98
98
|
const byInstallOrder = (left, right) => left.registrationOrder - right.registrationOrder || compareCodeUnits(left.pluginId, right.pluginId) || compareCodeUnits(left.packageDir, right.packageDir);
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
100
|
+
* Deterministic install order with duplicate web slots removed. Different package
|
|
101
|
+
* copies survive the build; mount selection resolves shared pluginIds later.
|
|
102
|
+
* The native registry is still keyed by pluginId, so it keeps only the first copy.
|
|
103
103
|
*/
|
|
104
|
-
function orderDeclaredPlugins(plugins, onNotice = () => void 0) {
|
|
104
|
+
function orderDeclaredPlugins(plugins, onNotice = () => void 0, field = "poWeb") {
|
|
105
105
|
const sorted = [...plugins].sort(byInstallOrder);
|
|
106
|
-
const
|
|
106
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
107
107
|
const kept = [];
|
|
108
108
|
for (const plugin of sorted) {
|
|
109
|
-
const
|
|
109
|
+
const key = field === "poNative" ? plugin.pluginId : plugin.slot;
|
|
110
|
+
const holder = byKey.get(key);
|
|
110
111
|
if (holder !== void 0) {
|
|
111
112
|
onNotice(`web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`);
|
|
112
113
|
continue;
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
byKey.set(key, plugin);
|
|
115
116
|
kept.push(plugin);
|
|
116
117
|
}
|
|
117
118
|
return kept;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginManifest.cjs","names":["fs","path","crypto"],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed. A collision between two packages is a notice for the\n * sync log and the first package keeps the name; only a malformed block is an\n * error, which the scanner turns into a notice for that package alone.\n *\n * The native app's poNative blocks share this exact shape, so the same\n * validation reads either field.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\n/** The order a plugin installs at when its manifest names none. */\nexport const DEFAULT_REGISTRATION_ORDER = 1000;\n\nexport interface WebPluginEntryDeclaration {\n /** Package-relative ./path to the source entry. */\n entry: string;\n}\n\nexport interface DeclaredWebPlugin {\n pluginId: string;\n /**\n * The registry name of this installed copy: the pluginId for a host plugin, otherwise\n * `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one\n * pluginId installed from different directories never share a name.\n */\n slot: string;\n registrationOrder: number;\n packageDir: string;\n packageName: string;\n isHost: boolean;\n client: WebPluginEntryDeclaration;\n scopes: readonly ('global' | 'workspace' | 'session')[];\n}\n\n/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */\nexport type PluginManifestField = 'poWeb' | 'poNative';\n\nexport class WebPluginManifestError extends Error {\n constructor(packageDir: string, message: string, field: PluginManifestField = 'poWeb') {\n super(`${field} manifest in ${packageDir}: ${message}`);\n this.name = 'WebPluginManifestError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeEntry(\n packageDir: string,\n kind: string,\n value: unknown,\n field: PluginManifestField,\n): WebPluginEntryDeclaration {\n const raw = typeof value === 'string' ? { entry: value } : value;\n if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);\n const { entry } = raw;\n if (typeof entry !== 'string' || !entry.startsWith('./') || entry.includes('..')) {\n throw new WebPluginManifestError(\n packageDir,\n `${kind}.entry must be a package-relative ./path with no '..'.`,\n field,\n );\n }\n return { entry };\n}\n\nconst SLOT_HASH_LENGTH = 8;\n\n/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */\nexport function pluginSlot(plugin: { pluginId: string; packageDir: string; isHost: boolean }): string {\n if (plugin.isHost) return plugin.pluginId;\n let directory: string;\n try {\n directory = fs.realpathSync(plugin.packageDir);\n } catch {\n // A directory that no longer exists has no real path; its resolved path still names it stably.\n directory = path.resolve(plugin.packageDir);\n }\n const digest = crypto.createHash('sha256').update(directory).digest('hex');\n return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;\n}\n\n/** The field's value normalized to a list: one plugin object or an array of them. */\nexport function pluginBlocksOf(manifest: Record<string, unknown>, field: PluginManifestField = 'poWeb'): unknown[] {\n const value = manifest[field];\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\n/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */\nexport function declaredPluginsOf(\n packageDir: string,\n manifest: Record<string, unknown>,\n isHost: boolean,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const plugins: DeclaredWebPlugin[] = [];\n for (const block of pluginBlocksOf(manifest, field)) {\n if (!isRecord(block)) throw new WebPluginManifestError(packageDir, 'each block must be an object.', field);\n const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;\n if (\n !Array.isArray(scopes) ||\n scopes.length === 0 ||\n scopes.some((scope) => !['global', 'workspace', 'session'].includes(scope))\n ) {\n throw new WebPluginManifestError(\n packageDir,\n 'scopes must explicitly name global, workspace, or session; resync the plugin.',\n field,\n );\n }\n if (typeof pluginId !== 'string' || !PLUGIN_ID_PATTERN.test(pluginId)) {\n throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);\n }\n if (!Number.isInteger(registrationOrder) || (registrationOrder as number) < 0) {\n throw new WebPluginManifestError(\n packageDir,\n `'${pluginId}' needs a non-negative integer registrationOrder.`,\n field,\n );\n }\n plugins.push({\n pluginId,\n slot: pluginSlot({ pluginId, packageDir, isHost }),\n registrationOrder: registrationOrder as number,\n packageDir,\n packageName: typeof manifest.name === 'string' ? manifest.name : packageDir,\n isHost,\n client: normalizeEntry(packageDir, 'client', client, field),\n scopes,\n });\n }\n return plugins;\n}\n\n/** Code-unit order, never the locale's: the same packages must order the same on every machine. */\nexport function compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nconst byInstallOrder = (left: DeclaredWebPlugin, right: DeclaredWebPlugin): number =>\n left.registrationOrder - right.registrationOrder ||\n compareCodeUnits(left.pluginId, right.pluginId) ||\n compareCodeUnits(left.packageDir, right.packageDir);\n\n/**\n * The deterministic install order, (registrationOrder, pluginId), with the\n * cross-package collisions resolved by the browser client registry: the first\n * plugin keeps a shared pluginId and the later package is dropped with a notice.\n */\nexport function orderDeclaredPlugins(\n plugins: readonly DeclaredWebPlugin[],\n onNotice: (message: string) => void = () => undefined,\n): DeclaredWebPlugin[] {\n const sorted = [...plugins].sort(byInstallOrder);\n const byId = new Map<string, DeclaredWebPlugin>();\n const kept: DeclaredWebPlugin[] = [];\n for (const plugin of sorted) {\n const holder = byId.get(plugin.pluginId);\n if (holder !== undefined) {\n onNotice(\n `web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`,\n );\n continue;\n }\n byId.set(plugin.pluginId, plugin);\n kept.push(plugin);\n }\n return kept;\n}\n"],"mappings":";;;;;;;;;;;;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K,cAAc;CAC/C,MAAM,uBAAO,IAAI,IAA+B;CAChD,MAAM,OAA4B,CAAC;CACnC,KAAK,MAAM,UAAU,QAAQ;EAC3B,MAAM,SAAS,KAAK,IAAI,OAAO,QAAQ;EACvC,IAAI,WAAW,KAAA,GAAW;GACxB,SACE,eAAe,OAAO,SAAS,SAAS,OAAO,WAAW,eAAe,OAAO,WAAW,sBAC7F;GACA;EACF;EACA,KAAK,IAAI,OAAO,UAAU,MAAM;EAChC,KAAK,KAAK,MAAM;CAClB;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"webPluginManifest.cjs","names":["fs","path","crypto"],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed. Web copies keep distinct slots so each mount can select its\n * own package; only repeated declarations of the same slot are dropped. Native\n * plugins still share one pluginId registry. Malformed blocks are scan errors.\n *\n * The native app's poNative blocks share this exact shape, so the same\n * validation reads either field.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\n/** The order a plugin installs at when its manifest names none. */\nexport const DEFAULT_REGISTRATION_ORDER = 1000;\n\nexport interface WebPluginEntryDeclaration {\n /** Package-relative ./path to the source entry. */\n entry: string;\n}\n\nexport interface DeclaredWebPlugin {\n pluginId: string;\n /**\n * The registry name of this installed copy: the pluginId for a host plugin, otherwise\n * `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one\n * pluginId installed from different directories never share a name.\n */\n slot: string;\n registrationOrder: number;\n packageDir: string;\n packageName: string;\n isHost: boolean;\n client: WebPluginEntryDeclaration;\n scopes: readonly ('global' | 'workspace' | 'session')[];\n}\n\n/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */\nexport type PluginManifestField = 'poWeb' | 'poNative';\n\nexport class WebPluginManifestError extends Error {\n constructor(packageDir: string, message: string, field: PluginManifestField = 'poWeb') {\n super(`${field} manifest in ${packageDir}: ${message}`);\n this.name = 'WebPluginManifestError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeEntry(\n packageDir: string,\n kind: string,\n value: unknown,\n field: PluginManifestField,\n): WebPluginEntryDeclaration {\n const raw = typeof value === 'string' ? { entry: value } : value;\n if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);\n const { entry } = raw;\n if (typeof entry !== 'string' || !entry.startsWith('./') || entry.includes('..')) {\n throw new WebPluginManifestError(\n packageDir,\n `${kind}.entry must be a package-relative ./path with no '..'.`,\n field,\n );\n }\n return { entry };\n}\n\nconst SLOT_HASH_LENGTH = 8;\n\n/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */\nexport function pluginSlot(plugin: { pluginId: string; packageDir: string; isHost: boolean }): string {\n if (plugin.isHost) return plugin.pluginId;\n let directory: string;\n try {\n directory = fs.realpathSync(plugin.packageDir);\n } catch {\n // A directory that no longer exists has no real path; its resolved path still names it stably.\n directory = path.resolve(plugin.packageDir);\n }\n const digest = crypto.createHash('sha256').update(directory).digest('hex');\n return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;\n}\n\n/** The field's value normalized to a list: one plugin object or an array of them. */\nexport function pluginBlocksOf(manifest: Record<string, unknown>, field: PluginManifestField = 'poWeb'): unknown[] {\n const value = manifest[field];\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\n/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */\nexport function declaredPluginsOf(\n packageDir: string,\n manifest: Record<string, unknown>,\n isHost: boolean,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const plugins: DeclaredWebPlugin[] = [];\n for (const block of pluginBlocksOf(manifest, field)) {\n if (!isRecord(block)) throw new WebPluginManifestError(packageDir, 'each block must be an object.', field);\n const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;\n if (\n !Array.isArray(scopes) ||\n scopes.length === 0 ||\n scopes.some((scope) => !['global', 'workspace', 'session'].includes(scope))\n ) {\n throw new WebPluginManifestError(\n packageDir,\n 'scopes must explicitly name global, workspace, or session; resync the plugin.',\n field,\n );\n }\n if (typeof pluginId !== 'string' || !PLUGIN_ID_PATTERN.test(pluginId)) {\n throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);\n }\n if (!Number.isInteger(registrationOrder) || (registrationOrder as number) < 0) {\n throw new WebPluginManifestError(\n packageDir,\n `'${pluginId}' needs a non-negative integer registrationOrder.`,\n field,\n );\n }\n plugins.push({\n pluginId,\n slot: pluginSlot({ pluginId, packageDir, isHost }),\n registrationOrder: registrationOrder as number,\n packageDir,\n packageName: typeof manifest.name === 'string' ? manifest.name : packageDir,\n isHost,\n client: normalizeEntry(packageDir, 'client', client, field),\n scopes,\n });\n }\n return plugins;\n}\n\n/** Code-unit order, never the locale's: the same packages must order the same on every machine. */\nexport function compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nconst byInstallOrder = (left: DeclaredWebPlugin, right: DeclaredWebPlugin): number =>\n left.registrationOrder - right.registrationOrder ||\n compareCodeUnits(left.pluginId, right.pluginId) ||\n compareCodeUnits(left.packageDir, right.packageDir);\n\n/**\n * Deterministic install order with duplicate web slots removed. Different package\n * copies survive the build; mount selection resolves shared pluginIds later.\n * The native registry is still keyed by pluginId, so it keeps only the first copy.\n */\nexport function orderDeclaredPlugins(\n plugins: readonly DeclaredWebPlugin[],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const sorted = [...plugins].sort(byInstallOrder);\n const byKey = new Map<string, DeclaredWebPlugin>();\n const kept: DeclaredWebPlugin[] = [];\n for (const plugin of sorted) {\n const key = field === 'poNative' ? plugin.pluginId : plugin.slot;\n const holder = byKey.get(key);\n if (holder !== undefined) {\n onNotice(\n `web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`,\n );\n continue;\n }\n byKey.set(key, plugin);\n kept.push(plugin);\n }\n return kept;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,oBAAoB;;AAG1B,MAAa,6BAA6B;AA0B1C,IAAa,yBAAb,cAA4C,MAAM;CAChD,YAAY,YAAoB,SAAiB,QAA6B,SAAS;EACrF,MAAM,GAAG,MAAM,eAAe,WAAW,IAAI,SAAS;EACtD,KAAK,OAAO;CACd;AACF;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,eACP,YACA,MACA,OACA,OAC2B;CAC3B,MAAM,MAAM,OAAO,UAAU,WAAW,EAAE,OAAO,MAAM,IAAI;CAC3D,IAAI,CAAC,SAAS,GAAG,GAAG,MAAM,IAAI,uBAAuB,YAAY,GAAG,KAAK,8BAA8B,KAAK;CAC5G,MAAM,EAAE,UAAU;CAClB,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,WAAW,IAAI,KAAK,MAAM,SAAS,IAAI,GAC7E,MAAM,IAAI,uBACR,YACA,GAAG,KAAK,yDACR,KACF;CAEF,OAAO,EAAE,MAAM;AACjB;AAEA,MAAM,mBAAmB;;AAGzB,SAAgB,WAAW,QAA2E;CACpG,IAAI,OAAO,QAAQ,OAAO,OAAO;CACjC,IAAI;CACJ,IAAI;EACF,YAAYA,QAAAA,QAAG,aAAa,O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Ae,YAAY,UAAU,QAAQ,KAAK;GAC1D;EACF,CAAC;CACH;CACA,OAAO;AACT;;AAGA,SAAgB,iBAAiB,MAAc,OAAuB;CACpE,OAAO,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAChD;AAEA,MAAM,kBAAkB,MAAyB,UAC/C,KAAK,oBAAoB,MAAM,qBAC/B,iBAAiB,KAAK,UAAU,MAAM,QAAQ,KAC9C,iBAAiB,KAAK,YAAY,MAAM,UAAU;;;;;;AAOpD,SAAgB,qBACd,SACA,iBAA4C,KAAA,GAC5C,QAA6B,SACR;CACrB,MAAM,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,cAAc;CAC/C,MAAM,wBAAQ,IAAI,IAA+B;CACjD,MAAM,OAA4B,CAAC;CACnC,KAAK,MAAM,UAAU,QAAQ;EAC3B,MAAM,MAAM,UAAU,aAAa,OAAO,WAAW,OAAO;EAC5D,MAAM,SAAS,MAAM,IAAI,GAAG;EAC5B,IAAI,WAAW,KAAA,GAAW;GACxB,SACE,eAAe,OAAO,SAAS,SAAS,OAAO,WAAW,eAAe,OAAO,WAAW,sBAC7F;GACA;EACF;EACA,MAAM,IAAI,KAAK,MAAM;EACrB,KAAK,KAAK,MAAM;CAClB;CACA,OAAO;AACT"}
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* Plugins are independent: a manifest names no other plugin, and the order
|
|
10
10
|
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
11
11
|
* because every relation between two plugins resolves by name once all of
|
|
12
|
-
* them are installed.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* them are installed. Web copies keep distinct slots so each mount can select its
|
|
13
|
+
* own package; only repeated declarations of the same slot are dropped. Native
|
|
14
|
+
* plugins still share one pluginId registry. Malformed blocks are scan errors.
|
|
15
15
|
*
|
|
16
16
|
* The native app's poNative blocks share this exact shape, so the same
|
|
17
17
|
* validation reads either field.
|
|
@@ -55,10 +55,10 @@ export declare function declaredPluginsOf(packageDir: string, manifest: Record<s
|
|
|
55
55
|
/** Code-unit order, never the locale's: the same packages must order the same on every machine. */
|
|
56
56
|
export declare function compareCodeUnits(left: string, right: string): number;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* Deterministic install order with duplicate web slots removed. Different package
|
|
59
|
+
* copies survive the build; mount selection resolves shared pluginIds later.
|
|
60
|
+
* The native registry is still keyed by pluginId, so it keeps only the first copy.
|
|
61
61
|
*/
|
|
62
|
-
export declare function orderDeclaredPlugins(plugins: readonly DeclaredWebPlugin[], onNotice?: (message: string) => void): DeclaredWebPlugin[];
|
|
62
|
+
export declare function orderDeclaredPlugins(plugins: readonly DeclaredWebPlugin[], onNotice?: (message: string) => void, field?: PluginManifestField): DeclaredWebPlugin[];
|
|
63
63
|
//#endregion
|
|
64
64
|
//# sourceMappingURL=webPluginManifest.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginManifest.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBAyBa;iBAEI;;EAEf;;iBAGe;EACf;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;YAIU;qBAEC,+BAA+B;EAC1C,YAAY,oBAAoB,iBAAiB,QAAO;;;wBAgC1C,WAAW;EAAU;EAAkB;EAAoB;;;wBAc3D,eAAe,UAAU,yBAAyB,QAAO;;wBAOzD,kBACd,oBACA,UAAU,yBACV,iBACA,QAAO,sBACN;;wBAyCa,iBAAiB,cAAc;;;;;;wBAc/B,qBACd,kBAAkB,qBAClB,YAAW,
|
|
1
|
+
{"version":3,"file":"webPluginManifest.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBAyBa;iBAEI;;EAEf;;iBAGe;EACf;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;YAIU;qBAEC,+BAA+B;EAC1C,YAAY,oBAAoB,iBAAiB,QAAO;;;wBAgC1C,WAAW;EAAU;EAAkB;EAAoB;;;wBAc3D,eAAe,UAAU,yBAAyB,QAAO;;wBAOzD,kBACd,oBACA,UAAU,yBACV,iBACA,QAAO,sBACN;;wBAyCa,iBAAiB,cAAc;;;;;;wBAc/B,qBACd,kBAAkB,qBAClB,YAAW,0BACX,QAAO,sBACN"}
|
|
@@ -12,9 +12,9 @@ import crypto from "node:crypto";
|
|
|
12
12
|
* Plugins are independent: a manifest names no other plugin, and the order
|
|
13
13
|
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
14
14
|
* because every relation between two plugins resolves by name once all of
|
|
15
|
-
* them are installed.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* them are installed. Web copies keep distinct slots so each mount can select its
|
|
16
|
+
* own package; only repeated declarations of the same slot are dropped. Native
|
|
17
|
+
* plugins still share one pluginId registry. Malformed blocks are scan errors.
|
|
18
18
|
*
|
|
19
19
|
* The native app's poNative blocks share this exact shape, so the same
|
|
20
20
|
* validation reads either field.
|
|
@@ -93,21 +93,22 @@ function compareCodeUnits(left, right) {
|
|
|
93
93
|
}
|
|
94
94
|
const byInstallOrder = (left, right) => left.registrationOrder - right.registrationOrder || compareCodeUnits(left.pluginId, right.pluginId) || compareCodeUnits(left.packageDir, right.packageDir);
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* Deterministic install order with duplicate web slots removed. Different package
|
|
97
|
+
* copies survive the build; mount selection resolves shared pluginIds later.
|
|
98
|
+
* The native registry is still keyed by pluginId, so it keeps only the first copy.
|
|
99
99
|
*/
|
|
100
|
-
function orderDeclaredPlugins(plugins, onNotice = () => void 0) {
|
|
100
|
+
function orderDeclaredPlugins(plugins, onNotice = () => void 0, field = "poWeb") {
|
|
101
101
|
const sorted = [...plugins].sort(byInstallOrder);
|
|
102
|
-
const
|
|
102
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
103
103
|
const kept = [];
|
|
104
104
|
for (const plugin of sorted) {
|
|
105
|
-
const
|
|
105
|
+
const key = field === "poNative" ? plugin.pluginId : plugin.slot;
|
|
106
|
+
const holder = byKey.get(key);
|
|
106
107
|
if (holder !== void 0) {
|
|
107
108
|
onNotice(`web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`);
|
|
108
109
|
continue;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
byKey.set(key, plugin);
|
|
111
112
|
kept.push(plugin);
|
|
112
113
|
}
|
|
113
114
|
return kept;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginManifest.mjs","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed.
|
|
1
|
+
{"version":3,"file":"webPluginManifest.mjs","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed. Web copies keep distinct slots so each mount can select its\n * own package; only repeated declarations of the same slot are dropped. Native\n * plugins still share one pluginId registry. Malformed blocks are scan errors.\n *\n * The native app's poNative blocks share this exact shape, so the same\n * validation reads either field.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\n/** The order a plugin installs at when its manifest names none. */\nexport const DEFAULT_REGISTRATION_ORDER = 1000;\n\nexport interface WebPluginEntryDeclaration {\n /** Package-relative ./path to the source entry. */\n entry: string;\n}\n\nexport interface DeclaredWebPlugin {\n pluginId: string;\n /**\n * The registry name of this installed copy: the pluginId for a host plugin, otherwise\n * `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one\n * pluginId installed from different directories never share a name.\n */\n slot: string;\n registrationOrder: number;\n packageDir: string;\n packageName: string;\n isHost: boolean;\n client: WebPluginEntryDeclaration;\n scopes: readonly ('global' | 'workspace' | 'session')[];\n}\n\n/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */\nexport type PluginManifestField = 'poWeb' | 'poNative';\n\nexport class WebPluginManifestError extends Error {\n constructor(packageDir: string, message: string, field: PluginManifestField = 'poWeb') {\n super(`${field} manifest in ${packageDir}: ${message}`);\n this.name = 'WebPluginManifestError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeEntry(\n packageDir: string,\n kind: string,\n value: unknown,\n field: PluginManifestField,\n): WebPluginEntryDeclaration {\n const raw = typeof value === 'string' ? { entry: value } : value;\n if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);\n const { entry } = raw;\n if (typeof entry !== 'string' || !entry.startsWith('./') || entry.includes('..')) {\n throw new WebPluginManifestError(\n packageDir,\n `${kind}.entry must be a package-relative ./path with no '..'.`,\n field,\n );\n }\n return { entry };\n}\n\nconst SLOT_HASH_LENGTH = 8;\n\n/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */\nexport function pluginSlot(plugin: { pluginId: string; packageDir: string; isHost: boolean }): string {\n if (plugin.isHost) return plugin.pluginId;\n let directory: string;\n try {\n directory = fs.realpathSync(plugin.packageDir);\n } catch {\n // A directory that no longer exists has no real path; its resolved path still names it stably.\n directory = path.resolve(plugin.packageDir);\n }\n const digest = crypto.createHash('sha256').update(directory).digest('hex');\n return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;\n}\n\n/** The field's value normalized to a list: one plugin object or an array of them. */\nexport function pluginBlocksOf(manifest: Record<string, unknown>, field: PluginManifestField = 'poWeb'): unknown[] {\n const value = manifest[field];\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\n/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */\nexport function declaredPluginsOf(\n packageDir: string,\n manifest: Record<string, unknown>,\n isHost: boolean,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const plugins: DeclaredWebPlugin[] = [];\n for (const block of pluginBlocksOf(manifest, field)) {\n if (!isRecord(block)) throw new WebPluginManifestError(packageDir, 'each block must be an object.', field);\n const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;\n if (\n !Array.isArray(scopes) ||\n scopes.length === 0 ||\n scopes.some((scope) => !['global', 'workspace', 'session'].includes(scope))\n ) {\n throw new WebPluginManifestError(\n packageDir,\n 'scopes must explicitly name global, workspace, or session; resync the plugin.',\n field,\n );\n }\n if (typeof pluginId !== 'string' || !PLUGIN_ID_PATTERN.test(pluginId)) {\n throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);\n }\n if (!Number.isInteger(registrationOrder) || (registrationOrder as number) < 0) {\n throw new WebPluginManifestError(\n packageDir,\n `'${pluginId}' needs a non-negative integer registrationOrder.`,\n field,\n );\n }\n plugins.push({\n pluginId,\n slot: pluginSlot({ pluginId, packageDir, isHost }),\n registrationOrder: registrationOrder as number,\n packageDir,\n packageName: typeof manifest.name === 'string' ? manifest.name : packageDir,\n isHost,\n client: normalizeEntry(packageDir, 'client', client, field),\n scopes,\n });\n }\n return plugins;\n}\n\n/** Code-unit order, never the locale's: the same packages must order the same on every machine. */\nexport function compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nconst byInstallOrder = (left: DeclaredWebPlugin, right: DeclaredWebPlugin): number =>\n left.registrationOrder - right.registrationOrder ||\n compareCodeUnits(left.pluginId, right.pluginId) ||\n compareCodeUnits(left.packageDir, right.packageDir);\n\n/**\n * Deterministic install order with duplicate web slots removed. Different package\n * copies survive the build; mount selection resolves shared pluginIds later.\n * The native registry is still keyed by pluginId, so it keeps only the first copy.\n */\nexport function orderDeclaredPlugins(\n plugins: readonly DeclaredWebPlugin[],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const sorted = [...plugins].sort(byInstallOrder);\n const byKey = new Map<string, DeclaredWebPlugin>();\n const kept: DeclaredWebPlugin[] = [];\n for (const plugin of sorted) {\n const key = field === 'poNative' ? plugin.pluginId : plugin.slot;\n const holder = byKey.get(key);\n if (holder !== undefined) {\n onNotice(\n `web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`,\n );\n continue;\n }\n byKey.set(key, plugin);\n kept.push(plugin);\n }\n return kept;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,oBAAoB;;AAG1B,MAAa,6BAA6B;AA0B1C,IAAa,yBAAb,cAA4C,MAAM;CAChD,YAAY,YAAoB,SAAiB,QAA6B,SAAS;EACrF,MAAM,GAAG,MAAM,eAAe,WAAW,IAAI,SAAS;EACtD,KAAK,OAAO;CACd;AACF;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,eACP,YACA,MACA,OACA,OAC2B;CAC3B,MAAM,MAAM,OAAO,UAAU,WAAW,EAAE,OAAO,MAAM,IAAI;CAC3D,IAAI,CAAC,SAAS,G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|
|
|
35
35
|
onNotice(`${kind} plugin package ${resolved} skipped: ${error instanceof require_webPluginManifest.WebPluginManifestError ? error.message : String(error)}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
return require_webPluginManifest.orderDeclaredPlugins(plugins, onNotice);
|
|
38
|
+
return require_webPluginManifest.orderDeclaredPlugins(plugins, onNotice, field);
|
|
39
39
|
}
|
|
40
40
|
function declaredPluginsIn(resolved, isHost, field) {
|
|
41
41
|
let manifest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginScan.cjs","names":["path","WebPluginManifestError","orderDeclaredPlugins","fs","declaredPluginsOf"],"sources":["../../../../src/builders/web/webPluginScan.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n type DeclaredWebPlugin,\n declaredPluginsOf,\n orderDeclaredPlugins,\n type PluginManifestField,\n WebPluginManifestError,\n} from './webPluginManifest';\n\n/**\n * Reads poWeb declarations from explicit package roots.\n *\n * No workspace walking and no hardcoded plugin names: the caller says which\n * packages are in play. At po-web's own build time that is just the host\n * package (its built-in plugins); at `po sync` time it is the installed\n * composition's package roots. A plugin package whose manifest is malformed\n * or whose entry file is missing is skipped with a notice, so one broken or\n * half-installed package never costs the rest of the cockpit; only the host's\n * own manifest still throws, because that is a build error of this package.\n *\n * `field` selects poNative for the native composition, which has no host\n * package: pass `undefined` as `hostDir` and only the plugin roots are read.\n */\nexport function scanWebPlugins(\n hostDir: string | undefined,\n pluginRoots: readonly string[] = [],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const seen = new Set<string>();\n const plugins: DeclaredWebPlugin[] = [];\n const hostResolved = hostDir === undefined ? undefined : path.resolve(hostDir);\n const kind = field === 'poNative' ? 'native' : 'web';\n for (const root of hostDir === undefined ? pluginRoots : [hostDir, ...pluginRoots]) {\n const resolved = path.resolve(root);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n try {\n plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));\n } catch (error) {\n if (resolved === hostResolved) throw error;\n const reason = error instanceof WebPluginManifestError ? error.message : String(error);\n onNotice(`${kind} plugin package ${resolved} skipped: ${reason}`);\n }\n }\n return orderDeclaredPlugins(plugins, onNotice);\n}\n\nfunction declaredPluginsIn(resolved: string, isHost: boolean, field: PluginManifestField): DeclaredWebPlugin[] {\n let manifest: Record<string, unknown>;\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(resolved, 'package.json'), 'utf8')) as Record<string, unknown>;\n } catch (error) {\n throw new WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);\n }\n const declared = declaredPluginsOf(resolved, manifest, isHost, field);\n for (const plugin of declared) {\n const entryPath = path.join(resolved, plugin.client.entry);\n if (!fs.existsSync(entryPath)) {\n throw new WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);\n }\n }\n return declared;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eACd,SACA,cAAiC,CAAC,GAClC,iBAA4C,KAAA,GAC5C,QAA6B,SACR;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,UAA+B,CAAC;CACtC,MAAM,eAAe,YAAY,KAAA,IAAY,KAAA,IAAYA,UAAAA,QAAK,QAAQ,OAAO;CAC7E,MAAM,OAAO,UAAU,aAAa,WAAW;CAC/C,KAAK,MAAM,QAAQ,YAAY,KAAA,IAAY,cAAc,CAAC,SAAS,GAAG,WAAW,GAAG;EAClF,MAAM,WAAWA,UAAAA,QAAK,QAAQ,IAAI;EAClC,IAAI,KAAK,IAAI,QAAQ,GAAG;EACxB,KAAK,IAAI,QAAQ;EACjB,IAAI;GACF,QAAQ,KAAK,GAAG,kBAAkB,UAAU,aAAa,cAAc,KAAK,CAAC;EAC/E,SAAS,OAAO;GACd,IAAI,aAAa,cAAc,MAAM;GAErC,SAAS,GAAG,KAAK,kBAAkB,SAAS,YAD7B,iBAAiBC,0BAAAA,yBAAyB,MAAM,UAAU,OAAO,KAAK,GACrB;EAClE;CACF;CACA,OAAOC,0BAAAA,qBAAqB,SAAS,
|
|
1
|
+
{"version":3,"file":"webPluginScan.cjs","names":["path","WebPluginManifestError","orderDeclaredPlugins","fs","declaredPluginsOf"],"sources":["../../../../src/builders/web/webPluginScan.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n type DeclaredWebPlugin,\n declaredPluginsOf,\n orderDeclaredPlugins,\n type PluginManifestField,\n WebPluginManifestError,\n} from './webPluginManifest';\n\n/**\n * Reads poWeb declarations from explicit package roots.\n *\n * No workspace walking and no hardcoded plugin names: the caller says which\n * packages are in play. At po-web's own build time that is just the host\n * package (its built-in plugins); at `po sync` time it is the installed\n * composition's package roots. A plugin package whose manifest is malformed\n * or whose entry file is missing is skipped with a notice, so one broken or\n * half-installed package never costs the rest of the cockpit; only the host's\n * own manifest still throws, because that is a build error of this package.\n *\n * `field` selects poNative for the native composition, which has no host\n * package: pass `undefined` as `hostDir` and only the plugin roots are read.\n */\nexport function scanWebPlugins(\n hostDir: string | undefined,\n pluginRoots: readonly string[] = [],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const seen = new Set<string>();\n const plugins: DeclaredWebPlugin[] = [];\n const hostResolved = hostDir === undefined ? undefined : path.resolve(hostDir);\n const kind = field === 'poNative' ? 'native' : 'web';\n for (const root of hostDir === undefined ? pluginRoots : [hostDir, ...pluginRoots]) {\n const resolved = path.resolve(root);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n try {\n plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));\n } catch (error) {\n if (resolved === hostResolved) throw error;\n const reason = error instanceof WebPluginManifestError ? error.message : String(error);\n onNotice(`${kind} plugin package ${resolved} skipped: ${reason}`);\n }\n }\n return orderDeclaredPlugins(plugins, onNotice, field);\n}\n\nfunction declaredPluginsIn(resolved: string, isHost: boolean, field: PluginManifestField): DeclaredWebPlugin[] {\n let manifest: Record<string, unknown>;\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(resolved, 'package.json'), 'utf8')) as Record<string, unknown>;\n } catch (error) {\n throw new WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);\n }\n const declared = declaredPluginsOf(resolved, manifest, isHost, field);\n for (const plugin of declared) {\n const entryPath = path.join(resolved, plugin.client.entry);\n if (!fs.existsSync(entryPath)) {\n throw new WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);\n }\n }\n return declared;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eACd,SACA,cAAiC,CAAC,GAClC,iBAA4C,KAAA,GAC5C,QAA6B,SACR;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,UAA+B,CAAC;CACtC,MAAM,eAAe,YAAY,KAAA,IAAY,KAAA,IAAYA,UAAAA,QAAK,QAAQ,OAAO;CAC7E,MAAM,OAAO,UAAU,aAAa,WAAW;CAC/C,KAAK,MAAM,QAAQ,YAAY,KAAA,IAAY,cAAc,CAAC,SAAS,GAAG,WAAW,GAAG;EAClF,MAAM,WAAWA,UAAAA,QAAK,QAAQ,IAAI;EAClC,IAAI,KAAK,IAAI,QAAQ,GAAG;EACxB,KAAK,IAAI,QAAQ;EACjB,IAAI;GACF,QAAQ,KAAK,GAAG,kBAAkB,UAAU,aAAa,cAAc,KAAK,CAAC;EAC/E,SAAS,OAAO;GACd,IAAI,aAAa,cAAc,MAAM;GAErC,SAAS,GAAG,KAAK,kBAAkB,SAAS,YAD7B,iBAAiBC,0BAAAA,yBAAyB,MAAM,UAAU,OAAO,KAAK,GACrB;EAClE;CACF;CACA,OAAOC,0BAAAA,qBAAqB,SAAS,UAAU,KAAK;AACtD;AAEA,SAAS,kBAAkB,UAAkB,QAAiB,OAAiD;CAC7G,IAAI;CACJ,IAAI;EACF,WAAW,KAAK,MAAMC,QAAAA,QAA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