@@ -395,85 +395,155 @@ describe('@apostrophecms/vite', function () {
395395 assert . match ( adminBarComponentContent , / < h 1 > T h e A p o s A d m i n B a r < \/ h 1 > / ) ;
396396
397397 // II. Core Entrypoints
398- // 1. src.js
399- {
400- const match = srcContent . match ( / " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ u i \/ s r c \/ i n d e x .j s " ; / g) ;
401- assert . equal ( match ?. length , 1 , 'The core admin-bar module should be imported once' ) ;
402- }
403- // 2. apos.js
404- {
405- const match = aposContent . match (
406- / i m p o r t T h e A p o s A d m i n B a r f r o m " [ ^ " ] + \/ a d m i n - b a r - c o m p o n e n t \/ u i \/ a p o s \/ c o m p o n e n t s \/ T h e A p o s A d m i n B a r \. v u e " ; / g
398+ if ( process . platform === 'win32' ) {
399+ // 1. src.js
400+ {
401+ const match = srcContent . match ( / " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ u i \/ s r c \/ i n d e x .j s " ; / g) ;
402+ assert . equal ( match ?. length , 1 , 'The core admin-bar module should be imported once' ) ;
403+ }
404+ // 2. apos.js
405+ {
406+ const match = aposContent . match (
407+ / i m p o r t T h e A p o s A d m i n B a r f r o m " [ ^ " ] + \/ a d m i n - b a r - c o m p o n e n t \/ a p o s \/ c o m p o n e n t s \/ T h e A p o s A d m i n B a r \. v u e " ; / g
408+ ) ;
409+ assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component override should be imported once' ) ;
410+ }
411+ {
412+ const match = aposContent . match (
413+ / w i n d o w \. a p o s \. v u e C o m p o n e n t s \[ " T h e A p o s A d m i n B a r " \] = T h e A p o s A d m i n B a r ; / g
414+ ) ;
415+ assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component should be registered once' ) ;
416+ }
417+ {
418+ const match = aposContent . match (
419+ / i m p o r t A p o s A d m i n B a r _ [ \w \d ] + f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ u i \/ a p o s \/ a p p s \/ A p o s A d m i n B a r \. j s " ; / g
420+ ) ;
421+ assert . equal ( match ?. length , 1 , 'AposAdminBar.js App import should be present once' ) ;
422+ }
423+ {
424+ const match = aposContent . match (
425+ / A p o s A d m i n B a r _ [ \d ] + A p p \( \) ; / g
426+ ) ;
427+ assert . equal ( match ?. length , 1 , 'AposAdminBar.js App should be called once' ) ;
428+ }
429+ assert . match (
430+ aposContent ,
431+ / i m p o r t A p o s C o m m a n d M e n u K e y f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ c o m m a n d - m e n u \/ u i \/ a p o s \/ c o m p o n e n t s \/ A p o s C o m m a n d M e n u K e y \. v u e " ; /
407432 ) ;
408- assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component override should be imported once' ) ;
409- }
410- {
411- const match = aposContent . match (
412- / w i n d o w \. a p o s \. v u e C o m p o n e n t s \[ " T h e A p o s A d m i n B a r " \] = T h e A p o s A d m i n B a r ; / g
433+ assert . match (
434+ aposContent ,
435+ / i m p o r t L i n k f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ r i c h - t e x t - w i d g e t \/ u i \/ a p o s \/ t i p t a p - e x t e n s i o n s \/ L i n k \. j s " ; /
413436 ) ;
414- assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component should be registered once' ) ;
415- }
416- {
417- const match = aposContent . match (
418- / i m p o r t A p o s A d m i n B a r _ [ \w \d ] + f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ u i \/ a p o s \/ a p p s \/ A p o s A d m i n B a r \. j s " ; / g
437+ } else {
438+ {
439+ const match = srcContent . match ( / " .\/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ s r c \/ i n d e x .j s " ; / g) ;
440+ assert . equal ( match ?. length , 1 , 'The core admin-bar module should be imported once' ) ;
441+ }
442+ {
443+ const match = aposContent . match (
444+ / i m p o r t T h e A p o s A d m i n B a r f r o m " .\/ a d m i n - b a r - c o m p o n e n t \/ a p o s \/ c o m p o n e n t s \/ T h e A p o s A d m i n B a r \. v u e " ; / g
445+ ) ;
446+ assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component override should be imported once' ) ;
447+ }
448+ {
449+ const match = aposContent . match (
450+ / w i n d o w \. a p o s \. v u e C o m p o n e n t s \[ " T h e A p o s A d m i n B a r " \] = T h e A p o s A d m i n B a r ; / g
451+ ) ;
452+ assert . equal ( match ?. length , 1 , 'TheAposAdminBar.vue component should be registered once' ) ;
453+ }
454+ {
455+ const match = aposContent . match (
456+ / i m p o r t A p o s A d m i n B a r _ [ \w \d ] + f r o m " .\/ @ a p o s t r o p h e c m s \/ a d m i n - b a r \/ a p o s \/ a p p s \/ A p o s A d m i n B a r \. j s " ; / g
457+ ) ;
458+ assert . equal ( match ?. length , 1 , 'AposAdminBar.js App import should be present once' ) ;
459+ }
460+ {
461+ const match = aposContent . match (
462+ / A p o s A d m i n B a r _ [ \d ] + A p p \( \) ; / g
463+ ) ;
464+ assert . equal ( match ?. length , 1 , 'AposAdminBar.js App should be called once' ) ;
465+ }
466+ assert . match (
467+ aposContent ,
468+ / i m p o r t A p o s C o m m a n d M e n u K e y f r o m " .\/ @ a p o s t r o p h e c m s \/ c o m m a n d - m e n u \/ a p o s \/ c o m p o n e n t s \/ A p o s C o m m a n d M e n u K e y \. v u e " ; /
419469 ) ;
420- assert . equal ( match ?. length , 1 , 'AposAdminBar.js App import should be present once' ) ;
421- }
422- {
423- const match = aposContent . match (
424- / A p o s A d m i n B a r _ [ \d ] + A p p \( \) ; / g
470+ assert . match (
471+ aposContent ,
472+ / i m p o r t L i n k f r o m " .\/ @ a p o s t r o p h e c m s \/ r i c h - t e x t - w i d g e t \/ a p o s \/ t i p t a p - e x t e n s i o n s \/ L i n k \. j s " ; /
425473 ) ;
426- assert . equal ( match ?. length , 1 , 'AposAdminBar.js App should be called once' ) ;
427474 }
428- assert . match (
429- aposContent ,
430- / i m p o r t A p o s C o m m a n d M e n u K e y f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ c o m m a n d - m e n u \/ u i \/ a p o s \/ c o m p o n e n t s \/ A p o s C o m m a n d M e n u K e y \. v u e " ; /
431- ) ;
432- assert . match (
433- aposContent ,
434- / i m p o r t L i n k f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ r i c h - t e x t - w i d g e t \/ u i \/ a p o s \/ t i p t a p - e x t e n s i o n s \/ L i n k \. j s " ; /
435- ) ;
436-
437475 // III. Extra Build Entrypoints & Rebundle Modules
438476 const articleEntryContent = await fs . readFile (
439477 path . join ( rootDirSrc , 'article.js' ) ,
440478 'utf8'
441479 ) ;
442480
443- assert ( articleEntryContent . includes ( 'article-page/ui/src/main.scss' ) ) ;
444- assert ( articleEntryContent . includes ( 'article-page/ui/src/index.js' ) ) ;
445- assert ( articleEntryContent . includes ( 'article-page/ui/src/main.js' ) ) ;
446-
447- const toolsEntryContent = await fs . readFile (
448- path . join ( rootDirSrc , 'tools.js' ) ,
449- 'utf8'
450- ) ;
451-
452- assert ( toolsEntryContent . includes ( 'selected-article-widget/ui/src/tabs.js' ) ) ;
453-
454- {
455- const match = srcContent . match (
456- / i m p o r t t o p i c _ \d + A p p f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ u i \/ s r c \/ t o p i c \. j s " ; / g
457- ) ;
458- assert . equal ( match ?. length , 1 , 'home-page topic.js should be imported once' ) ;
459- }
460- {
461- const match = srcContent . match (
462- / i m p o r t m a i n _ \d + A p p f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ u i \/ s r c \/ m a i n \. j s " ; / g
463- ) ;
464- assert . equal ( match ?. length , 1 , 'home-page main.js should be imported once' ) ;
465- }
466- {
467- const match = srcContent . match (
468- / i m p o r t t o p i c _ \d + A p p f r o m " [ ^ " ] + \/ a r t i c l e - w i d g e t \/ u i \/ s r c \/ t o p i c \. j s " ; / g
481+ if ( process . platform === 'win32' ) {
482+ assert ( articleEntryContent . includes ( 'article-page/ui/src/main.scss' ) ) ;
483+ assert ( articleEntryContent . includes ( 'article-page/ui/src/index.js' ) ) ;
484+ assert ( articleEntryContent . includes ( 'article-page/ui/src/main.js' ) ) ;
485+ const toolsEntryContent = await fs . readFile (
486+ path . join ( rootDirSrc , 'tools.js' ) ,
487+ 'utf8'
469488 ) ;
470- assert . equal ( match ?. length , 1 , 'article-widget topic.js should be imported once' ) ;
471- }
472- {
473- const match = srcContent . match (
474- / i m p o r t c a r o u s e l _ \d + A p p f r o m " [ ^ " ] + \/ a r t i c l e - w i d g e t \/ u i \/ s r c \/ c a r o u s e l \. j s " ; / g
489+ assert ( toolsEntryContent . includes ( 'selected-article-widget/ui/src/tabs.js' ) ) ;
490+ {
491+ const match = srcContent . match (
492+ / i m p o r t t o p i c _ \d + A p p f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ u i \/ s r c \/ t o p i c \. j s " ; / g
493+ ) ;
494+ assert . equal ( match ?. length , 1 , 'home-page topic.js should be imported once' ) ;
495+ }
496+ {
497+ const match = srcContent . match (
498+ / i m p o r t m a i n _ \d + A p p f r o m " [ ^ " ] + \/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ u i \/ s r c \/ m a i n \. j s " ; / g
499+ ) ;
500+ assert . equal ( match ?. length , 1 , 'home-page main.js should be imported once' ) ;
501+ }
502+ {
503+ const match = srcContent . match (
504+ / i m p o r t t o p i c _ \d + A p p f r o m " [ ^ " ] + \/ a r t i c l e - w i d g e t \/ u i \/ s r c \/ t o p i c \. j s " ; / g
505+ ) ;
506+ assert . equal ( match ?. length , 1 , 'article-widget topic.js should be imported once' ) ;
507+ }
508+ {
509+ const match = srcContent . match (
510+ / i m p o r t c a r o u s e l _ \d + A p p f r o m " [ ^ " ] + \/ a r t i c l e - w i d g e t \/ u i \/ s r c \/ c a r o u s e l \. j s " ; / g
511+ ) ;
512+ assert . equal ( match ?. length , 1 , 'article-widget carousel.js should be imported once' ) ;
513+ }
514+ } else {
515+ assert ( articleEntryContent . includes ( 'article-page/src/main.scss' ) ) ;
516+ assert ( articleEntryContent . includes ( 'article-page/src/index.js' ) ) ;
517+ assert ( articleEntryContent . includes ( 'article-page/src/main.js' ) ) ;
518+ const toolsEntryContent = await fs . readFile (
519+ path . join ( rootDirSrc , 'tools.js' ) ,
520+ 'utf8'
475521 ) ;
476- assert . equal ( match ?. length , 1 , 'article-widget carousel.js should be imported once' ) ;
522+ assert ( toolsEntryContent . includes ( 'selected-article-widget/src/tabs.js' ) ) ;
523+ {
524+ const match = srcContent . match (
525+ / i m p o r t t o p i c _ \d + A p p f r o m " .\/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ s r c \/ t o p i c \. j s " ; / g
526+ ) ;
527+ assert . equal ( match ?. length , 1 , 'home-page topic.js should be imported once' ) ;
528+ }
529+ {
530+ const match = srcContent . match (
531+ / i m p o r t m a i n _ \d + A p p f r o m " .\/ @ a p o s t r o p h e c m s \/ h o m e - p a g e \/ s r c \/ m a i n \. j s " ; / g
532+ ) ;
533+ assert . equal ( match ?. length , 1 , 'home-page main.js should be imported once' ) ;
534+ }
535+ {
536+ const match = srcContent . match (
537+ / i m p o r t t o p i c _ \d + A p p f r o m " .\/ a r t i c l e - w i d g e t \/ s r c \/ t o p i c \. j s " ; / g
538+ ) ;
539+ assert . equal ( match ?. length , 1 , 'article-widget topic.js should be imported once' ) ;
540+ }
541+ {
542+ const match = srcContent . match (
543+ / i m p o r t c a r o u s e l _ \d + A p p f r o m " .\/ a r t i c l e - w i d g e t \/ s r c \/ c a r o u s e l \. j s " ; / g
544+ ) ;
545+ assert . equal ( match ?. length , 1 , 'article-widget carousel.js should be imported once' ) ;
546+ }
477547 }
478548 } ) ;
479549
0 commit comments