@arbidocs/blocks 0.5.138 → 0.5.140

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 (43) hide show
  1. package/dist/{DocumentReviewCard-EM2AJUF3.cjs → DocumentReviewCard-QPFP7BV7.cjs} +12 -12
  2. package/dist/{DocumentReviewCard-EM2AJUF3.cjs.map → DocumentReviewCard-QPFP7BV7.cjs.map} +1 -1
  3. package/dist/{FilesViewerDialog-IFF2JR2A.cjs → FilesViewerDialog-KBDKIQGD.cjs} +8 -8
  4. package/dist/{FilesViewerDialog-IFF2JR2A.cjs.map → FilesViewerDialog-KBDKIQGD.cjs.map} +1 -1
  5. package/dist/{chunk-VPKKPHJY.cjs → chunk-33GOYI3O.cjs} +4 -4
  6. package/dist/{chunk-VPKKPHJY.cjs.map → chunk-33GOYI3O.cjs.map} +1 -1
  7. package/dist/{chunk-IEAZX7L6.cjs → chunk-5Z22EXHJ.cjs} +2 -2
  8. package/dist/{chunk-IEAZX7L6.cjs.map → chunk-5Z22EXHJ.cjs.map} +1 -1
  9. package/dist/{chunk-BN33PC5F.cjs → chunk-C4Z6LOLA.cjs} +8 -8
  10. package/dist/{chunk-BN33PC5F.cjs.map → chunk-C4Z6LOLA.cjs.map} +1 -1
  11. package/dist/{chunk-MMKMQZ2B.cjs → chunk-CESE7GLT.cjs} +7 -7
  12. package/dist/{chunk-MMKMQZ2B.cjs.map → chunk-CESE7GLT.cjs.map} +1 -1
  13. package/dist/{chunk-VIUEPJ3Y.cjs → chunk-KP7BQIZL.cjs} +35 -35
  14. package/dist/{chunk-VIUEPJ3Y.cjs.map → chunk-KP7BQIZL.cjs.map} +1 -1
  15. package/dist/{chunk-JYZ6UE5X.cjs → chunk-MBXXWTKT.cjs} +28 -28
  16. package/dist/{chunk-JYZ6UE5X.cjs.map → chunk-MBXXWTKT.cjs.map} +1 -1
  17. package/dist/{chunk-5GHGIDZP.cjs → chunk-ORQXGMCC.cjs} +4 -4
  18. package/dist/{chunk-5GHGIDZP.cjs.map → chunk-ORQXGMCC.cjs.map} +1 -1
  19. package/dist/{chunk-LLD4PNBW.cjs → chunk-UD56Y6UA.cjs} +4 -4
  20. package/dist/{chunk-LLD4PNBW.cjs.map → chunk-UD56Y6UA.cjs.map} +1 -1
  21. package/dist/{chunk-ZN2JXV65.cjs → chunk-Z5YJKM57.cjs} +52 -52
  22. package/dist/{chunk-ZN2JXV65.cjs.map → chunk-Z5YJKM57.cjs.map} +1 -1
  23. package/dist/{chunk-FYFL3CET.cjs → chunk-ZPIZINH2.cjs} +7 -7
  24. package/dist/chunk-ZPIZINH2.cjs.map +1 -0
  25. package/dist/connect/index.cjs +442 -442
  26. package/dist/connect/index.cjs.map +1 -1
  27. package/dist/connect/viewer.cjs +6 -6
  28. package/dist/connection/notification-center/NotificationEvent.js +1 -1
  29. package/dist/connection/notification-center/NotificationEvent.js.map +1 -1
  30. package/dist/embed/index.cjs +12 -12
  31. package/dist/files/folders/folderPaths.js +5 -5
  32. package/dist/files/folders/folderPaths.js.map +2 -2
  33. package/dist/files/index.cjs +222 -222
  34. package/dist/index.cjs +58 -58
  35. package/dist/vite/index.cjs +11 -10
  36. package/dist/vite/index.cjs.map +1 -1
  37. package/dist/vite/index.d.ts +4 -13
  38. package/dist/vite/index.js +11 -10
  39. package/dist/vite/index.js.map +1 -1
  40. package/dist/workflow-canvas/index.cjs +13 -13
  41. package/node_modules/@arbidocs/coedit/package.json +1 -1
  42. package/package.json +5 -5
  43. package/dist/chunk-FYFL3CET.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -8,9 +8,9 @@ var chunk6RC6GYIW_cjs = require('./chunk-6RC6GYIW.cjs');
8
8
  var chunkANWJG4A4_cjs = require('./chunk-ANWJG4A4.cjs');
9
9
  var chunkICZSVCDT_cjs = require('./chunk-ICZSVCDT.cjs');
10
10
  var chunkSRTSMA5K_cjs = require('./chunk-SRTSMA5K.cjs');
11
- require('./chunk-TS2XVXYK.cjs');
12
11
  var chunkVZKTOGZR_cjs = require('./chunk-VZKTOGZR.cjs');
13
- var chunkIEAZX7L6_cjs = require('./chunk-IEAZX7L6.cjs');
12
+ require('./chunk-TS2XVXYK.cjs');
13
+ var chunk5Z22EXHJ_cjs = require('./chunk-5Z22EXHJ.cjs');
14
14
  var chunkEYXU32D7_cjs = require('./chunk-EYXU32D7.cjs');
15
15
  var chunkNEGFHF3V_cjs = require('./chunk-NEGFHF3V.cjs');
16
16
  var chunkZ3LFF3YT_cjs = require('./chunk-Z3LFF3YT.cjs');
@@ -36,9 +36,9 @@ var chunkWQMR3O2D_cjs = require('./chunk-WQMR3O2D.cjs');
36
36
  var chunkNZNBJF3M_cjs = require('./chunk-NZNBJF3M.cjs');
37
37
  var chunkNWNVWO6L_cjs = require('./chunk-NWNVWO6L.cjs');
38
38
  var chunkSK6HQ46Q_cjs = require('./chunk-SK6HQ46Q.cjs');
39
+ var chunkTG2GM7WJ_cjs = require('./chunk-TG2GM7WJ.cjs');
39
40
  var chunkMNIQDXM6_cjs = require('./chunk-MNIQDXM6.cjs');
