@agimon-ai/po 0.0.0-alpha.101 → 0.0.0-alpha.103

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 (33) hide show
  1. package/dist/catalog/index.json +59 -63
  2. package/dist/package.cjs +1 -1
  3. package/dist/package.mjs +1 -1
  4. package/dist/src/builders/isolate/compile.cjs +10 -10
  5. package/dist/src/builders/isolate/compile.cjs.map +1 -1
  6. package/dist/src/builders/isolate/compile.mjs +6 -5
  7. package/dist/src/builders/isolate/compile.mjs.map +1 -1
  8. package/dist/src/builders/isolate/index.cjs +9 -6
  9. package/dist/src/builders/isolate/index.cjs.map +1 -1
  10. package/dist/src/builders/isolate/index.mjs +4 -1
  11. package/dist/src/builders/isolate/index.mjs.map +1 -1
  12. package/dist/src/builders/isolate/membrane.cjs +2 -2
  13. package/dist/src/builders/isolate/membrane.cjs.map +1 -1
  14. package/dist/src/builders/isolate/membrane.mjs +1 -1
  15. package/dist/src/builders/isolate/membrane.mjs.map +1 -1
  16. package/dist/src/builders/isolate/names.cjs +10 -0
  17. package/dist/src/builders/isolate/names.cjs.map +1 -0
  18. package/dist/src/builders/isolate/names.mjs +9 -0
  19. package/dist/src/builders/isolate/names.mjs.map +1 -0
  20. package/dist/src/builders/native/index.cjs +3 -3
  21. package/dist/src/builders/native/index.cjs.map +1 -1
  22. package/dist/src/builders/native/index.d.mts.map +1 -1
  23. package/dist/src/builders/native/index.mjs +1 -1
  24. package/dist/src/builders/native/index.mjs.map +1 -1
  25. package/dist/src/builders/server/idleRestart.cjs +11 -7
  26. package/dist/src/builders/server/idleRestart.cjs.map +1 -1
  27. package/dist/src/builders/server/idleRestart.mjs +11 -7
  28. package/dist/src/builders/server/idleRestart.mjs.map +1 -1
  29. package/dist/src/composition/layerPackageInstaller/index.cjs +1 -1
  30. package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -1
  31. package/dist/src/composition/layerPackageInstaller/index.mjs +1 -1
  32. package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -1
  33. package/package.json +30 -30
@@ -2,7 +2,7 @@
2
2
  "version": 1,