40
41
  var chunkT6WA6S5T_cjs = require('./chunk-T6WA6S5T.cjs');
41
- var chunkTG2GM7WJ_cjs = require('./chunk-TG2GM7WJ.cjs');
42
42
  var chunkL62EU3TQ_cjs = require('./chunk-L62EU3TQ.cjs');
43
43
  var chunkSD7GUB44_cjs = require('./chunk-SD7GUB44.cjs');
44
44
  var chunkZU2B2RZK_cjs = require('./chunk-ZU2B2RZK.cjs');
@@ -416,191 +416,191 @@ Object.defineProperty(exports, "vCardFilename", {
416
416
  });
417
417
  Object.defineProperty(exports, "DEFAULT_GLOSSARY_LABELS", {
418
418
  enumerable: true,
419
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_GLOSSARY_LABELS; }
419
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_GLOSSARY_LABELS; }
420
420
  });
421
421
  Object.defineProperty(exports, "DEFAULT_TAG_COLUMNS_EDITOR_LABELS", {
422
422
  enumerable: true,
423
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_TAG_COLUMNS_EDITOR_LABELS; }
423
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_TAG_COLUMNS_EDITOR_LABELS; }
424
424
  });
425
425
  Object.defineProperty(exports, "DEFAULT_TAG_DETAIL_LABELS", {
426
426
  enumerable: true,
427
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_TAG_DETAIL_LABELS; }
427
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_TAG_DETAIL_LABELS; }
428
428
  });
429
429
  Object.defineProperty(exports, "DEFAULT_TAG_TABLE_DOCX_LABELS", {
430
430
  enumerable: true,
431
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_TAG_TABLE_DOCX_LABELS; }
431
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_TAG_TABLE_DOCX_LABELS; }
432
432
  });
433
433
  Object.defineProperty(exports, "DEFAULT_TAG_TABLE_LABELS", {
434
434
  enumerable: true,
435
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_TAG_TABLE_LABELS; }
435
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_TAG_TABLE_LABELS; }
436
436
  });
437
437
  Object.defineProperty(exports, "DEFAULT_WORKSPACE_ACTIVITY_LABELS", {
438
438
  enumerable: true,
439
- get: function () { return chunkIEAZX7L6_cjs.DEFAULT_WORKSPACE_ACTIVITY_LABELS; }
439
+ get: function () { return chunk5Z22EXHJ_cjs.DEFAULT_WORKSPACE_ACTIVITY_LABELS; }
440
440
  });
441
441
  Object.defineProperty(exports, "EXTRACT_LIMIT", {
442
442
  enumerable: true,
443
- get: function () { return chunkIEAZX7L6_cjs.EXTRACT_LIMIT; }
443
+ get: function () { return chunk5Z22EXHJ_cjs.EXTRACT_LIMIT; }
444
444
  });
445
445
  Object.defineProperty(exports, "EntityIdentityBar", {
446
446
  enumerable: true,
447
- get: function () { return chunkIEAZX7L6_cjs.EntityIdentityBar; }
447
+ get: function () { return chunk5Z22EXHJ_cjs.EntityIdentityBar; }
448
448
  });
449
449
  Object.defineProperty(exports, "ExtractEntitiesDialog", {
450
450
  enumerable: true,
451
- get: function () { return chunkIEAZX7L6_cjs.ExtractEntitiesDialog; }
451
+ get: function () { return chunk5Z22EXHJ_cjs.ExtractEntitiesDialog; }
452
452
  });
453
453
  Object.defineProperty(exports, "GridRowNavigator", {
454
454
  enumerable: true,
455
- get: function () { return chunkIEAZX7L6_cjs.GridRowNavigator; }
455
+ get: function () { return chunk5Z22EXHJ_cjs.GridRowNavigator; }
456
456
  });
457
457
  Object.defineProperty(exports, "GuidedCursor", {
458
458
  enumerable: true,
459
- get: function () { return chunkIEAZX7L6_cjs.GuidedCursor; }
459
+ get: function () { return chunk5Z22EXHJ_cjs.GuidedCursor; }
460
460
  });
461
461
  Object.defineProperty(exports, "IDENTITY_NAME_MAX_LENGTH", {
462
462
  enumerable: true,
463
- get: function () { return chunkIEAZX7L6_cjs.IDENTITY_NAME_MAX_LENGTH; }
463
+ get: function () { return chunk5Z22EXHJ_cjs.IDENTITY_NAME_MAX_LENGTH; }
464
464
  });
465
465
  Object.defineProperty(exports, "KIT_CHUNK_LOADERS", {
466
466
  enumerable: true,
467
- get: function () { return chunkIEAZX7L6_cjs.KIT_CHUNK_LOADERS; }
467
+ get: function () { return chunk5Z22EXHJ_cjs.KIT_CHUNK_LOADERS; }
468
468
  });
469
469
  Object.defineProperty(exports, "LoadingIndicator", {
470
470
  enumerable: true,
471
- get: function () { return chunkIEAZX7L6_cjs.LoadingIndicator; }
471
+ get: function () { return chunk5Z22EXHJ_cjs.LoadingIndicator; }
472
472
  });
473
473
  Object.defineProperty(exports, "TAG_TABLE_DOCX_LANDSCAPE_AFTER", {
474
474
  enumerable: true,
475
- get: function () { return chunkIEAZX7L6_cjs.TAG_TABLE_DOCX_LANDSCAPE_AFTER; }
475
+ get: function () { return chunk5Z22EXHJ_cjs.TAG_TABLE_DOCX_LANDSCAPE_AFTER; }
476
476
  });
477
477
  Object.defineProperty(exports, "TagColumnsEditor", {
478
478
  enumerable: true,
479
- get: function () { return chunkIEAZX7L6_cjs.TagColumnsEditor; }
479
+ get: function () { return chunk5Z22EXHJ_cjs.TagColumnsEditor; }
480
480
  });
481
481
  Object.defineProperty(exports, "TagDetail", {
482
482
  enumerable: true,
483
- get: function () { return chunkIEAZX7L6_cjs.TagDetail; }
483
+ get: function () { return chunk5Z22EXHJ_cjs.TagDetail; }
484
484
  });
485
485
  Object.defineProperty(exports, "TagTable", {
486
486
  enumerable: true,
487
- get: function () { return chunkIEAZX7L6_cjs.TagTable; }
487
+ get: function () { return chunk5Z22EXHJ_cjs.TagTable; }
488
488
  });
489
489
  Object.defineProperty(exports, "TagTableCell", {
490
490
  enumerable: true,
491
- get: function () { return chunkIEAZX7L6_cjs.TagTableCell; }
491
+ get: function () { return chunk5Z22EXHJ_cjs.TagTableCell; }
492
492
  });
493
493
  Object.defineProperty(exports, "Toolbar", {
494
494
  enumerable: true,
495
- get: function () { return chunkIEAZX7L6_cjs.Toolbar; }
495
+ get: function () { return chunk5Z22EXHJ_cjs.Toolbar; }
496
496
  });
497
497
  Object.defineProperty(exports, "WorkspaceActivityList", {
498
498
  enumerable: true,
499
- get: function () { return chunkIEAZX7L6_cjs.WorkspaceActivityList; }
499
+ get: function () { return chunk5Z22EXHJ_cjs.WorkspaceActivityList; }
500
500
  });
501
501
  Object.defineProperty(exports, "cellText", {
502
502
  enumerable: true,
503
- get: function () { return chunkIEAZX7L6_cjs.cellText; }
503
+ get: function () { return chunk5Z22EXHJ_cjs.cellText; }
504
504
  });
505
505
  Object.defineProperty(exports, "cellValue", {
506
506
  enumerable: true,
507
- get: function () { return chunkIEAZX7L6_cjs.cellValue; }
507
+ get: function () { return chunk5Z22EXHJ_cjs.cellValue; }
508
508
  });
509
509
  Object.defineProperty(exports, "documentCount", {
510
510
  enumerable: true,
511
- get: function () { return chunkIEAZX7L6_cjs.documentCount; }
511
+ get: function () { return chunk5Z22EXHJ_cjs.documentCount; }
512
512
  });
513
513
  Object.defineProperty(exports, "entitiesPhrase", {
514
514
  enumerable: true,
515
- get: function () { return chunkIEAZX7L6_cjs.entitiesPhrase; }
515
+ get: function () { return chunk5Z22EXHJ_cjs.entitiesPhrase; }
516
516
  });
517
517
  Object.defineProperty(exports, "fieldWrites", {
518
518
  enumerable: true,
519
- get: function () { return chunkIEAZX7L6_cjs.fieldWrites; }
519
+ get: function () { return chunk5Z22EXHJ_cjs.fieldWrites; }
520
520
  });
521
521
  Object.defineProperty(exports, "glossaryDocumentXml", {
522
522
  enumerable: true,
523
- get: function () { return chunkIEAZX7L6_cjs.glossaryDocumentXml; }
523
+ get: function () { return chunk5Z22EXHJ_cjs.glossaryDocumentXml; }
524
524
  });
525
525
  Object.defineProperty(exports, "glossaryDocx", {
526
526
  enumerable: true,
527
- get: function () { return chunkIEAZX7L6_cjs.glossaryDocx; }
527
+ get: function () { return chunk5Z22EXHJ_cjs.glossaryDocx; }
528
528
  });
529
529
  Object.defineProperty(exports, "glossaryEntries", {
530
530
  enumerable: true,
531
- get: function () { return chunkIEAZX7L6_cjs.glossaryEntries; }
531
+ get: function () { return chunk5Z22EXHJ_cjs.glossaryEntries; }
532
532
  });
533
533
  Object.defineProperty(exports, "glossaryFileName", {
534
534
  enumerable: true,
535
- get: function () { return chunkIEAZX7L6_cjs.glossaryFileName; }
535
+ get: function () { return chunk5Z22EXHJ_cjs.glossaryFileName; }
536
536
  });
537
537
  Object.defineProperty(exports, "glossaryMarkdown", {
538
538
  enumerable: true,
539
- get: function () { return chunkIEAZX7L6_cjs.glossaryMarkdown; }
539
+ get: function () { return chunk5Z22EXHJ_cjs.glossaryMarkdown; }
540
540
  });
541
541
  Object.defineProperty(exports, "isGap", {
542
542
  enumerable: true,
543
- get: function () { return chunkIEAZX7L6_cjs.isGap; }
543
+ get: function () { return chunk5Z22EXHJ_cjs.isGap; }
544
544
  });
545
545
  Object.defineProperty(exports, "parseCell", {
546
546
  enumerable: true,
547
- get: function () { return chunkIEAZX7L6_cjs.parseCell; }
547
+ get: function () { return chunk5Z22EXHJ_cjs.parseCell; }
548
548
  });
549
549
  Object.defineProperty(exports, "prefetchViewerChunks", {
550
550
  enumerable: true,
551
- get: function () { return chunkIEAZX7L6_cjs.prefetchViewerChunks; }
551
+ get: function () { return chunk5Z22EXHJ_cjs.prefetchViewerChunks; }
552
552
  });
553
553
  Object.defineProperty(exports, "preloadKitChunks", {
554
554
  enumerable: true,
555
- get: function () { return chunkIEAZX7L6_cjs.preloadKitChunks; }
555
+ get: function () { return chunk5Z22EXHJ_cjs.preloadKitChunks; }
556
556
  });
557
557
  Object.defineProperty(exports, "rowLinks", {
558
558
  enumerable: true,
559
- get: function () { return chunkIEAZX7L6_cjs.rowLinks; }
559
+ get: function () { return chunk5Z22EXHJ_cjs.rowLinks; }
560
560
  });
561
561
  Object.defineProperty(exports, "tagDetailLabels", {
562
562
  enumerable: true,
563
- get: function () { return chunkIEAZX7L6_cjs.tagDetailLabels; }
563
+ get: function () { return chunk5Z22EXHJ_cjs.tagDetailLabels; }
564
564
  });
565
565
  Object.defineProperty(exports, "tagKindDescription", {
566
566
  enumerable: true,
567
- get: function () { return chunkIEAZX7L6_cjs.tagKindDescription; }
567
+ get: function () { return chunk5Z22EXHJ_cjs.tagKindDescription; }
568
568
  });