3
3
  "packages": {
4
4
  "@agimon-ai/po": {
5
- "version": "0.0.0-alpha.101",
5
+ "version": "0.0.0-alpha.103",
6
6
  "dependencies": [
7
7
  "@agimon-ai/po-approval",
8
8
  "@agimon-ai/po-artifact",
@@ -28,14 +28,14 @@
28
28
  ]
29
29
  },
30
30
  "@agimon-ai/po-approval": {
31
- "version": "0.0.0-alpha.100",
31
+ "version": "0.0.0-alpha.102",
32
32
  "dependencies": [
33
33
  "@agimon-ai/po-core",
34
34
  "@agimon-ai/po-web-components"
35
35
  ]
36
36
  },
37
37
  "@agimon-ai/po-artifact": {
38
- "version": "0.0.0-alpha.99",
38
+ "version": "0.0.0-alpha.101",
39
39
  "dependencies": [
40
40
  "@agimon-ai/po-core",
41
41
  "@agimon-ai/po-web-components",
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  },
45
45
  "@agimon-ai/po-author": {
46
- "version": "0.0.0-alpha.100",
46
+ "version": "0.0.0-alpha.102",
47
47
  "dependencies": [
48
48
  "@agimon-ai/po-artifact",
49
49
  "@agimon-ai/po-core",
@@ -53,7 +53,7 @@
53
53
  ]
54
54
  },
55
55
  "@agimon-ai/po-autocompact": {
56
- "version": "0.0.0-alpha.100",
56
+ "version": "0.0.0-alpha.102",
57
57
  "dependencies": [
58
58
  "@agimon-ai/po-artifact",
59
59
  "@agimon-ai/po-config",
@@ -62,24 +62,24 @@
62
62
  ]
63
63
  },
64
64
  "@agimon-ai/po-autostop": {
65
- "version": "0.0.0-alpha.100",
65
+ "version": "0.0.0-alpha.102",
66
66
  "dependencies": [
67
67
  "@agimon-ai/po-core"
68
68
  ]
69
69
  },
70
70
  "@agimon-ai/po-browse": {
71
- "version": "0.0.1-alpha.98",
71
+ "version": "0.0.1-alpha.100",
72
72
  "dependencies": [
73
73
  "@agimon-ai/po-core",
74
74
  "@agimon-ai/po-web-components"
75
75
  ]
76
76
  },
77
77
  "@agimon-ai/po-build": {
78
- "version": "0.0.0-alpha.100",
78
+ "version": "0.0.0-alpha.102",
79
79
  "dependencies": []
80
80
  },
81
81
  "@agimon-ai/po-cache": {
82
- "version": "0.0.0-alpha.100",
82
+ "version": "0.0.0-alpha.102",
83
83
  "dependencies": [
84
84
  "@agimon-ai/po-config",
85
85
  "@agimon-ai/po-core",
@@ -87,7 +87,7 @@
87
87
  ]
88
88
  },
89
89
  "@agimon-ai/po-calendar": {
90
- "version": "0.0.1-alpha.59",
90
+ "version": "0.0.1-alpha.61",
91
91
  "dependencies": [
92
92
  "@agimon-ai/po-config",
93
93
  "@agimon-ai/po-core",
@@ -98,15 +98,11 @@
98
98
  ]
99
99
  },
100
100
  "@agimon-ai/po-claude-bridge": {
101
- "version": "0.1.1-alpha.80",
102
- "dependencies": []
103
- },
104
- "@agimon-ai/po-cloudflare": {
105
- "version": "0.0.2-alpha.0",
101
+ "version": "0.1.1-alpha.82",
106
102
  "dependencies": []
107
103
  },
108
104
  "@agimon-ai/po-codemode": {
109
- "version": "0.0.1-alpha.73",
105
+ "version": "0.0.1-alpha.75",
110
106
  "dependencies": [
111
107
  "@agimon-ai/po-config",
112
108
  "@agimon-ai/po-core",
@@ -114,7 +110,7 @@
114
110
  ]
115
111
  },
116
112
  "@agimon-ai/po-computer-use": {
117
- "version": "0.0.0-alpha.100",
113
+ "version": "0.0.0-alpha.102",
118
114
  "dependencies": [
119
115
  "@agimon-ai/po-config",
120
116
  "@agimon-ai/po-core",
@@ -124,26 +120,26 @@
124
120
  ]
125
121
  },
126
122
  "@agimon-ai/po-config": {
127
- "version": "0.0.0-alpha.100",
123
+ "version": "0.0.0-alpha.102",
128
124
  "dependencies": [
129
125
  "@agimon-ai/po-core",
130
126
  "@agimon-ai/po-web-components"
131
127
  ]
132
128
  },
133
129
  "@agimon-ai/po-core": {
134
- "version": "0.0.0-alpha.100",
130
+ "version": "0.0.0-alpha.102",
135
131
  "dependencies": [
136
132
  "@agimon-ai/po-web-security"
137
133
  ]
138
134
  },
139
135
  "@agimon-ai/po-db": {
140
- "version": "0.0.0-alpha.100",
136
+ "version": "0.0.0-alpha.102",
141
137
  "dependencies": [
142
138
  "@agimon-ai/po-core"
143
139
  ]
144
140
  },
145
141
  "@agimon-ai/po-domain": {
146
- "version": "0.0.0-alpha.100",
142
+ "version": "0.0.0-alpha.102",
147
143
  "dependencies": [
148
144
  "@agimon-ai/po-config",
149
145
  "@agimon-ai/po-core",
@@ -151,7 +147,7 @@
151
147
  ]
152
148
  },
153
149
  "@agimon-ai/po-edit": {
154
- "version": "0.0.0-alpha.100",
150
+ "version": "0.0.0-alpha.102",
155
151
  "dependencies": [
156
152
  "@agimon-ai/po-core",
157
153
  "@agimon-ai/po-hashline",
@@ -160,7 +156,7 @@
160
156
  ]
161
157
  },
162
158
  "@agimon-ai/po-file-edit": {
163
- "version": "0.0.0-alpha.100",
159
+ "version": "0.0.0-alpha.102",
164
160
  "dependencies": [
165
161
  "@agimon-ai/po-config",
166
162
  "@agimon-ai/po-core",
@@ -170,7 +166,7 @@
170
166
  ]
171
167
  },
172
168
  "@agimon-ai/po-git": {
173
- "version": "0.0.0-alpha.100",
169
+ "version": "0.0.0-alpha.102",
174
170
  "dependencies": [
175
171
  "@agimon-ai/po-core",
176
172
  "@agimon-ai/po-session",
@@ -179,7 +175,7 @@
179
175
  ]
180
176
  },
181
177
  "@agimon-ai/po-goal": {
182
- "version": "0.0.0-alpha.100",
178
+ "version": "0.0.0-alpha.102",
183
179
  "dependencies": [
184
180
  "@agimon-ai/po-core",
185
181
  "@agimon-ai/po-minor-mode",
@@ -188,7 +184,7 @@
188
184
  ]
189
185
  },
190
186
  "@agimon-ai/po-grep": {
191
- "version": "0.0.0-alpha.100",
187
+ "version": "0.0.0-alpha.102",
192
188
  "dependencies": [
193
189
  "@agimon-ai/po-core",
194
190
  "@agimon-ai/po-hashline",
@@ -197,11 +193,11 @@
197
193
  ]
198
194
  },
199
195
  "@agimon-ai/po-hashline": {
200
- "version": "0.0.0-alpha.100",
196
+ "version": "0.0.0-alpha.102",
201
197
  "dependencies": []
202
198
  },
203
199
  "@agimon-ai/po-help": {
204
- "version": "0.0.0-alpha.100",
200
+ "version": "0.0.0-alpha.102",
205
201
  "dependencies": [
206
202
  "@agimon-ai/po-core",
207
203
  "@agimon-ai/po-minor-mode",
@@ -209,14 +205,14 @@
209
205
  ]
210
206
  },
211
207
  "@agimon-ai/po-identity": {
212
- "version": "0.0.2-alpha.47",
208
+ "version": "0.0.2-alpha.49",
213
209
  "dependencies": [
214
210
  "@agimon-ai/po-core",
215
211
  "@agimon-ai/po-web-security"
216
212
  ]
217
213
  },
218
214
  "@agimon-ai/po-image-gen": {
219
- "version": "0.0.0-alpha.99",
215
+ "version": "0.0.0-alpha.101",
220
216
  "dependencies": [
221
217
  "@agimon-ai/po-core",
222
218
  "@agimon-ai/po-web-components",
@@ -224,7 +220,7 @@
224
220
  ]
225
221
  },
226
222
  "@agimon-ai/po-ios": {
227
- "version": "0.0.1-alpha.35",
223
+ "version": "0.0.1-alpha.37",
228
224
  "dependencies": [
229
225
  "@agimon-ai/po-artifact",
230
226
  "@agimon-ai/po-config",
@@ -234,7 +230,7 @@
234
230
  ]
235
231
  },
236
232
  "@agimon-ai/po-log": {
237
- "version": "0.0.0-alpha.100",
233
+ "version": "0.0.0-alpha.102",
238
234
  "dependencies": [
239
235
  "@agimon-ai/po-core",
240
236
  "@agimon-ai/po-web-components",
@@ -242,7 +238,7 @@
242
238
  ]
243
239
  },
244
240
  "@agimon-ai/po-major-mode": {
245
- "version": "0.0.0-alpha.100",
241
+ "version": "0.0.0-alpha.102",
246
242
  "dependencies": [
247
243
  "@agimon-ai/po-config",
248
244
  "@agimon-ai/po-core",
@@ -250,7 +246,7 @@
250
246
  ]
251
247
  },
252
248
  "@agimon-ai/po-mcp": {
253
- "version": "0.0.0-alpha.100",
249
+ "version": "0.0.0-alpha.102",
254
250
  "dependencies": [
255
251
  "@agimon-ai/po-config",
256
252
  "@agimon-ai/po-core",
@@ -261,43 +257,43 @@
261
257
  ]
262
258
  },
263
259
  "@agimon-ai/po-mcp-proxy": {
264
- "version": "0.0.1-alpha.79",
260
+ "version": "0.0.1-alpha.81",
265
261
  "dependencies": []
266
262
  },
267
263
  "@agimon-ai/po-minor-mode": {
268
- "version": "0.0.0-alpha.100",
264
+ "version": "0.0.0-alpha.102",
269
265
  "dependencies": [
270
266
  "@agimon-ai/po-core"
271
267
  ]
272
268
  },
273
269
  "@agimon-ai/po-model-guidance": {
274
- "version": "0.0.0-alpha.100",
270
+ "version": "0.0.0-alpha.102",
275
271
  "dependencies": [
276
272
  "@agimon-ai/po-config",
277
273
  "@agimon-ai/po-core"
278
274
  ]
279
275
  },
280
276
  "@agimon-ai/po-native-components": {
281
- "version": "0.0.0-alpha.100",
277
+ "version": "0.0.0-alpha.102",
282
278
  "dependencies": [
283
279
  "@agimon-ai/po-web-components"
284
280
  ]
285
281
  },
286
282
  "@agimon-ai/po-network": {
287
- "version": "0.0.2-alpha.47",
283
+ "version": "0.0.2-alpha.49",
288
284
  "dependencies": [
289
285
  "@agimon-ai/po-core",
290
286
  "@agimon-ai/po-web-security"
291
287
  ]
292
288
  },
293
289
  "@agimon-ai/po-notification": {
294
- "version": "0.0.0-alpha.100",
290
+ "version": "0.0.0-alpha.102",
295
291
  "dependencies": [
296
292
  "@agimon-ai/po-core"
297
293
  ]
298
294
  },
299
295
  "@agimon-ai/po-plan": {
300
- "version": "0.0.0-alpha.100",
296
+ "version": "0.0.0-alpha.102",
301
297
  "dependencies": [
302
298
  "@agimon-ai/po-config",
303
299
  "@agimon-ai/po-core",
@@ -307,7 +303,7 @@
307
303
  ]
308
304
  },
309
305
  "@agimon-ai/po-profile": {
310
- "version": "0.0.0-alpha.100",
306
+ "version": "0.0.0-alpha.102",
311
307
  "dependencies": [
312
308
  "@agimon-ai/po-config",
313
309
  "@agimon-ai/po-core",
@@ -315,7 +311,7 @@
315
311
  ]
316
312
  },
317
313
  "@agimon-ai/po-prompt": {
318
- "version": "0.0.0-alpha.100",
314
+ "version": "0.0.0-alpha.102",
319
315
  "dependencies": [
320
316
  "@agimon-ai/po-core",
321
317
  "@agimon-ai/po-web-components",
@@ -323,7 +319,7 @@
323
319
  ]
324
320
  },
325
321
  "@agimon-ai/po-read": {
326
- "version": "0.0.0-alpha.100",
322
+ "version": "0.0.0-alpha.102",
327
323
  "dependencies": [
328
324
  "@agimon-ai/po-config",
329
325
  "@agimon-ai/po-core",
@@ -333,7 +329,7 @@
333
329
  ]
334
330
  },
335
331
  "@agimon-ai/po-runner": {
336
- "version": "0.0.0-alpha.100",
332
+ "version": "0.0.0-alpha.102",
337
333
  "dependencies": [
338
334
  "@agimon-ai/po-core",
339
335
  "@agimon-ai/po-ui",
@@ -342,13 +338,13 @@
342
338
  ]
343
339
  },
344
340
  "@agimon-ai/po-sandbox": {
345
- "version": "0.0.0-alpha.100",
341
+ "version": "0.0.0-alpha.102",
346
342
  "dependencies": [
347
343
  "@agimon-ai/po-core"
348
344
  ]
349
345
  },
350
346
  "@agimon-ai/po-session": {
351
- "version": "0.0.0-alpha.100",
347
+ "version": "0.0.0-alpha.102",
352
348
  "dependencies": [
353
349
  "@agimon-ai/po-config",
354
350
  "@agimon-ai/po-core",
@@ -356,7 +352,7 @@
356
352
  ]
357
353
  },
358
354
  "@agimon-ai/po-skill": {
359
- "version": "0.0.0-alpha.100",
355
+ "version": "0.0.0-alpha.102",
360
356
  "dependencies": [
361
357
  "@agimon-ai/po-config",
362
358
  "@agimon-ai/po-core",
@@ -365,7 +361,7 @@
365
361
  ]
366
362
  },
367
363
  "@agimon-ai/po-style-system": {
368
- "version": "0.0.0-alpha.100",
364
+ "version": "0.0.0-alpha.102",
369
365
  "dependencies": [
370
366
  "@agimon-ai/po-core",
371
367
  "@agimon-ai/po-web-components",
@@ -373,7 +369,7 @@
373
369
  ]
374
370
  },
375
371
  "@agimon-ai/po-task": {
376
- "version": "0.0.0-alpha.100",
372
+ "version": "0.0.0-alpha.102",
377
373
  "dependencies": [
378
374
  "@agimon-ai/po-core",
379
375
  "@agimon-ai/po-ui",
@@ -381,7 +377,7 @@
381
377
  ]
382
378
  },
383
379
  "@agimon-ai/po-team": {
384
- "version": "0.0.0-alpha.100",
380
+ "version": "0.0.0-alpha.102",
385
381
  "dependencies": [
386
382
  "@agimon-ai/po-cache",
387
383
  "@agimon-ai/po-config",
@@ -393,7 +389,7 @@
393
389
  ]
394
390
  },
395
391
  "@agimon-ai/po-template-advanced": {
396
- "version": "0.0.0-alpha.100",
392
+ "version": "0.0.0-alpha.102",
397
393
  "dependencies": [
398
394
  "@agimon-ai/po-core",
399
395
  "@agimon-ai/po-web-components",
@@ -401,7 +397,7 @@
401
397
  ]
402
398
  },
403
399
  "@agimon-ai/po-template-elegant": {
404
- "version": "0.0.0-alpha.100",
400
+ "version": "0.0.0-alpha.102",
405
401
  "dependencies": [
406
402
  "@agimon-ai/po-core",
407
403
  "@agimon-ai/po-web-components",
@@ -409,7 +405,7 @@
409
405
  ]
410
406
  },
411
407
  "@agimon-ai/po-ui": {
412
- "version": "0.0.0-alpha.100",
408
+ "version": "0.0.0-alpha.102",
413
409
  "dependencies": [
414
410
  "@agimon-ai/po-core",
415
411
  "@agimon-ai/po-hashline",
@@ -418,7 +414,7 @@
418
414
  ]
419
415
  },
420
416
  "@agimon-ai/po-user-feedback": {
421
- "version": "0.0.0-alpha.100",
417
+ "version": "0.0.0-alpha.102",
422
418
  "dependencies": [
423
419
  "@agimon-ai/po-core",
424
420
  "@agimon-ai/po-minor-mode",
@@ -427,14 +423,14 @@
427
423
  ]
428
424
  },
429
425
  "@agimon-ai/po-vault": {
430
- "version": "0.0.0-alpha.100",
426
+ "version": "0.0.0-alpha.102",
431
427
  "dependencies": [
432
428
  "@agimon-ai/po-core",
433
429
  "@agimon-ai/po-db"
434
430
  ]
435
431
  },
436
432
  "@agimon-ai/po-vibe-lint": {
437
- "version": "0.0.1-alpha.69",
433
+ "version": "0.0.1-alpha.71",
438
434
  "dependencies": [
439
435
  "@agimon-ai/po-config",
440
436
  "@agimon-ai/po-core",
@@ -444,7 +440,7 @@
444
440
  ]
445
441
  },
446
442
  "@agimon-ai/po-voice": {
447
- "version": "0.0.0-alpha.100",
443
+ "version": "0.0.0-alpha.102",
448
444
  "dependencies": [
449
445
  "@agimon-ai/po-config",
450
446
  "@agimon-ai/po-core",
@@ -456,11 +452,11 @@
456
452
  ]
457
453
  },
458
454
  "@agimon-ai/po-web-components": {
459
- "version": "0.0.0-alpha.100",
455
+ "version": "0.0.0-alpha.102",
460
456
  "dependencies": []
461
457
  },
462
458
  "@agimon-ai/po-web-dashboard": {
463
- "version": "0.0.0-alpha.100",
459
+ "version": "0.0.0-alpha.102",
464
460
  "dependencies": [
465
461
  "@agimon-ai/po-core",
466
462
  "@agimon-ai/po-web-components",
@@ -468,18 +464,18 @@
468
464
  ]
469
465
  },
470
466
  "@agimon-ai/po-web-search": {
471
- "version": "0.0.0-alpha.99",
467
+ "version": "0.0.0-alpha.101",
472
468
  "dependencies": [
473
469
  "@agimon-ai/po-core",
474
470
  "@agimon-ai/po-web-components"
475
471
  ]
476
472
  },
477
473
  "@agimon-ai/po-web-security": {
478
- "version": "0.0.0-alpha.100",
474
+ "version": "0.0.0-alpha.102",
479
475
  "dependencies": []
480
476
  },
481
477
  "@agimon-ai/po-workflow": {
482
- "version": "0.0.0-alpha.100",
478
+ "version": "0.0.0-alpha.102",
483
479
  "dependencies": [
484
480
  "@agimon-ai/po-core",
485
481
  "@agimon-ai/po-ui",
package/dist/package.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.0-alpha.101";
2
+ var version = "0.0.0-alpha.103";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.0-alpha.101";
2
+ var version = "0.0.0-alpha.103";
3
3
  //#endregion
4
4
  export { version };
5
5
 
@@ -1,15 +1,12 @@
1
1
  const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_names = require("./names.cjs");
2
3
  let magic_string = require("magic-string");
3
4
  magic_string = require_runtime.__toESM(magic_string, 1);
4
5
  let rolldown_parseAst = require("rolldown/parseAst");
5
6
  let rolldown_utils = require("rolldown/utils");
6
7
  //#region src/builders/isolate/compile.ts
7
- /** Called at the top of every loop body and function body; throws once the run must stop. */
8
- const GUARD_NAME = "__po_g";
9
- /** Every `import(x)` becomes a call to this host function, which loads another script body. */
10
- const IMPORT_NAME = "__po_import";
11
8
  const MAX_SOURCE_CHARS = 65536;
12
- const GUARD_CALL = `${GUARD_NAME}();`;
9
+ const GUARD_CALL = `${require_names.GUARD_NAME}();`;
13
10
  const LOOP_TYPES = /* @__PURE__ */ new Set([
14
11
  "WhileStatement",
15
12
  "DoWhileStatement",
@@ -65,7 +62,7 @@ function sourceLines(mappings) {
65
62
  function insertGuards(code, program) {
66
63
  const output = new magic_string.default(code);
67
64
  const visit = (node) => {
68
- if (node.type === "ImportExpression") output.overwrite(node.start, node.start + 6, IMPORT_NAME, { contentOnly: true });
65
+ if (node.type === "ImportExpression") output.overwrite(node.start, node.start + 6, require_names.IMPORT_NAME, { contentOnly: true });
69
66
  if (LOOP_TYPES.has(node.type) && isNode(node.body)) {
70
67
  const body = node.body;
71
68
  if (body.type === "BlockStatement") output.appendLeft(body.start + 1, GUARD_CALL);
@@ -77,7 +74,7 @@ function insertGuards(code, program) {
77
74
  else if (FUNCTION_TYPES.has(node.type) && isNode(node.body)) {
78
75
  const body = node.body;
79
76
  if (node.type === "ArrowFunctionExpression" && node.expression) {
80
- output.prependRight(body.start, `(${GUARD_NAME}(),`);
77
+ output.prependRight(body.start, `(${require_names.GUARD_NAME}(),`);
81
78
  output.appendLeft(body.end, ")");
82
79
  } else output.appendLeft(body.start + 1, GUARD_CALL);
83
80
  }
@@ -99,7 +96,7 @@ function insertGuards(code, program) {
99
96
  */
100
97
  function compileModule(source, kind = "main") {
101
98
  if (source.length > MAX_SOURCE_CHARS) throw new ScriptCompileError(`Script exceeds ${MAX_SOURCE_CHARS} characters.`);
102
- for (const name of [GUARD_NAME, IMPORT_NAME]) if (source.includes(name)) throw new ScriptCompileError(`"${name}" is reserved.`);
99
+ for (const name of [require_names.GUARD_NAME, require_names.IMPORT_NAME]) if (source.includes(name)) throw new ScriptCompileError(`"${name}" is reserved.`);
103
100
  const [before, after] = WRAPPERS[kind];
104
101
  const stripped = (0, rolldown_utils.transformSync)("script.ts", `${before}${source}${after}`, {
105
102
  lang: "ts",
@@ -125,10 +122,13 @@ function compileModule(source, kind = "main") {
125
122
  lineOf: (line) => lines[line - 1]
126
123
  };
127
124
  }
125
+ /** The guarded JavaScript of an exec body. */
126
+ function compileScript(source) {
127
+ return compileModule(source).code;
128
+ }
128
129
  //#endregion
129
- exports.GUARD_NAME = GUARD_NAME;
130
- exports.IMPORT_NAME = IMPORT_NAME;
131
130
  exports.ScriptCompileError = ScriptCompileError;
132
131
  exports.compileModule = compileModule;
132
+ exports.compileScript = compileScript;
133
133
 
134
134
  //# sourceMappingURL=compile.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.cjs","names":["MagicString","transformSync","parseAst"],"sources":["../../../../src/builders/isolate/compile.ts"],"sourcesContent":["import MagicString from 'magic-string';\nimport { parseAst } from 'rolldown/parseAst';\nimport { transformSync } from 'rolldown/utils';\n\n/** Called at the top of every loop body and function body; throws once the run must stop. */\nexport const GUARD_NAME = '__po_g';\n/** Every `import(x)` becomes a call to this host function, which loads another script body. */\nexport const IMPORT_NAME = '__po_import';\n\nconst MAX_SOURCE_CHARS = 64 * 1024;\nconst GUARD_CALL = `${GUARD_NAME}();`;\nconst LOOP_TYPES = new Set(['WhileStatement', 'DoWhileStatement', 'ForStatement', 'ForInStatement', 'ForOfStatement']);\nconst FUNCTION_TYPES = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\nconst IMPORT_KEYWORD = 'import';\nconst BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n/** How a body is wrapped: the exec script runs at once, an imported one becomes a function of `args`. */\nconst WRAPPERS = {\n main: ['(async function __po_main(){', '\\n})()'],\n import: ['(async function (args){', '\\n})'],\n} as const;\n\nexport class ScriptCompileError extends Error {\n override readonly name = 'SyntaxError';\n}\n\ninterface AstNode {\n readonly type: string;\n readonly start: number;\n readonly end: number;\n readonly body?: AstNode | readonly AstNode[];\n readonly expression?: boolean;\n readonly [key: string]: unknown;\n}\n\nfunction isNode(value: unknown): value is AstNode {\n return typeof value === 'object' && value !== null && typeof (value as { type?: unknown }).type === 'string';\n}\n\nexport interface CompiledScript {\n readonly code: string;\n /** 1-based line in the submitted body for a 1-based line of `code`, when known. */\n readonly lineOf: (line: number) => number | undefined;\n}\n\n/** The first source line each generated line maps to, from a v3 source map's `mappings`. */\nfunction sourceLines(mappings: string): (number | undefined)[] {\n const lines: (number | undefined)[] = [];\n let sourceLine = 0;\n for (const group of mappings.split(';')) {\n let first: number | undefined;\n for (const segment of group.split(',')) {\n const fields: number[] = [];\n let value = 0;\n let shift = 0;\n for (const char of segment) {\n const digit = BASE64.indexOf(char);\n value += (digit & 31) << shift;\n if (digit & 32) shift += 5;\n else {\n fields.push(value & 1 ? -(value >>> 1) : value >>> 1);\n value = 0;\n shift = 0;\n }\n }\n if (fields.length < 4) continue;\n sourceLine += fields[2] as number;\n first ??= sourceLine + 1;\n }\n lines.push(first);\n }\n return lines;\n}\n\nfunction insertGuards(code: string, program: AstNode): string {\n const output = new MagicString(code);\n const visit = (node: AstNode): void => {\n if (node.type === 'ImportExpression') {\n output.overwrite(node.start, node.start + IMPORT_KEYWORD.length, IMPORT_NAME, { contentOnly: true });\n }\n if (LOOP_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (body.type === 'BlockStatement') output.appendLeft(body.start + 1, GUARD_CALL);\n else {\n output.prependRight(body.start, `{${GUARD_CALL}`);\n output.appendLeft(body.end, '}');\n }\n } else if (node.type === 'StaticBlock') {\n output.appendLeft(code.indexOf('{', node.start) + 1, GUARD_CALL);\n } else if (FUNCTION_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (node.type === 'ArrowFunctionExpression' && node.expression) {\n output.prependRight(body.start, `(${GUARD_NAME}(),`);\n output.appendLeft(body.end, ')');\n } else output.appendLeft(body.start + 1, GUARD_CALL);\n }\n for (const [key, value] of Object.entries(node)) {\n if (key === 'parent') continue;\n if (Array.isArray(value)) for (const child of value) if (isNode(child)) visit(child);\n if (isNode(value)) visit(value);\n }\n };\n visit(program);\n return output.toString();\n}\n\n/**\n * Turns a model-written TypeScript body into guarded JavaScript whose loops and functions call the\n * guard, so a runaway script stops even after an `await`. `main` runs the body as an async IIFE;\n * `import` evaluates to an async function of `args`. Lines of the body stay on the wrapper's line.\n */\nexport function compileModule(source: string, kind: keyof typeof WRAPPERS = 'main'): CompiledScript {\n if (source.length > MAX_SOURCE_CHARS) throw new ScriptCompileError(`Script exceeds ${MAX_SOURCE_CHARS} characters.`);\n for (const name of [GUARD_NAME, IMPORT_NAME]) {\n if (source.includes(name)) throw new ScriptCompileError(`\"${name}\" is reserved.`);\n }\n const [before, after] = WRAPPERS[kind];\n const stripped = transformSync('script.ts', `${before}${source}${after}`, {\n lang: 'ts',\n sourceType: 'script',\n target: 'es2022',\n sourcemap: true,\n });\n if (stripped.errors.length > 0) {\n throw new ScriptCompileError(stripped.errors.map((error) => error.message).join('\\n'));\n }\n let program: AstNode;\n try {\n program = parseAst(stripped.code, { lang: 'js', sourceType: 'script' }, 'script.js') as unknown as AstNode;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/import statement/u.test(message)) {\n throw new ScriptCompileError('Static import statements are not supported; use await import(...) instead.');\n }\n throw new ScriptCompileError(message);\n }\n const lines = sourceLines(stripped.map?.mappings ?? '');\n return { code: insertGuards(stripped.code, program), lineOf: (line) => lines[line - 1] };\n}\n\n/** The guarded JavaScript of an exec body. */\nexport function compileScript(source: string): string {\n return compileModule(source).code;\n}\n"],"mappings":";;;;;;;AAKA,MAAa,aAAa;;AAE1B,MAAa,cAAc;AAE3B,MAAM,mBAAmB;AACzB,MAAM,aAAa,GAAG,WAAW;AACjC,MAAM,6BAAa,IAAI,IAAI;CAAC;CAAkB;CAAoB;CAAgB;CAAkB;AAAgB,CAAC;AACrH,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAuB;CAAsB;AAAyB,CAAC;AAEvG,MAAM,SAAS;;AAEf,MAAM,WAAW;CACf,MAAM,CAAC,gCAAgC,QAAQ;CAC/C,QAAQ,CAAC,2BAA2B,MAAM;AAC5C;AAEA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,OAAyB;AAC3B;AAWA,SAAS,OAAO,OAAkC;CAChD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAQ,MAA6B,SAAS;AACtG;;AASA,SAAS,YAAY,UAA0C;CAC7D,MAAM,QAAgC,CAAC;CACvC,IAAI,aAAa;CACjB,KAAK,MAAM,SAAS,SAAS,MAAM,GAAG,GAAG;EACvC,IAAI;EACJ,KAAK,MAAM,WAAW,MAAM,MAAM,GAAG,GAAG;GACtC,MAAM,SAAmB,CAAC;GAC1B,IAAI,QAAQ;GACZ,IAAI,QAAQ;GACZ,KAAK,MAAM,QAAQ,SAAS;IAC1B,MAAM,QAAQ,OAAO,QAAQ,IAAI;IACjC,UAAU,QAAQ,OAAO;IACzB,IAAI,QAAQ,IAAI,SAAS;SACpB;KACH,OAAO,KAAK,QAAQ,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;KACpD,QAAQ;KACR,QAAQ;IACV;GACF;GACA,IAAI,OAAO,SAAS,GAAG;GACvB,cAAc,OAAO;GACrB,UAAU,aAAa;EACzB;EACA,MAAM,KAAK,KAAK;CAClB;CACA,OAAO;AACT;AAEA,SAAS,aAAa,MAAc,SAA0B;CAC5D,MAAM,S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AAY,WAAW,GACzC,IAAI,OAAO,SAAS,IAAI,GAAG,MAAM,IAAI,mBAAmB,IAAI,KAAK,eAAe;CAElF,MAAM,CAAC,QAAQ,SAAS,SAAS;CACjC,MAAM,YAAA,GAAWC,eAAAA,cAAAA,CAAc,aAAa,GAAG,SAAS,SAAS,SAAS;EACxE,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,WAAW;CACb,CAAC;CACD,IAAI,SAAS,OAAO,SAAS,GAC3B,MAAM,IAAI,mBAAmB,SAAS,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAEvF,IAAI;CACJ,IAAI;EACF,WAAA,GAAUC,kBAAAA,SAAAA,CAAS,SAAS,MAAM;GAAE,MAAM;GAAM,YAAY;EAAS,GAAG,WAAW;CACrF,SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,IAAI,oBAAoB,KAAK,OAAO,GAClC,MAAM,IAAI,mBAAmB,4EAA4E;EAE3G,MAAM,IAAI,mBAAmB,OAAO;CACtC;CACA,MAAM,QAAQ,YAAY,SAAS,KAAK,YAAY,EAAE;CACtD,OAAO;EAAE,MAAM,aAAa,SAAS,MAAM,OAAO;EAAG,SAAS,SAAS,MAAM,OAAO;CAAG;AACzF"}
1
+ {"version":3,"file":"compile.cjs","names":["GUARD_NAME","MagicString","IMPORT_NAME","transformSync","parseAst"],"sources":["../../../../src/builders/isolate/compile.ts"],"sourcesContent":["import MagicString from 'magic-string';\nimport { parseAst } from 'rolldown/parseAst';\nimport { transformSync } from 'rolldown/utils';\n\nimport { GUARD_NAME, IMPORT_NAME } from './names';\n\nconst MAX_SOURCE_CHARS = 64 * 1024;\nconst GUARD_CALL = `${GUARD_NAME}();`;\nconst LOOP_TYPES = new Set(['WhileStatement', 'DoWhileStatement', 'ForStatement', 'ForInStatement', 'ForOfStatement']);\nconst FUNCTION_TYPES = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\nconst IMPORT_KEYWORD = 'import';\nconst BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n/** How a body is wrapped: the exec script runs at once, an imported one becomes a function of `args`. */\nconst WRAPPERS = {\n main: ['(async function __po_main(){', '\\n})()'],\n import: ['(async function (args){', '\\n})'],\n} as const;\n\nexport class ScriptCompileError extends Error {\n override readonly name = 'SyntaxError';\n}\n\ninterface AstNode {\n readonly type: string;\n readonly start: number;\n readonly end: number;\n readonly body?: AstNode | readonly AstNode[];\n readonly expression?: boolean;\n readonly [key: string]: unknown;\n}\n\nfunction isNode(value: unknown): value is AstNode {\n return typeof value === 'object' && value !== null && typeof (value as { type?: unknown }).type === 'string';\n}\n\nexport interface CompiledScript {\n readonly code: string;\n /** 1-based line in the submitted body for a 1-based line of `code`, when known. */\n readonly lineOf: (line: number) => number | undefined;\n}\n\n/** The first source line each generated line maps to, from a v3 source map's `mappings`. */\nfunction sourceLines(mappings: string): (number | undefined)[] {\n const lines: (number | undefined)[] = [];\n let sourceLine = 0;\n for (const group of mappings.split(';')) {\n let first: number | undefined;\n for (const segment of group.split(',')) {\n const fields: number[] = [];\n let value = 0;\n let shift = 0;\n for (const char of segment) {\n const digit = BASE64.indexOf(char);\n value += (digit & 31) << shift;\n if (digit & 32) shift += 5;\n else {\n fields.push(value & 1 ? -(value >>> 1) : value >>> 1);\n value = 0;\n shift = 0;\n }\n }\n if (fields.length < 4) continue;\n sourceLine += fields[2] as number;\n first ??= sourceLine + 1;\n }\n lines.push(first);\n }\n return lines;\n}\n\nfunction insertGuards(code: string, program: AstNode): string {\n const output = new MagicString(code);\n const visit = (node: AstNode): void => {\n if (node.type === 'ImportExpression') {\n output.overwrite(node.start, node.start + IMPORT_KEYWORD.length, IMPORT_NAME, { contentOnly: true });\n }\n if (LOOP_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (body.type === 'BlockStatement') output.appendLeft(body.start + 1, GUARD_CALL);\n else {\n output.prependRight(body.start, `{${GUARD_CALL}`);\n output.appendLeft(body.end, '}');\n }\n } else if (node.type === 'StaticBlock') {\n output.appendLeft(code.indexOf('{', node.start) + 1, GUARD_CALL);\n } else if (FUNCTION_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (node.type === 'ArrowFunctionExpression' && node.expression) {\n output.prependRight(body.start, `(${GUARD_NAME}(),`);\n output.appendLeft(body.end, ')');\n } else output.appendLeft(body.start + 1, GUARD_CALL);\n }\n for (const [key, value] of Object.entries(node)) {\n if (key === 'parent') continue;\n if (Array.isArray(value)) for (const child of value) if (isNode(child)) visit(child);\n if (isNode(value)) visit(value);\n }\n };\n visit(program);\n return output.toString();\n}\n\n/**\n * Turns a model-written TypeScript body into guarded JavaScript whose loops and functions call the\n * guard, so a runaway script stops even after an `await`. `main` runs the body as an async IIFE;\n * `import` evaluates to an async function of `args`. Lines of the body stay on the wrapper's line.\n */\nexport function compileModule(source: string, kind: keyof typeof WRAPPERS = 'main'): CompiledScript {\n if (source.length > MAX_SOURCE_CHARS) throw new ScriptCompileError(`Script exceeds ${MAX_SOURCE_CHARS} characters.`);\n for (const name of [GUARD_NAME, IMPORT_NAME]) {\n if (source.includes(name)) throw new ScriptCompileError(`\"${name}\" is reserved.`);\n }\n const [before, after] = WRAPPERS[kind];\n const stripped = transformSync('script.ts', `${before}${source}${after}`, {\n lang: 'ts',\n sourceType: 'script',\n target: 'es2022',\n sourcemap: true,\n });\n if (stripped.errors.length > 0) {\n throw new ScriptCompileError(stripped.errors.map((error) => error.message).join('\\n'));\n }\n let program: AstNode;\n try {\n program = parseAst(stripped.code, { lang: 'js', sourceType: 'script' }, 'script.js') as unknown as AstNode;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/import statement/u.test(message)) {\n throw new ScriptCompileError('Static import statements are not supported; use await import(...) instead.');\n }\n throw new ScriptCompileError(message);\n }\n const lines = sourceLines(stripped.map?.mappings ?? '');\n return { code: insertGuards(stripped.code, program), lineOf: (line) => lines[line - 1] };\n}\n\n/** The guarded JavaScript of an exec body. */\nexport function compileScript(source: string): string {\n return compileModule(source).code;\n}\n"],"mappings":";;;;;;;AAMA,MAAM,mBAAmB;AACzB,MAAM,aAAa,GAAGA,cAAAA,WAAW;AACjC,MAAM,6BAAa,IAAI,IAAI;CAAC;CAAkB;CAAoB;CAAgB;CAAkB;AAAgB,CAAC;AACrH,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAuB;CAAsB;AAAyB,CAAC;AAEvG,MAAM,SAAS;;AAEf,MAAM,WAAW;CACf,MAAM,CAAC,gCAAgC,QAAQ;CAC/C,QAAQ,CAAC,2BAA2B,MAAM;AAC5C;AAEA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,OAAyB;AAC3B;AAWA,SAAS,OAAO,OAAkC;CAChD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAQ,MAA6B,SAAS;AACtG;;AASA,SAAS,YAAY,UAA0C;CAC7D,MAAM,QAAgC,CAAC;CACvC,IAAI,aAAa;CACjB,KAAK,MAAM,SAAS,SAAS,MAAM,GAAG,GAAG;EACvC,IAAI;EACJ,KAAK,MAAM,WAAW,MAAM,MAAM,GAAG,GAAG;GACtC,MAAM,SAAmB,CAAC;GAC1B,IAAI,QAAQ;GACZ,IAAI,QAAQ;GACZ,KAAK,MAAM,QAAQ,SAAS;IAC1B,MAAM,QAAQ,OAAO,QAAQ,IAAI;IACjC,UAAU,QAAQ,OAAO;IACzB,IAAI,QAAQ,IAAI,SAAS;SACpB;KACH,OAAO,KAAK,QAAQ,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;KACpD,QAAQ;KACR,QAAQ;IACV;GACF;GACA,IAAI,OAAO,SAAS,GAAG;GACvB,cAAc,OAAO;GACrB,UAAU,aAAa;EACzB;EACA,MAAM,KAAK,KAAK;CAClB;CACA,OAAO;AACT;AAEA,SAAS,aAAa,MAAc,SAA0B;CAC5D,MAAM,SAAS,IA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,CAACA,cAAAA,YAAYE,cAAAA,WAAW,GACzC,IAAI,OAAO,SAAS,IAAI,GAAG,MAAM,IAAI,mBAAmB,IAAI,KAAK,eAAe;CAElF,MAAM,CAAC,QAAQ,SAAS,SAAS;CACjC,MAAM,YAAA,GAAWC,eAAAA,cAAAA,CAAc,aAAa,GAAG,SAAS,SAAS,SAAS;EACxE,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,WAAW;CACb,CAAC;CACD,IAAI,SAAS,OAAO,SAAS,GAC3B,MAAM,IAAI,mBAAmB,SAAS,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAEvF,IAAI;CACJ,IAAI;EACF,WAAA,GAAUC,kBAAAA,SAAAA,CAAS,SAAS,MAAM;GAAE,MAAM;GAAM,YAAY;EAAS,GAAG,WAAW;CACrF,SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,IAAI,oBAAoB,KAAK,OAAO,GAClC,MAAM,IAAI,mBAAmB,4EAA4E;EAE3G,MAAM,IAAI,mBAAmB,OAAO;CACtC;CACA,MAAM,QAAQ,YAAY,SAAS,KAAK,YAAY,EAAE;CACtD,OAAO;EAAE,MAAM,aAAa,SAAS,MAAM,OAAO;EAAG,SAAS,SAAS,MAAM,OAAO;CAAG;AACzF;;AAGA,SAAgB,cAAc,QAAwB;CACpD,OAAO,cAAc,MAAM,CAAC,CAAC;AAC/B"}
@@ -1,11 +1,8 @@
1
+ import { GUARD_NAME, IMPORT_NAME } from "./names.mjs";
1
2
  import MagicString from "magic-string";
2
3
  import { parseAst } from "rolldown/parseAst";
3
4
  import { transformSync } from "rolldown/utils";
4
5
  //#region src/builders/isolate/compile.ts
5
- /** Called at the top of every loop body and function body; throws once the run must stop. */
6
- const GUARD_NAME = "__po_g";
7
- /** Every `import(x)` becomes a call to this host function, which loads another script body. */
8
- const IMPORT_NAME = "__po_import";
9
6
  const MAX_SOURCE_CHARS = 65536;
10
7
  const GUARD_CALL = `${GUARD_NAME}();`;
11
8
  const LOOP_TYPES = /* @__PURE__ */ new Set([
@@ -123,7 +120,11 @@ function compileModule(source, kind = "main") {
123
120
  lineOf: (line) => lines[line - 1]
124
121
  };
125
122
  }
123
+ /** The guarded JavaScript of an exec body. */
124
+ function compileScript(source) {
125
+ return compileModule(source).code;
126
+ }
126
127
  //#endregion
127
- export { GUARD_NAME, IMPORT_NAME, ScriptCompileError, compileModule };
128
+ export { ScriptCompileError, compileModule, compileScript };
128
129
 
129
130
  //# sourceMappingURL=compile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.mjs","names":[],"sources":["../../../../src/builders/isolate/compile.ts"],"sourcesContent":["import MagicString from 'magic-string';\nimport { parseAst } from 'rolldown/parseAst';\nimport { transformSync } from 'rolldown/utils';\n\n/** Called at the top of every loop body and function body; throws once the run must stop. */\nexport const GUARD_NAME = '__po_g';\n/** Every `import(x)` becomes a call to this host function, which loads another script body. */\nexport const IMPORT_NAME = '__po_import';\n\nconst MAX_SOURCE_CHARS = 64 * 1024;\nconst GUARD_CALL = `${GUARD_NAME}();`;\nconst LOOP_TYPES = new Set(['WhileStatement', 'DoWhileStatement', 'ForStatement', 'ForInStatement', 'ForOfStatement']);\nconst FUNCTION_TYPES = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\nconst IMPORT_KEYWORD = 'import';\nconst BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n/** How a body is wrapped: the exec script runs at once, an imported one becomes a function of `args`. */\nconst WRAPPERS = {\n main: ['(async function __po_main(){', '\\n})()'],\n import: ['(async function (args){', '\\n})'],\n} as const;\n\nexport class ScriptCompileError extends Error {\n override readonly name = 'SyntaxError';\n}\n\ninterface AstNode {\n readonly type: string;\n readonly start: number;\n readonly end: number;\n readonly body?: AstNode | readonly AstNode[];\n readonly expression?: boolean;\n readonly [key: string]: unknown;\n}\n\nfunction isNode(value: unknown): value is AstNode {\n return typeof value === 'object' && value !== null && typeof (value as { type?: unknown }).type === 'string';\n}\n\nexport interface CompiledScript {\n readonly code: string;\n /** 1-based line in the submitted body for a 1-based line of `code`, when known. */\n readonly lineOf: (line: number) => number | undefined;\n}\n\n/** The first source line each generated line maps to, from a v3 source map's `mappings`. */\nfunction sourceLines(mappings: string): (number | undefined)[] {\n const lines: (number | undefined)[] = [];\n let sourceLine = 0;\n for (const group of mappings.split(';')) {\n let first: number | undefined;\n for (const segment of group.split(',')) {\n const fields: number[] = [];\n let value = 0;\n let shift = 0;\n for (const char of segment) {\n const digit = BASE64.indexOf(char);\n value += (digit & 31) << shift;\n if (digit & 32) shift += 5;\n else {\n fields.push(value & 1 ? -(value >>> 1) : value >>> 1);\n value = 0;\n shift = 0;\n }\n }\n if (fields.length < 4) continue;\n sourceLine += fields[2] as number;\n first ??= sourceLine + 1;\n }\n lines.push(first);\n }\n return lines;\n}\n\nfunction insertGuards(code: string, program: AstNode): string {\n const output = new MagicString(code);\n const visit = (node: AstNode): void => {\n if (node.type === 'ImportExpression') {\n output.overwrite(node.start, node.start + IMPORT_KEYWORD.length, IMPORT_NAME, { contentOnly: true });\n }\n if (LOOP_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (body.type === 'BlockStatement') output.appendLeft(body.start + 1, GUARD_CALL);\n else {\n output.prependRight(body.start, `{${GUARD_CALL}`);\n output.appendLeft(body.end, '}');\n }\n } else if (node.type === 'StaticBlock') {\n output.appendLeft(code.indexOf('{', node.start) + 1, GUARD_CALL);\n } else if (FUNCTION_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (node.type === 'ArrowFunctionExpression' && node.expression) {\n output.prependRight(body.start, `(${GUARD_NAME}(),`);\n output.appendLeft(body.end, ')');\n } else output.appendLeft(body.start + 1, GUARD_CALL);\n }\n for (const [key, value] of Object.entries(node)) {\n if (key === 'parent') continue;\n if (Array.isArray(value)) for (const child of value) if (isNode(child)) visit(child);\n if (isNode(value)) visit(value);\n }\n };\n visit(program);\n return output.toString();\n}\n\n/**\n * Turns a model-written TypeScript body into guarded JavaScript whose loops and functions call the\n * guard, so a runaway script stops even after an `await`. `main` runs the body as an async IIFE;\n * `import` evaluates to an async function of `args`. Lines of the body stay on the wrapper's line.\n */\nexport function compileModule(source: string, kind: keyof typeof WRAPPERS = 'main'): CompiledScript {\n if (source.length > MAX_SOURCE_CHARS) throw new ScriptCompileError(`Script exceeds ${MAX_SOURCE_CHARS} characters.`);\n for (const name of [GUARD_NAME, IMPORT_NAME]) {\n if (source.includes(name)) throw new ScriptCompileError(`\"${name}\" is reserved.`);\n }\n const [before, after] = WRAPPERS[kind];\n const stripped = transformSync('script.ts', `${before}${source}${after}`, {\n lang: 'ts',\n sourceType: 'script',\n target: 'es2022',\n sourcemap: true,\n });\n if (stripped.errors.length > 0) {\n throw new ScriptCompileError(stripped.errors.map((error) => error.message).join('\\n'));\n }\n let program: AstNode;\n try {\n program = parseAst(stripped.code, { lang: 'js', sourceType: 'script' }, 'script.js') as unknown as AstNode;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/import statement/u.test(message)) {\n throw new ScriptCompileError('Static import statements are not supported; use await import(...) instead.');\n }\n throw new ScriptCompileError(message);\n }\n const lines = sourceLines(stripped.map?.mappings ?? '');\n return { code: insertGuards(stripped.code, program), lineOf: (line) => lines[line - 1] };\n}\n\n/** The guarded JavaScript of an exec body. */\nexport function compileScript(source: string): string {\n return compileModule(source).code;\n}\n"],"mappings":";;;;;AAKA,MAAa,aAAa;;AAE1B,MAAa,cAAc;AAE3B,MAAM,mBAAmB;AACzB,MAAM,aAAa,GAAG,WAAW;AACjC,MAAM,6BAAa,IAAI,IAAI;CAAC;CAAkB;CAAoB;CAAgB;CAAkB;AAAgB,CAAC;AACrH,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAuB;CAAsB;AAAyB,CAAC;AAEvG,MAAM,SAAS;;AAEf,MAAM,WAAW;C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F,UAAU,SAAS,SAAS,MAAM;GAAE,MAAM;GAAM,YAAY;EAAS,GAAG,WAAW;CACrF,SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,IAAI,oBAAoB,KAAK,OAAO,GAClC,MAAM,IAAI,mBAAmB,4EAA4E;EAE3G,MAAM,IAAI,mBAAmB,OAAO;CACtC;CACA,MAAM,QAAQ,YAAY,SAAS,KAAK,YAAY,EAAE;CACtD,OAAO;EAAE,MAAM,aAAa,SAAS,MAAM,OAAO;EAAG,SAAS,SAAS,MAAM,OAAO;CAAG;AACzF"}
1
+ {"version":3,"file":"compile.mjs","names":[],"sources":["../../../../src/builders/isolate/compile.ts"],"sourcesContent":["import MagicString from 'magic-string';\nimport { parseAst } from 'rolldown/parseAst';\nimport { transformSync } from 'rolldown/utils';\n\nimport { GUARD_NAME, IMPORT_NAME } from './names';\n\nconst MAX_SOURCE_CHARS = 64 * 1024;\nconst GUARD_CALL = `${GUARD_NAME}();`;\nconst LOOP_TYPES = new Set(['WhileStatement', 'DoWhileStatement', 'ForStatement', 'ForInStatement', 'ForOfStatement']);\nconst FUNCTION_TYPES = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\nconst IMPORT_KEYWORD = 'import';\nconst BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n/** How a body is wrapped: the exec script runs at once, an imported one becomes a function of `args`. */\nconst WRAPPERS = {\n main: ['(async function __po_main(){', '\\n})()'],\n import: ['(async function (args){', '\\n})'],\n} as const;\n\nexport class ScriptCompileError extends Error {\n override readonly name = 'SyntaxError';\n}\n\ninterface AstNode {\n readonly type: string;\n readonly start: number;\n readonly end: number;\n readonly body?: AstNode | readonly AstNode[];\n readonly expression?: boolean;\n readonly [key: string]: unknown;\n}\n\nfunction isNode(value: unknown): value is AstNode {\n return typeof value === 'object' && value !== null && typeof (value as { type?: unknown }).type === 'string';\n}\n\nexport interface CompiledScript {\n readonly code: string;\n /** 1-based line in the submitted body for a 1-based line of `code`, when known. */\n readonly lineOf: (line: number) => number | undefined;\n}\n\n/** The first source line each generated line maps to, from a v3 source map's `mappings`. */\nfunction sourceLines(mappings: string): (number | undefined)[] {\n const lines: (number | undefined)[] = [];\n let sourceLine = 0;\n for (const group of mappings.split(';')) {\n let first: number | undefined;\n for (const segment of group.split(',')) {\n const fields: number[] = [];\n let value = 0;\n let shift = 0;\n for (const char of segment) {\n const digit = BASE64.indexOf(char);\n value += (digit & 31) << shift;\n if (digit & 32) shift += 5;\n else {\n fields.push(value & 1 ? -(value >>> 1) : value >>> 1);\n value = 0;\n shift = 0;\n }\n }\n if (fields.length < 4) continue;\n sourceLine += fields[2] as number;\n first ??= sourceLine + 1;\n }\n lines.push(first);\n }\n return lines;\n}\n\nfunction insertGuards(code: string, program: AstNode): string {\n const output = new MagicString(code);\n const visit = (node: AstNode): void => {\n if (node.type === 'ImportExpression') {\n output.overwrite(node.start, node.start + IMPORT_KEYWORD.length, IMPORT_NAME, { contentOnly: true });\n }\n if (LOOP_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (body.type === 'BlockStatement') output.appendLeft(body.start + 1, GUARD_CALL);\n else {\n output.prependRight(body.start, `{${GUARD_CALL}`);\n output.appendLeft(body.end, '}');\n }\n } else if (node.type === 'StaticBlock') {\n output.appendLeft(code.indexOf('{', node.start) + 1, GUARD_CALL);\n } else if (FUNCTION_TYPES.has(node.type) && isNode(node.body)) {\n const body = node.body;\n if (node.type === 'ArrowFunctionExpression' && node.expression) {\n output.prependRight(body.start, `(${GUARD_NAME}(),`);\n output.appendLeft(body.end, ')');\n } else output.appendLeft(body.start + 1, GUARD_CALL);\n }\n for (const [key, value] of Object.entries(node)) {\n if (key === 'parent') continue;\n if (Array.isArray(value)) for (const child of value) if (isNode(child)) visit(child);\n if (isNode(value)) visit(value);\n }\n };\n visit(program);\n return output.toString();\n}\n\n/**\n * Turns a model-written TypeScript body into guarded JavaScript whose loops and functions call the\n * guard, so a runaway script stops even after an `await`. `main` runs the body as an async IIFE;\n * `import` evaluates to an async function of `args`. Lines of the body stay on the wrapper's line.\n */\nexport function compileModule(source: string, kind: keyof typeof WRAPPERS = 'main'): CompiledScript {\n if (source.length > MAX_SOURCE_CHARS) throw new ScriptCompileError(`Script exceeds ${MAX_SOURCE_CHARS} characters.`);\n for (const name of [GUARD_NAME, IMPORT_NAME]) {\n if (source.includes(name)) throw new ScriptCompileError(`\"${name}\" is reserved.`);\n }\n const [before, after] = WRAPPERS[kind];\n const stripped = transformSync('script.ts', `${before}${source}${after}`, {\n lang: 'ts',\n sourceType: 'script',\n target: 'es2022',\n sourcemap: true,\n });\n if (stripped.errors.length > 0) {\n throw new ScriptCompileError(stripped.errors.map((error) => error.message).join('\\n'));\n }\n let program: AstNode;\n try {\n program = parseAst(stripped.code, { lang: 'js', sourceType: 'script' }, 'script.js') as unknown as AstNode;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/import statement/u.test(message)) {\n throw new ScriptCompileError('Static import statements are not supported; use await import(...) instead.');\n }\n throw new ScriptCompileError(message);\n }\n const lines = sourceLines(stripped.map?.mappings ?? '');\n return { code: insertGuards(stripped.code, program), lineOf: (line) => lines[line - 1] };\n}\n\n/** The guarded JavaScript of an exec body. */\nexport function compileScript(source: string): string {\n return compileModule(source).code;\n}\n"],"mappings":";;;;;AAMA,MAAM,mBAAmB;AACzB,MAAM,aAAa,GAAG,WAAW;AACjC,MAAM,6BAAa,IAAI,IAAI;CAAC;CAAkB;CAAoB;CAAgB;CAAkB;AAAgB,CAAC;AACrH,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAuB;CAAsB;AAAyB,CAAC;AAEvG,MAAM,SAAS;;AAEf,MAAM,WAAW;CACf,MAAM,CAAC,gCAAgC,QAAQ;CAC/C,QAAQ,CAAC,2BAA2B,MAAM;AAC5C;AAEA,IAAa,qBAAb,cAAwC,MAAM;CAC5C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