569
569
  Object.defineProperty(exports, "tagNoteLabel", {
570
570
  enumerable: true,
571
- get: function () { return chunkIEAZX7L6_cjs.tagNoteLabel; }
571
+ get: function () { return chunk5Z22EXHJ_cjs.tagNoteLabel; }
572
572
  });
573
573
  Object.defineProperty(exports, "tagTableDocumentXml", {
574
574
  enumerable: true,
575
- get: function () { return chunkIEAZX7L6_cjs.tagTableDocumentXml; }
575
+ get: function () { return chunk5Z22EXHJ_cjs.tagTableDocumentXml; }
576
576
  });
577
577
  Object.defineProperty(exports, "tagTableDocx", {
578
578
  enumerable: true,
579
- get: function () { return chunkIEAZX7L6_cjs.tagTableDocx; }
579
+ get: function () { return chunk5Z22EXHJ_cjs.tagTableDocx; }
580
580
  });
581
581
  Object.defineProperty(exports, "tagTableLabels", {
582
582
  enumerable: true,
583
- get: function () { return chunkIEAZX7L6_cjs.tagTableLabels; }
583
+ get: function () { return chunk5Z22EXHJ_cjs.tagTableLabels; }
584
584
  });
585
585
  Object.defineProperty(exports, "tagTableMarkdown", {
586
586
  enumerable: true,
587
- get: function () { return chunkIEAZX7L6_cjs.tagTableMarkdown; }
587
+ get: function () { return chunk5Z22EXHJ_cjs.tagTableMarkdown; }
588
588
  });
589
589
  Object.defineProperty(exports, "tagsPageNouns", {
590
590
  enumerable: true,
591
- get: function () { return chunkIEAZX7L6_cjs.tagsPageNouns; }
591
+ get: function () { return chunk5Z22EXHJ_cjs.tagsPageNouns; }
592
592
  });
593
593
  Object.defineProperty(exports, "useTipsPlacement", {
594
594
  enumerable: true,
595
- get: function () { return chunkIEAZX7L6_cjs.useTipsPlacement; }
595
+ get: function () { return chunk5Z22EXHJ_cjs.useTipsPlacement; }
596
596
  });
597
597
  Object.defineProperty(exports, "workspaceActivityHeadline", {
598
598
  enumerable: true,
599
- get: function () { return chunkIEAZX7L6_cjs.workspaceActivityHeadline; }
599
+ get: function () { return chunk5Z22EXHJ_cjs.workspaceActivityHeadline; }
600
600
  });
601
601
  Object.defineProperty(exports, "workspaceActivityTarget", {
602
602
  enumerable: true,
603
- get: function () { return chunkIEAZX7L6_cjs.workspaceActivityTarget; }
603
+ get: function () { return chunk5Z22EXHJ_cjs.workspaceActivityTarget; }
604
604
  });
605
605
  Object.defineProperty(exports, "ThemeEditor", {
606
606
  enumerable: true,
@@ -1574,6 +1574,14 @@ Object.defineProperty(exports, "RowNavigatorControls", {
1574
1574
  enumerable: true,
1575
1575
  get: function () { return chunkSK6HQ46Q_cjs.RowNavigatorControls; }
1576
1576
  });
1577
+ Object.defineProperty(exports, "DEFAULT_SHARE_CONTROL_LABELS", {
1578
+ enumerable: true,
1579
+ get: function () { return chunkTG2GM7WJ_cjs.DEFAULT_SHARE_CONTROL_LABELS; }
1580
+ });
1581
+ Object.defineProperty(exports, "ShareControl", {
1582
+ enumerable: true,
1583
+ get: function () { return chunkTG2GM7WJ_cjs.ShareControl; }
1584
+ });
1577
1585
  Object.defineProperty(exports, "DEFAULT_PASSAGE_PILL_LABELS", {
1578
1586
  enumerable: true,
1579
1587
  get: function () { return chunkMNIQDXM6_cjs.DEFAULT_PASSAGE_PILL_LABELS; }
@@ -1606,14 +1614,6 @@ Object.defineProperty(exports, "useCopyText", {
1606
1614
  enumerable: true,
1607
1615
  get: function () { return chunkT6WA6S5T_cjs.useCopyText; }
1608
1616
  });
1609
- Object.defineProperty(exports, "DEFAULT_SHARE_CONTROL_LABELS", {
1610
- enumerable: true,
1611
- get: function () { return chunkTG2GM7WJ_cjs.DEFAULT_SHARE_CONTROL_LABELS; }
1612
- });
1613
- Object.defineProperty(exports, "ShareControl", {
1614
- enumerable: true,
1615
- get: function () { return chunkTG2GM7WJ_cjs.ShareControl; }
1616
- });
1617
1617
  Object.defineProperty(exports, "docxEditorChunk", {
1618
1618
  enumerable: true,
1619
1619
  get: function () { return chunkL62EU3TQ_cjs.docxEditorChunk; }
@@ -35,16 +35,17 @@ function codeSplitting() {
35
35
  groups: [
36
36
  { name: "preload-helper", test: /vite\/preload-helper/, priority: 100 },
37
37
  { name: vendorChunkOf },
38
- // Vite's build-import lexer has a fixed WASM heap: the combined Word editor
39
- // can exceed it. Bound its chunks without pulling lazy editor code into an
40
- // eager vendor group or capturing its shared React/runtime dependencies.
41
- {
42
- name: "docx-editor",
43
- test: /node_modules\/@docx-editor\.dev\//,
44
- entriesAware: true,
45
- includeDependenciesRecursively: false,
46
- maxSize: 2e6
47
- }
38
+ // Vite's build-import lexer has a fixed WASM heap: the whole Word editor in one chunk
39
+ // exceeds it. Split it along package boundaries only (core, react, i18n), which depend on
40
+ // each other one way. A size-bounded split (`maxSize`) cuts through the cyclic modules of
41
+ // one package and yields chunks that import each other, so the editor broke with
42
+ // "X is not iterable" depending on which chunk loaded first. `scripts/check-chunk-cycles.mjs`
43
+ // guards the built output. Shared React/runtime dependencies stay out of the group.
44
+ ...["core", "react", "i18n"].map((pkg) => ({
45
+ name: `docx-editor-${pkg}`,
46
+ test: new RegExp(`node_modules/@docx-editor\\.dev/${pkg}/`),
47
+ includeDependenciesRecursively: false
48
+ }))
48
49
  ]
49
50
  };
50
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"names":["readdir","path","promisify","brotliCompress","gzip","readFile","constants","writeFile","require","createRequire","createReadStream"],"mappings":";;;;;;;;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IAC1C,EAAA,CAAG,SAAS,mCAAmC,CAAA;AAE/C,IAAA,OAAO,eAAA;AACT,EAAA,IAAI,GAAG,QAAA,CAAS,4BAA4B,CAAA,IAAK,EAAA,CAAG,SAAS,gCAAgC,CAAA;AAC3F,IAAA,OAAO,SAAA;AAET,EAAA,IACE,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IACzC,EAAA,CAAG,SAAS,sBAAsB,CAAA,IAAK,CAAC,EAAA,CAAG,QAAA,CAAS,4BAA4B,KAChF,EAAA,CAAG,QAAA,CAAS,sBAAsB,CAAA,IAAK,CAAC,EAAA,CAAG,SAAS,2BAA2B,CAAA,IAChF,EAAA,CAAG,QAAA,CAAS,qBAAqB,CAAA;AAEjC,IAAA,OAAO,UAAA;AACT,EAAA,IACE,EAAA,CAAG,QAAA,CAAS,uBAAuB,CAAA,IACnC,GAAG,QAAA,CAAS,qBAAqB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AQO,SAAS,iBAAA,GAA4B;AAC1C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,EAAO,OAAA;AAAA,IACP,gBAAgB,MAAA,EAAQ;AACtB,MAAA,IAAI,IAAA;AACJ,MAAA,IAAI;AACF,QAAA,MAAMC,QAAAA,GAAUC,uBAAcR,qBAAA,CAAK,IAAA,CAAK,OAAO,MAAA,CAAO,IAAA,EAAM,cAAc,CAAC,CAAA;AAC3E,QAAA,IAAA,GAAOA,qBAAA,CAAK,KAAKA,qBAAA,CAAK,OAAA,CAAQO,SAAQ,OAAA,CAAQ,uBAAuB,CAAC,CAAA,EAAG,eAAe,CAAA;AAAA,MAC1F,CAAA,CAAA,MAAQ;AACN,QAAA;AAAA,MACF;AACA,MAAA,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,CAAC,GAAA,EAAK,KAAK,IAAA,KAAS;AACzC,QAAA,IAAI,CAAC,GAAA,CAAI,GAAA,EAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,QAAA,CAAS,2BAA2B,CAAA,EAAG,OAAO,IAAA,EAAK;AAC/E,QAAA,GAAA,CAAI,SAAA,CAAU,gBAAgB,kBAAkB,CAAA;AAChD,QAAAE,mBAAA,CAAiB,IAAI,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.cjs","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the combined Word editor\n // can exceed it. Bound its chunks without pulling lazy editor code into an\n // eager vendor group or capturing its shared React/runtime dependencies.\n {\n name: 'docx-editor',\n test: /node_modules\\/@docx-editor\\.dev\\//,\n entriesAware: true,\n includeDependenciesRecursively: false,\n maxSize: 2_000_000,\n },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"names":["readdir","path","promisify","brotliCompress","gzip","readFile","constants","writeFile","require","createRequire","createReadStream"],"mappings":";;;;;;;;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,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WAAA,CAAY,GAAA,CAAI,CAAC,GAAA,EAAK,KAAK,IAAA,KAAS;AACzC,QAAA,IAAI,CAAC,GAAA,CAAI,GAAA,EAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,QAAA,CAAS,2BAA2B,CAAA,EAAG,OAAO,IAAA,EAAK;AAC/E,QAAA,GAAA,CAAI,SAAA,CAAU,gBAAgB,kBAAkB,CAAA;AAChD,QAAAE,mBAAA,CAAiB,IAAI,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.cjs","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the whole Word editor in one chunk\n // exceeds it. Split it along package boundaries only (core, react, i18n), which depend on\n // each other one way. A size-bounded split (`maxSize`) cuts through the cyclic modules of\n // one package and yields chunks that import each other, so the editor broke with\n // \"X is not iterable\" depending on which chunk loaded first. `scripts/check-chunk-cycles.mjs`\n // guards the built output. Shared React/runtime dependencies stay out of the group.\n ...['core', 'react', 'i18n'].map((pkg) => ({\n name: `docx-editor-${pkg}`,\n test: new RegExp(`node_modules/@docx-editor\\\\.dev/${pkg}/`),\n includeDependenciesRecursively: false,\n })),\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
@@ -11,26 +11,17 @@ export declare function vendorChunkOf(id: string): string | null;
11
11
  */
12
12
  export declare function codeSplitting(): {
13
13
  groups: ({
14
+ name: string;
15
+ test: RegExp;
16
+ includeDependenciesRecursively: boolean;
17
+ } | {
14
18
  name: string;
15
19
  test: RegExp;
16
20
  priority: number;
17
- entriesAware?: undefined;
18
- includeDependenciesRecursively?: undefined;
19
- maxSize?: undefined;
20
21
  } | {
21
22
  name: typeof vendorChunkOf;
22
23
  test?: undefined;
23
24
  priority?: undefined;
24
- entriesAware?: undefined;
25
- includeDependenciesRecursively?: undefined;
26
- maxSize?: undefined;
27
- } | {
28
- name: string;
29
- test: RegExp;
30
- entriesAware: boolean;
31
- includeDependenciesRecursively: boolean;
32
- maxSize: number;
33
- priority?: undefined;
34
25
  })[];
35
26
  };
36
27
  /** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */
@@ -29,16 +29,17 @@ function codeSplitting() {
29
29
  groups: [
30
30
  { name: "preload-helper", test: /vite\/preload-helper/, priority: 100 },
31
31
  { name: vendorChunkOf },
32
- // Vite's build-import lexer has a fixed WASM heap: the combined Word editor
33
- // can exceed it. Bound its chunks without pulling lazy editor code into an
34
- // eager vendor group or capturing its shared React/runtime dependencies.
35
- {
36
- name: "docx-editor",
37
- test: /node_modules\/@docx-editor\.dev\//,
38
- entriesAware: true,
39
- includeDependenciesRecursively: false,
40
- maxSize: 2e6
41
- }
32
+ // Vite's build-import lexer has a fixed WASM heap: the whole Word editor in one chunk
33
+ // exceeds it. Split it along package boundaries only (core, react, i18n), which depend on
34
+ // each other one way. A size-bounded split (`maxSize`) cuts through the cyclic modules of
35
+ // one package and yields chunks that import each other, so the editor broke with
36
+ // "X is not iterable" depending on which chunk loaded first. `scripts/check-chunk-cycles.mjs`
37
+ // guards the built output. Shared React/runtime dependencies stay out of the group.
38
+ ...["core", "react", "i18n"].map((pkg) => ({
39
+ name: `docx-editor-${pkg}`,
40
+ test: new RegExp(`node_modules/@docx-editor\\.dev/${pkg}/`),
41
+ includeDependenciesRecursively: false
42
+ }))
42
43
  ]
43
44
  };
44
45
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"names":["require"],"mappings":";;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAAyB,CAAA;AAC7E,IAAA,OAAO,YAAA;AACT,EAAA,IACE,GAAG,QAAA,CAAS,yBAAyB,KACrC,EAAA,CAAG,QAAA,CAAS,wCAAwC,CAAA,IACpD,EAAA,CAAG,QAAA,CAAS,oBAAoB,KAChC,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IAC1C,EAAA,CAAG,SAAS,mCAAmC,CAAA;AAE/C,IAAA,OAAO,eAAA;AACT,EAAA,IAAI,GAAG,QAAA,CAAS,4BAA4B,CAAA,IAAK,EAAA,CAAG,SAAS,gCAAgC,CAAA;AAC3F,IAAA,OAAO,SAAA;AAET,EAAA,IACE,EAAA,CAAG,QAAA,CAAS,8BAA8B,CAAA,IACzC,EAAA,CAAG,SAAS,sBAAsB,CAAA,IAAK,CAAC,EAAA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AAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.js","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the combined Word editor\n // can exceed it. Bound its chunks without pulling lazy editor code into an\n // eager vendor group or capturing its shared React/runtime dependencies.\n {\n name: 'docx-editor',\n test: /node_modules\\/@docx-editor\\.dev\\//,\n entriesAware: true,\n includeDependenciesRecursively: false,\n maxSize: 2_000_000,\n },\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"names":["require"],"mappings":";;;;;;;;AAyBO,SAAS,cAAc,EAAA,EAA2B;AACvD,EAAA,IAAI,GAAG,QAAA,CAAS,qBAAqB,CAAA,IAAK,EAAA,CAAG,SAAS,yBAA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AAA,CAAQA,SAAQ,OAAA,CAAQ,uBAAuB,CAAC,CAAA,EAAG,eAAe,CAAA;AAAA,MAC1F,CAAA,CAAA,MAAQ;AACN,QAAA;AAAA,MACF;AACA,MAAA,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,CAAC,GAAA,EAAK,KAAK,IAAA,KAAS;AACzC,QAAA,IAAI,CAAC,GAAA,CAAI,GAAA,EAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,QAAA,CAAS,2BAA2B,CAAA,EAAG,OAAO,IAAA,EAAK;AAC/E,QAAA,GAAA,CAAI,SAAA,CAAU,gBAAgB,kBAAkB,CAAA;AAChD,QAAA,gBAAA,CAAiB,IAAI,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,aAAa,QAAA,GAAW;AAC1B,CAAA,GAA4B,EAAC,EAAa;AACxC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAkB;AAAA,IAClB,GAAI,QAAA,GAAW,CAAC,WAAA,CAAY,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAC,CAAA,GAAI;AAAC,GAChF;AACF","file":"index.js","sourcesContent":["/**\n * `@arbidocs/blocks/vite`: the build settings every site built from the kits shares. Node only: a\n * site's `vite.config` imports it, never its browser code.\n *\n * In a site's `vite.config`: `plugins: [react(), ...arbiVitePlugins()]`, and the vendor groups as\n * `build.rolldownOptions.output.codeSplitting = codeSplitting()` (Vite 8) or\n * `build.rollupOptions.output.manualChunks = manualChunks` (Vite 6/7).\n *\n * The heavy kit parts (the Word editor, the PDF engine, the data grid, the calendar) are loaded on\n * demand by the kits themselves. Eager vendor groups leave them out: mixing shared helpers into\n * a lazy library chunk would make sign-in download the whole library. The Word editor has its\n * own size-bounded, entry-aware group that does not capture its shared dependencies.\n */\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { brotliCompress, constants, gzip } from 'node:zlib'\nimport type { Plugin } from 'vite'\n\n/**\n * The vendor chunk a module belongs to, or null (left to the bundler): libraries every page loads\n * and that rarely change, so they stay cached across a site's deploys.\n */\nexport function vendorChunkOf(id: string): string | null {\n if (id.includes('node_modules/react/') || id.includes('node_modules/react-dom/'))\n return 'react-core'\n if (\n id.includes('node_modules/@radix-ui/') ||\n id.includes('node_modules/class-variance-authority/') ||\n id.includes('node_modules/clsx/') ||\n id.includes('node_modules/tailwind-merge/') ||\n id.includes('node_modules/tailwindcss-animate/')\n )\n return 'ui-components'\n if (id.includes('node_modules/react-router/') || id.includes('node_modules/react-router-dom/'))\n return 'routing'\n // KaTeX (rehype-katex / remark-math) is loaded on demand when content has math: left out.\n if (\n id.includes('node_modules/react-markdown/') ||\n (id.includes('node_modules/rehype-') && !id.includes('node_modules/rehype-katex/')) ||\n (id.includes('node_modules/remark-') && !id.includes('node_modules/remark-math/')) ||\n id.includes('node_modules/shiki/')\n )\n return 'markdown'\n if (\n id.includes('node_modules/zustand/') ||\n id.includes('node_modules/immer/') ||\n id.includes('node_modules/remeda/') ||\n id.includes('node_modules/@tanstack/react-query/')\n )\n return 'state-utils'\n if (id.includes('node_modules/framer-motion/') || id.includes('node_modules/sonner/'))\n return 'animation'\n if (\n id.includes('node_modules/@auth0/') ||\n id.includes('node_modules/axios/') ||\n id.includes('node_modules/js-cookie/')\n )\n return 'auth-api'\n // The end-to-end encryption library: needed at sign-in, large, and it never changes.\n if (id.includes('node_modules/libsodium')) return 'sodium'\n return null\n}\n\n/**\n * Rolldown's (Vite 8) `build.rolldownOptions.output.codeSplitting`. Vite's dynamic-import preload\n * helper gets its own chunk: left unpinned, the bundler parks it in a chunk that also imports\n * lazily, and the entry then preloads that whole chunk before the page renders.\n */\nexport function codeSplitting() {\n return {\n groups: [\n { name: 'preload-helper', test: /vite\\/preload-helper/, priority: 100 },\n { name: vendorChunkOf },\n // Vite's build-import lexer has a fixed WASM heap: the whole Word editor in one chunk\n // exceeds it. Split it along package boundaries only (core, react, i18n), which depend on\n // each other one way. A size-bounded split (`maxSize`) cuts through the cyclic modules of\n // one package and yields chunks that import each other, so the editor broke with\n // \"X is not iterable\" depending on which chunk loaded first. `scripts/check-chunk-cycles.mjs`\n // guards the built output. Shared React/runtime dependencies stay out of the group.\n ...['core', 'react', 'i18n'].map((pkg) => ({\n name: `docx-editor-${pkg}`,\n test: new RegExp(`node_modules/@docx-editor\\\\.dev/${pkg}/`),\n includeDependenciesRecursively: false,\n })),\n ],\n }\n}\n\n/** Rollup's (Vite 6/7) `build.rollupOptions.output.manualChunks`, with the same vendor groups. */\nexport function manualChunks(id: string): string | undefined {\n return vendorChunkOf(id) ?? undefined\n}\n\nconst COMPRESSIBLE = /\\.(?:m?js|css|html|json|svg|wasm|txt|xml|webmanifest|ttf|otf)$/\n\n/**\n * Files a deployment rewrites after `vite build` (a compressed copy would serve the stale bytes):\n * the service worker (stamped with the build), the runtime config and web manifests (rendered when\n * the container starts), and `index.html` (tiny, and never cached).\n */\nexport const PRECOMPRESS_EXCLUDE: readonly string[] = [\n 'sw.js',\n 'config.json',\n '*.webmanifest',\n 'asset-manifest.json',\n 'index.html',\n]\n\nexport interface PrecompressOptions {\n /** Smallest file compressed, in bytes. Default 1024. */\n minSize?: number\n /**\n * File names (or `*` patterns, matched against the file name) never compressed: anything the\n * deployment changes after the build. Default `PRECOMPRESS_EXCLUDE`; pass your own list to\n * replace it (`[...PRECOMPRESS_EXCLUDE, 'extra.json']` to extend it).\n */\n exclude?: readonly string[]\n}\n\nasync function filesUnder(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true, recursive: true })\n return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name))\n}\n\nconst toPattern = (glob: string) =>\n new RegExp(`^${glob.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\*/g, '.*')}$`)\n\n/** Runs `task` over `items`, `limit` at a time. */\nasync function eachLimited<T>(\n items: readonly T[],\n limit: number,\n task: (item: T) => Promise<void>\n) {\n let next = 0\n const worker = async () => {\n while (next < items.length) await task(items[next++])\n }\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))\n}\n\n/**\n * Writes `<file>.br` (brotli, quality 11) and `<file>.gz` (gzip, level 9) beside every compressible\n * file of the build, including those copied from `public/`, so the web server sends them as they\n * are (nginx `gzip_static` / `brotli_static`): the smallest transfer, at no cost per request. Files\n * the deployment rewrites later are left out (`exclude`).\n */\nexport function precompress({\n minSize = 1024,\n exclude = PRECOMPRESS_EXCLUDE,\n}: PrecompressOptions = {}): Plugin {\n const br = promisify(brotliCompress)\n const gz = promisify(gzip)\n const excluded = exclude.map(toPattern)\n let outDir = ''\n return {\n name: 'arbi-precompress',\n apply: 'build',\n enforce: 'post',\n configResolved(config) {\n outDir = path.resolve(config.root, config.build.outDir)\n },\n async closeBundle() {\n const files = (await filesUnder(outDir)).filter(\n (f) => COMPRESSIBLE.test(f) && !excluded.some((p) => p.test(path.basename(f)))\n )\n // Brotli at quality 11 is CPU-heavy: a few files at a time.\n await eachLimited(files, 6, async (file) => {\n const data = await readFile(file)\n if (data.length < minSize) return\n const [brotli, gzipped] = await Promise.all([\n br(data, {\n params: {\n [constants.BROTLI_PARAM_QUALITY]: 11,\n [constants.BROTLI_PARAM_SIZE_HINT]: data.length,\n },\n }),\n gz(data, { level: 9 }),\n ])\n await Promise.all([writeFile(`${file}.br`, brotli), writeFile(`${file}.gz`, gzipped)])\n })\n },\n }\n}\n\n/**\n * The Word editor's text shaping loads `harfbuzz.wasm` with `new URL('harfbuzz.wasm',\n * import.meta.url)`. A build emits that asset, but the dev server's pre-bundle moves the editor into\n * `.vite/deps`, where the URL has no file and the SPA fallback answers with HTML (\"HarfBuzz shaping\n * failed\"). Serves the installed package's binary at that address. Dev server only.\n */\nexport function serveHarfBuzzWasm(): Plugin {\n return {\n name: 'arbi-harfbuzz-wasm',\n apply: 'serve',\n configureServer(server) {\n let wasm: string\n try {\n const require = createRequire(path.join(server.config.root, 'package.json'))\n wasm = path.join(path.dirname(require.resolve('@docx-editor.dev/core')), 'harfbuzz.wasm')\n } catch {\n return // The site does not use the Word editor.\n }\n server.middlewares.use((req, res, next) => {\n if (!req.url?.split('?')[0].endsWith('/.vite/deps/harfbuzz.wasm')) return next()\n res.setHeader('Content-Type', 'application/wasm')\n createReadStream(wasm).pipe(res)\n })\n },\n }\n}\n\nexport interface ArbiVitePluginsOptions {\n /** Precompress the build (`.br` and `.gz`). Default on. */\n precompress?: boolean | PrecompressOptions\n}\n\n/** The plugins every kit-built site uses: precompression and the Word editor's wasm in dev. */\nexport function arbiVitePlugins({\n precompress: compress = true,\n}: ArbiVitePluginsOptions = {}): Plugin[] {\n return [\n serveHarfBuzzWasm(),\n ...(compress ? [precompress(typeof compress === 'object' ? compress : {})] : []),\n ]\n}\n"]}
@@ -1,18 +1,18 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkMMKMQZ2B_cjs = require('../chunk-MMKMQZ2B.cjs');
4
+ var chunkCESE7GLT_cjs = require('../chunk-CESE7GLT.cjs');
5
5
  require('../chunk-32W2S6DE.cjs');
6
6
  require('../chunk-KWJW5TMH.cjs');
7
- require('../chunk-5GHGIDZP.cjs');
8
- require('../chunk-VPKKPHJY.cjs');
7
+ require('../chunk-ORQXGMCC.cjs');
8
+ require('../chunk-33GOYI3O.cjs');
9
9
  var chunk6CGMSJLB_cjs = require('../chunk-6CGMSJLB.cjs');
10
10
  require('../chunk-AEQT2QQX.cjs');
11
- var chunkLLD4PNBW_cjs = require('../chunk-LLD4PNBW.cjs');
12
- require('../chunk-VIUEPJ3Y.cjs');
11
+ var chunkUD56Y6UA_cjs = require('../chunk-UD56Y6UA.cjs');
12
+ require('../chunk-KP7BQIZL.cjs');
13
13
  require('../chunk-C5APAFUY.cjs');
14
14
  require('../chunk-HYUKPHCT.cjs');
15
- require('../chunk-FYFL3CET.cjs');
15
+ require('../chunk-ZPIZINH2.cjs');
16
16
  require('../chunk-223D4727.cjs');
17
17
  require('../chunk-SNUBQMIS.cjs');
18
18
  var chunkFABKMTAI_cjs = require('../chunk-FABKMTAI.cjs');
@@ -3106,7 +3106,7 @@ function ConnectedWorkflowsPage({
3106
3106
  const config = host.workflows;
3107
3107
  const { openConversation, openFiles } = chunkLIKDQBNJ_cjs.useBlocksEnvironment();
3108
3108
  const openWorkflow = chunkOA3AN6WW_cjs.useOpenWorkflow();
3109
- const renderPerson = chunkMMKMQZ2B_cjs.useRenderTaskPerson();
3109
+ const renderPerson = chunkCESE7GLT_cjs.useRenderTaskPerson();
3110
3110
  const refreshDocuments = react$2.useRefreshDocuments();
3111
3111
  const invalidateTags = react$2.useInvalidateTagData();
3112
3112
  const { data: tags = [] } = react$2.useTags();
@@ -3137,7 +3137,7 @@ function ConnectedWorkflowsPage({
3137
3137
  openHistory,
3138
3138
  closeHistoryTab,
3139
3139
  selectHistoryTab
3140
- } = chunkMMKMQZ2B_cjs.useWorkflowsPageState({
3140
+ } = chunkCESE7GLT_cjs.useWorkflowsPageState({
3141
3141
  historyWorkflowId: requestedHistoryId ?? historyWorkflowId,
3142
3142
  onHistoryWorkflowConsumed: consumeHistory
3143
3143
  });
@@ -3186,14 +3186,14 @@ function ConnectedWorkflowsPage({
3186
3186
  await refreshDocuments(execution.document_ext_ids);
3187
3187
  await invalidateTags();
3188
3188
  const fieldIds = execution.result?.tag_ext_ids ?? runsFor?.action?.tag_ext_ids ?? [];
3189
- chunkLLD4PNBW_cjs.useAiReviewStore.getState().setRun({
3189
+ chunkUD56Y6UA_cjs.useAiReviewStore.getState().setRun({
3190
3190
  docIds: execution.document_ext_ids,
3191
3191
  tags: fieldIds.map((fieldId) => ({
3192
3192
  id: fieldId,
3193
3193
  name: tags.find((tag) => tag.external_id === fieldId)?.name ?? "Review"
3194
3194
  }))
3195
3195
  });
3196
- chunkLLD4PNBW_cjs.useAiReviewStore.getState().setOpen(true);
3196
+ chunkUD56Y6UA_cjs.useAiReviewStore.getState().setOpen(true);
3197
3197
  openFiles(
3198
3198
  execution.label_ext_id ? { filters: { [execution.label_ext_id]: "include" } } : void 0
3199
3199
  );
@@ -3205,7 +3205,7 @@ function ConnectedWorkflowsPage({
3205
3205
  return (
3206
3206
  // The page in the Workflows page's frame: padded, scrolling.
3207
3207
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full min-h-0 w-full overflow-auto p-4 sm:p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
3208
- chunkMMKMQZ2B_cjs.ConnectedWorkflowRunPage,
3208
+ chunkCESE7GLT_cjs.ConnectedWorkflowRunPage,
3209
3209
  {
3210
3210
  workflow: running.workflow,
3211
3211
  projectFrom: running.projectFrom,
@@ -3323,7 +3323,7 @@ function ConnectedWorkflowsPage({
3323
3323
  }
3324
3324
  },
3325
3325
  content: hostTab ? hostTab.content : runsFor ? /* @__PURE__ */ jsxRuntime.jsx(
3326
- chunkMMKMQZ2B_cjs.ConnectedWorkflowHistory,
3326
+ chunkCESE7GLT_cjs.ConnectedWorkflowHistory,
3327
3327
  {
3328
3328
  inline: true,
3329
3329
  hideHeader: true,
@@ -3387,7 +3387,7 @@ function ConnectedWorkflowsPage({
3387
3387
  }
3388
3388
  ),
3389
3389
  /* @__PURE__ */ jsxRuntime.jsx(
3390
- chunkMMKMQZ2B_cjs.ConnectedTaskComposer,
3390
+ chunkCESE7GLT_cjs.ConnectedTaskComposer,
3391
3391
  {
3392
3392
  kind: "workflow",
3393
3393
  saveOnly: true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/coedit",
3
- "version": "0.5.138",
3
+ "version": "0.5.140",
4
4
  "description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
5
5
  "type": "module",
6
6
  "sideEffects": false,