erudit 3.0.0-dev.5 → 3.0.0-dev.7

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 (81) hide show
  1. package/app/app.vue +1 -1
  2. package/app/components/SiteMain.vue +2 -3
  3. package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +1 -1
  4. package/app/components/aside/minor/topic/TopicNav.vue +1 -1
  5. package/app/components/aside/minor/topic/TopicToc.vue +1 -1
  6. package/app/components/bitran/BitranContent.vue +10 -3
  7. package/app/components/main/topic/MainTopic.vue +1 -2
  8. package/app/components/main/topic/TopicPartSwitch.vue +1 -1
  9. package/app/components/main/utils/Breadcrumb.vue +1 -6
  10. package/app/components/main/utils/ContentPopovers.vue +12 -6
  11. package/app/components/preview/display/Unique.vue +7 -1
  12. package/app/composables/bitran.ts +37 -33
  13. package/app/composables/bitranContent.ts +16 -4
  14. package/app/composables/bitranLocation.ts +1 -1
  15. package/app/composables/contentRoute.ts +1 -1
  16. package/app/composables/externalApi.ts +1 -1
  17. package/app/pages/group/[...groupId].vue +3 -4
  18. package/app/public/favicon/article.svg +9 -9
  19. package/app/scripts/flag.ts +1 -1
  20. package/app/scripts/preview/data/unique.ts +6 -5
  21. package/bin/erudit.mjs +2 -0
  22. package/globalPath.ts +1 -1
  23. package/globals/bitran.ts +1 -1
  24. package/globals/content.ts +1 -1
  25. package/globals/contributor.ts +1 -1
  26. package/globals/erudit.ts +1 -1
  27. package/module/bitran.ts +2 -2
  28. package/module/config.ts +2 -2
  29. package/module/index.ts +4 -5
  30. package/module/logger.ts +1 -1
  31. package/nuxt.config.ts +1 -40
  32. package/package.json +14 -7
  33. package/server/api/aside/major/nav/global.ts +1 -1
  34. package/server/api/aside/minor/path.ts +1 -2
  35. package/server/api/preview/page/[...parts].ts +3 -2
  36. package/server/api/preview/unique/[location].ts +6 -3
  37. package/server/plugin/bitran/content.ts +49 -42
  38. package/server/plugin/bitran/location.ts +1 -1
  39. package/server/plugin/bitran/products/include.ts +13 -15
  40. package/server/plugin/bitran/products/link.ts +12 -12
  41. package/server/plugin/bitran/toc.ts +21 -29
  42. package/server/plugin/bitran/transpiler.ts +15 -19
  43. package/server/plugin/build/jobs/content/generic.ts +2 -2
  44. package/server/plugin/build/jobs/content/parse.ts +19 -10
  45. package/server/plugin/build/jobs/content/type/group.ts +1 -1
  46. package/server/plugin/build/jobs/content/type/topic.ts +1 -1
  47. package/server/plugin/build/jobs/contributors.ts +2 -2
  48. package/server/plugin/build/jobs/nav.ts +6 -2
  49. package/server/plugin/build/setup.ts +1 -0
  50. package/server/plugin/content/absoluteId.ts +2 -2
  51. package/server/plugin/content/context.ts +6 -2
  52. package/server/plugin/db/entities/Content.ts +1 -1
  53. package/server/plugin/db/entities/Group.ts +1 -1
  54. package/server/plugin/db/entities/Topic.ts +1 -1
  55. package/server/plugin/global.ts +1 -1
  56. package/server/plugin/logger.ts +1 -1
  57. package/server/plugin/nav/node.ts +1 -1
  58. package/server/plugin/repository/content.ts +1 -1
  59. package/server/plugin/repository/topic.ts +1 -1
  60. package/shared/aside/minor.ts +2 -1
  61. package/shared/bitran/stringContent.ts +6 -0
  62. package/shared/content/data/base.ts +1 -1
  63. package/shared/content/data/type/topic.ts +1 -1
  64. package/shared/frontNav.ts +1 -1
  65. package/shared/icons.ts +2 -2
  66. package/shared/link.ts +5 -2
  67. package/tsconfig.json +1 -1
  68. package/shared/bitran/context.ts +0 -8
  69. package/shared/bitran/default.ts +0 -46
  70. package/shared/bitran/link/Link.vue +0 -166
  71. package/shared/bitran/link/factory.ts +0 -24
  72. package/shared/bitran/link/icon.svg +0 -3
  73. package/shared/bitran/link/languages/en.ts +0 -7
  74. package/shared/bitran/link/languages/ru.ts +0 -7
  75. package/shared/bitran/link/renderer.ts +0 -21
  76. package/shared/bitran/link/shared.ts +0 -17
  77. package/shared/bitran/link/target.ts +0 -134
  78. package/shared/bitran/link/transpiler.ts +0 -10
  79. package/shared/bitran/location.ts +0 -166
  80. package/test/bitran/link/target.test.ts +0 -141
  81. package/test/bitran/location.test.ts +0 -143
package/app/app.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { brandLogotype, brandColors } from 'erudit-cog/utils/brand';
2
+ import { brandLogotype, brandColors } from '@erudit-js/cog/utils/brand';
3
3
 
4
4
  import eruditConfig from '#erudit/config';
5
5
  import { version } from '@erudit/package.json';
@@ -11,7 +11,6 @@
11
11
 
12
12
  <style lang="scss" module>
13
13
  @use '$/def/bp';
14
- @use '@bitran-js/renderer-vue/scss/def' as bitranDef;
15
14
 
16
15
  .main {
17
16
  --_pMainBase: var(--gapBig);
@@ -24,8 +23,8 @@
24
23
  font-size: 18px;
25
24
 
26
25
  @include bp.below('mobile') {
27
- --_pMainBase: #{bitranDef.$asideWidth};
28
- font-size: 15px;
26
+ --_pMainBase: var(--_bitran_asideWidth);
27
+ font-size: 14px;
29
28
  }
30
29
 
31
30
  .mainInner {
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import type { ContentFlag } from 'erudit-cog/schema';
2
+ import type { ContentFlag } from '@erudit-js/cog/schema';
3
3
  import { flagsData } from '@app/scripts/flag';
4
4
 
5
5
  defineProps<{ flags: Record<ContentFlag, boolean> }>();
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { topicParts, type TopicPart } from 'erudit-cog/schema';
2
+ import { topicParts, type TopicPart } from '@erudit-js/cog/schema';
3
3
 
4
4
  import { injectAsideData } from '@app/scripts/aside/minor/state';
5
5
  import type { AsideMinorTopic } from '@shared/aside/minor';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { headingName } from '@erudit-js/bitran-elements/heading/shared';
3
3
 
4
- import { stringifyBitranLocation } from '@shared/bitran/location';
4
+ import { stringifyBitranLocation } from '@erudit-js/cog/schema';
5
5
  import type { TocItem } from '@erudit/shared/bitran/toc';
6
6
  import { topicLocation } from '@app/scripts/aside/minor/topic';
7
7
  import { injectAsideData } from '@app/scripts/aside/minor/state';
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import { Bitran, type BitranContent } from '@bitran-js/renderer-vue';
3
+ import type { BitranContext } from '@erudit-js/cog/schema';
3
4
 
4
- import type { BitranContext } from '@shared/bitran/context';
5
+ import eruditConfig from '#erudit/config';
5
6
 
6
7
  import RenderWrapper from './RenderWrapper.vue';
7
8
 
@@ -36,15 +37,16 @@ const isServer = import.meta.server;
36
37
  :RenderWrapper
37
38
  :isDev
38
39
  :isServer
40
+ :language="eruditConfig.language"
39
41
  />
40
42
  </template>
41
43
 
42
44
  <style lang="scss" module>
43
- @use '@bitran-js/renderer-vue/scss/def' as bitranDef;
45
+ @use '$/def/bp';
44
46
 
45
47
  .eruditBitranContainer {
46
48
  padding: var(--_pMainY) var(--_pMainX);
47
- padding-left: calc(var(--_pMainX) - #{bitranDef.$asideWidth});
49
+ padding-left: calc(var(--_pMainX) - var(--_bitran_asideWidth));
48
50
 
49
51
  // Setting up Bitran
50
52
 
@@ -64,7 +66,12 @@ const isServer = import.meta.server;
64
66
  --bitran_textMuted: var(--textMuted);
65
67
  --bitran_textDimmed: var(--textDimmed);
66
68
  --bitran_textDisabled: var(--textDisabled);
69
+ --bitran_textDeep: var(--textDeep);
67
70
 
68
71
  --bitran_colorBrand: var(--brand);
72
+
73
+ @include bp.below('mobile') {
74
+ --bitran_gapBlocks: calc(22px);
75
+ }
69
76
  }
70
77
  </style>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import type { TopicPart } from 'erudit-cog/schema';
3
- import { NO_ALIASES } from '@erudit-js/bitran-elements/aliases/shared';
2
+ import { NO_ALIASES, type TopicPart } from '@erudit-js/cog/schema';
4
3
 
5
4
  import eruditConfig from '#erudit/config';
6
5
 
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { topicParts, type TopicPart } from 'erudit-cog/schema';
2
+ import { topicParts, type TopicPart } from '@erudit-js/cog/schema';
3
3
 
4
4
  import type { TopicPartLinks } from '@erudit/shared/content/data/type/topic';
5
5
  import { TOPIC_PART_ICON } from '@erudit/shared/icons';
@@ -56,18 +56,13 @@ function getIcon(contextIcon: string) {
56
56
 
57
57
  @include transition(color);
58
58
 
59
- // [my-icon]
60
- // {
61
- // position: relative;
62
- // top: .6px;
63
- // }
64
-
65
59
  &:hover {
66
60
  color: var(--textMuted);
67
61
  }
68
62
  }
69
63
 
70
64
  .sep {
65
+ flex-shrink: 0;
71
66
  position: relative;
72
67
  top: 0.5px;
73
68
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import type { ContentFlag } from 'erudit-cog/schema';
2
+ import type { ContentFlag } from '@erudit-js/cog/schema';
3
3
 
4
4
  import type { ContentGenericData } from '@shared/content/data/base';
5
5
 
@@ -24,7 +24,7 @@ const phrase = await usePhrases(
24
24
 
25
25
  const flagData: Record<ContentFlag, PopoverData> = {
26
26
  dev: {
27
- icon: <MyIconName>'alert',
27
+ icon: <MyIconName>'construction',
28
28
  color: 'var(--warn)',
29
29
  title: phrase.flag_dev,
30
30
  description: phrase.flag_dev_description,
@@ -70,6 +70,7 @@ const hasPopovers = computed(() => {
70
70
  <ContentPopover v-if="generic?.dependencies" :data="dependenciesData">
71
71
  <ul :class="$style.dependenciesList">
72
72
  <li v-for="(value, key) in generic.dependencies">
73
+ <MyIcon :name="'arrow-left'" wrapper="span" />
73
74
  <NuxtLink :prefetch="false" :to="key">{{ value }}</NuxtLink>
74
75
  </li>
75
76
  </ul>
@@ -87,18 +88,23 @@ const hasPopovers = computed(() => {
87
88
 
88
89
  .dependenciesList {
89
90
  margin-top: var(--gapSmall);
90
- list-style-type: square;
91
+ list-style-type: none;
91
92
  list-style-position: inside;
92
93
  padding-inline-start: 0;
93
94
 
94
95
  li {
95
- &::marker {
96
- content: '↪';
96
+ display: flex;
97
+ gap: var(--gapSmall);
98
+ align-items: center;
99
+
100
+ [my-icon] {
101
+ flex-shrink: 0;
102
+ font-size: 0.95em;
103
+ transform: scaleX(-1);
97
104
  }
98
105
 
99
106
  a {
100
107
  color: inherit;
101
- padding-left: var(--gapSmall);
102
108
  }
103
109
  }
104
110
  }
@@ -5,6 +5,9 @@ import type { PreviewDataUnique } from '@app/scripts/preview/data/unique';
5
5
  import type { PreviewDisplayProps } from '@app/scripts/preview/display';
6
6
 
7
7
  const { data } = defineProps<PreviewDisplayProps<PreviewDataUnique>>();
8
+
9
+ const bitranTranspiler = await useBitranTranspiler();
10
+ const root = await bitranTranspiler.parser.parse(data.bitran.content.biCode);
8
11
  </script>
9
12
 
10
13
  <template>
@@ -16,7 +19,10 @@ const { data } = defineProps<PreviewDisplayProps<PreviewDataUnique>>();
16
19
  ]"
17
20
  >
18
21
  <BitranContent
19
- :content="data.bitran.content"
22
+ :content="{
23
+ root,
24
+ preRenderData: data.bitran.content.preRenderData,
25
+ }"
20
26
  :context="data.bitran.context"
21
27
  />
22
28
  </div>
@@ -1,9 +1,6 @@
1
- import eruditConfig from '#erudit/config';
2
- import bitranConfig from '#erudit/client/bitran';
3
-
4
1
  import {
5
2
  createPhraseCaller,
6
- getDefaultRenderers,
3
+ getDefaultRenderers as getDefaultBitranRenderers,
7
4
  getElementIcon,
8
5
  type ElementVueRenderers,
9
6
  } from '@bitran-js/renderer-vue';
@@ -12,22 +9,23 @@ import {
12
9
  type BitranTranspiler,
13
10
  type ElementTranspilers,
14
11
  } from '@bitran-js/transpiler';
15
- import { aliasesName } from '@erudit-js/bitran-elements/aliases/shared';
16
- import { aliasesTranspiler } from '@erudit-js/bitran-elements/aliases/transpiler';
17
- import { headingName } from '@erudit-js/bitran-elements/heading/shared';
18
- import { defineHeadingTranspiler } from '@erudit-js/bitran-elements/heading/transpiler';
19
- import { includeName } from '@erudit-js/bitran-elements/include/shared';
20
- import { includeTranspiler } from '@erudit-js/bitran-elements/include/transpiler';
21
- import { linkName } from '@erudit/shared/bitran/link/shared';
22
- import { linkTranspiler } from '@erudit/shared/bitran/link/transpiler';
23
- import { aliasesRenderer } from '@erudit-js/bitran-elements/aliases/renderer';
24
- import { headingRenderer } from '@erudit-js/bitran-elements/heading/renderer';
25
- import { includeRenderer } from '@erudit-js/bitran-elements/include/renderer';
26
- import { linkRenderer } from '@erudit/shared/bitran/link/renderer';
12
+ import type { BitranElements } from '@erudit-js/cog/schema';
13
+ import { eruditDefaultElements } from '@erudit-js/bitran-elements/default';
14
+
15
+ import eruditConfig from '#erudit/config';
16
+ import bitranConfig from '#erudit/client/bitran';
27
17
 
18
+ let defaultElements!: BitranElements;
28
19
  let bitranTranspiler!: BitranTranspiler;
29
20
  let bitranRenderers!: ElementVueRenderers;
30
21
 
22
+ globalThis.useEruditConfig = () => eruditConfig;
23
+
24
+ export function getDefaultElements() {
25
+ if (!defaultElements) defaultElements = eruditDefaultElements();
26
+ return defaultElements;
27
+ }
28
+
31
29
  //
32
30
  // Transpiler
33
31
  //
@@ -36,15 +34,7 @@ export async function useBitranTranspiler() {
36
34
  if (bitranTranspiler) return bitranTranspiler;
37
35
 
38
36
  const projectTranspilers = await getProjectTranspilers();
39
-
40
- const defaultTranspilers = {
41
- [aliasesName]: aliasesTranspiler,
42
- [includeName]: includeTranspiler,
43
- [headingName]: defineHeadingTranspiler({
44
- language: eruditConfig?.language,
45
- }),
46
- [linkName]: linkTranspiler,
47
- };
37
+ const defaultTranspilers = await getDefaultTranspilers();
48
38
 
49
39
  bitranTranspiler = defineBitranTranspiler({
50
40
  ...projectTranspilers,
@@ -66,6 +56,16 @@ async function getProjectTranspilers(): Promise<ElementTranspilers> {
66
56
  return projectTranspilers;
67
57
  }
68
58
 
59
+ async function getDefaultTranspilers(): Promise<ElementTranspilers> {
60
+ const defaultElements = getDefaultElements();
61
+ const defaultTranspilers: ElementTranspilers = {};
62
+
63
+ for (const [name, bitranElement] of Object.entries(defaultElements))
64
+ defaultTranspilers[name] = await bitranElement.transpiler();
65
+
66
+ return defaultTranspilers;
67
+ }
68
+
69
69
  //
70
70
  // Renderers
71
71
  //
@@ -74,13 +74,7 @@ export async function useBitranRenderers() {
74
74
  if (bitranRenderers) return bitranRenderers;
75
75
 
76
76
  const projectRenderers = await getProjectRenderers();
77
-
78
- const defaultRenderers = {
79
- [aliasesName]: aliasesRenderer,
80
- [includeName]: includeRenderer,
81
- [headingName]: headingRenderer,
82
- [linkName]: linkRenderer,
83
- };
77
+ const defaultRenderers = await getDefaultRenderers();
84
78
 
85
79
  // @ts-ignore
86
80
  bitranRenderers = {
@@ -103,6 +97,16 @@ async function getProjectRenderers() {
103
97
  return projectRenderers;
104
98
  }
105
99
 
100
+ async function getDefaultRenderers() {
101
+ const defaultElements = getDefaultElements();
102
+ const defaultRenderers: ElementVueRenderers = {};
103
+
104
+ for (const [name, bitranElement] of Object.entries(defaultElements))
105
+ defaultRenderers[name] = await bitranElement.renderer();
106
+
107
+ return defaultRenderers;
108
+ }
109
+
106
110
  //
107
111
  // Utils
108
112
  //
@@ -110,7 +114,7 @@ async function getProjectRenderers() {
110
114
  export async function useBitranElementRenderer(productName: string) {
111
115
  const renderer =
112
116
  (await useBitranRenderers())[productName] ||
113
- getDefaultRenderers()[productName];
117
+ getDefaultBitranRenderers()[productName];
114
118
 
115
119
  if (!renderer)
116
120
  throw new Error(`Missing Bitran product render "${productName}"!`);
@@ -1,11 +1,11 @@
1
1
  import type { ShallowRef } from 'vue';
2
2
  import type { BitranContent } from '@bitran-js/renderer-vue';
3
-
4
3
  import {
5
4
  encodeBitranLocation,
6
5
  stringifyBitranLocation,
7
6
  type BitranLocation,
8
- } from '@erudit/shared/bitran/location';
7
+ } from '@erudit-js/cog/schema';
8
+ import type { StringBitranContent } from '@erudit/shared/bitran/stringContent';
9
9
 
10
10
  export async function useBitranContent(
11
11
  location: Ref<BitranLocation | undefined>,
@@ -26,11 +26,23 @@ export async function useBitranContent(
26
26
 
27
27
  const apiRoute = `/api/bitran/content/${encodeBitranLocation(stringifyBitranLocation(location.value!))}`;
28
28
  nuxtApp.runWithContext(() => prerenderRoutes(apiRoute));
29
+
29
30
  // @ts-ignore
30
31
  contentPromise = (async () => {
31
- content.value = (await $fetch(apiRoute, {
32
+ const stringContent = (await $fetch(apiRoute, {
32
33
  responseType: 'json',
33
- })) as BitranContent;
34
+ })) as StringBitranContent;
35
+
36
+ const bitranTranspiler = await useBitranTranspiler();
37
+ const root = await bitranTranspiler.parser.parse(
38
+ stringContent.biCode,
39
+ );
40
+
41
+ content.value = {
42
+ root,
43
+ preRenderData: stringContent.preRenderData,
44
+ };
45
+
34
46
  return content;
35
47
  })();
36
48
  });
@@ -1,4 +1,4 @@
1
- import { locationFromPath, type BitranLocation } from '@shared/bitran/location';
1
+ import { locationFromPath, type BitranLocation } from '@erudit-js/cog/schema';
2
2
 
3
3
  export function useBitranLocation(): ComputedRef<BitranLocation | undefined> {
4
4
  const route = useRoute();
@@ -1,4 +1,4 @@
1
- import type { ContentType, TopicPart } from 'erudit-cog/schema';
1
+ import type { ContentType, TopicPart } from '@erudit-js/cog/schema';
2
2
 
3
3
  interface ContentRouteBase {
4
4
  type: ContentType;
@@ -1,4 +1,4 @@
1
- import type { EruditConfigDebug } from 'erudit-cog/schema';
1
+ import type { EruditConfigDebug } from '@erudit-js/cog/schema';
2
2
 
3
3
  import eruditConfig from '#erudit/config';
4
4
 
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" setup>
2
- import { NO_ALIASES } from '@erudit-js/bitran-elements/aliases/shared';
3
-
4
- import { type ContentGroupData } from '@shared/content/data/type/group';
2
+ import { NO_ALIASES } from '@erudit-js/cog/schema';
5
3
  import eruditConfig from '#erudit/config';
6
4
 
5
+ import { type ContentGroupData } from '@shared/content/data/type/group';
6
+ import { locationIcon } from '@erudit/shared/icons';
7
7
  import ContentDecoration from '@app/components/main/utils/ContentDecoration.vue';
8
8
  import Breadcrumb from '@app/components/main/utils/Breadcrumb.vue';
9
9
  import ContentTitle from '@app/components/main/utils/ContentTitle.vue';
10
10
  import ContentDescription from '@app/components/main/utils/ContentDescription.vue';
11
11
  import ContentPopovers from '@app/components/main/utils/ContentPopovers.vue';
12
12
  import ContentSection from '@app/components/main/utils/ContentSection.vue';
13
- import { locationIcon } from '@erudit/shared/icons';
14
13
 
15
14
  const location = useBitranLocation();
16
15
 
@@ -1,10 +1,10 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
- <defs>
3
- <linearGradient id="gradient" x1="75" y1="423" x2="437" y2="61" gradientUnits="userSpaceOnUse">
4
- <stop offset="0" stop-color="#4aa44c"/>
5
- <stop offset="1" stop-color="#1278b9"/>
6
- </linearGradient>
7
- </defs>
8
- <circle fill="url(#gradient)" cx="256" cy="256" r="256"/>
9
- <path fill="white" d="M372.4,179.3h-232.8c-6.6,0-12-5.4-12-12v-26.3c0-6.6,5.4-12,12-12h232.8c6.6,0,12,5.4,12,12v26.3c0,6.6-5.4,12-12,12ZM384.4,269.2v-26.3c0-6.6-5.4-12-12-12h-232.8c-6.6,0-12,5.4-12,12v26.3c0,6.6,5.4,12,12,12h232.8c6.6,0,12-5.4,12-12ZM384.4,371v-26.3c0-6.6-5.4-12-12-12h-232.8c-6.6,0-12,5.4-12,12v26.3c0,6.6,5.4,12,12,12h232.8c6.6,0,12-5.4,12-12Z"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <defs>
3
+ <linearGradient id="gradient" x1="75" y1="423" x2="437" y2="61" gradientUnits="userSpaceOnUse">
4
+ <stop offset="0" stop-color="#4aa44c"/>
5
+ <stop offset="1" stop-color="#1278b9"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <circle fill="url(#gradient)" cx="256" cy="256" r="256"/>
9
+ <path fill="white" d="M372.4,179.3h-232.8c-6.6,0-12-5.4-12-12v-26.3c0-6.6,5.4-12,12-12h232.8c6.6,0,12,5.4,12,12v26.3c0,6.6-5.4,12-12,12ZM384.4,269.2v-26.3c0-6.6-5.4-12-12-12h-232.8c-6.6,0-12,5.4-12,12v26.3c0,6.6,5.4,12,12,12h232.8c6.6,0,12-5.4,12-12ZM384.4,371v-26.3c0-6.6-5.4-12-12-12h-232.8c-6.6,0-12,5.4-12,12v26.3c0,6.6,5.4,12,12,12h232.8c6.6,0,12-5.4,12-12Z"/>
10
10
  </svg>
@@ -1,5 +1,5 @@
1
1
  import type { MyIconName } from '#my-icons';
2
- import type { ContentFlag } from 'erudit-cog/schema';
2
+ import type { ContentFlag } from '@erudit-js/cog/schema';
3
3
 
4
4
  interface FlagData {
5
5
  icon: MyIconName;
@@ -1,18 +1,19 @@
1
- import type { BitranContent } from 'bitran';
2
-
3
- import type { BitranContext } from '@erudit/shared/bitran/context';
1
+ import {
2
+ encodeBitranLocation,
3
+ type BitranContext,
4
+ } from '@erudit-js/cog/schema';
4
5
 
5
6
  import { PreviewDataType, type PreviewDataBase } from '../data';
6
7
  import type { PreviewFooter } from '../footer';
7
8
  import { PreviewRequestType, type PreviewRequest } from '../request';
8
- import { encodeBitranLocation } from '@erudit/shared/bitran/location';
9
+ import type { StringBitranContent } from '@erudit/shared/bitran/stringContent';
9
10
 
10
11
  export interface PreviewDataUnique extends PreviewDataBase {
11
12
  type: PreviewDataType.Unique;
12
13
  productName: string;
13
14
  bitran: {
14
15
  context: BitranContext;
15
- content: BitranContent;
16
+ content: StringBitranContent;
16
17
  };
17
18
  footer: PreviewFooter;
18
19
  }
package/bin/erudit.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '@erudit-js/cli/cli';
package/globalPath.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'node:url';
2
- import { resolvePaths } from 'erudit-cog/kit';
2
+ import { resolvePaths } from '@erudit-js/cog/kit';
3
3
 
4
4
  export const ERUDIT_DIR = resolvePaths(fileURLToPath(import.meta.url), '..');
5
5
  export const PROJECT_DIR = process.env.ERUDIT_PROJECT_DIR as string;
package/globals/bitran.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { defineBitranConfig, defineBitranElement } from 'erudit-cog/schema';
1
+ import { defineBitranConfig, defineBitranElement } from '@erudit-js/cog/schema';
2
2
  export { defineBitranConfig, defineBitranElement };
@@ -3,7 +3,7 @@ import type {
3
3
  ContentReferences,
4
4
  GroupConfig,
5
5
  TopicConfig,
6
- } from 'erudit-cog/schema';
6
+ } from '@erudit-js/cog/schema';
7
7
 
8
8
  export function defineBook(book: Partial<BookConfig>) {
9
9
  return book;
@@ -1,4 +1,4 @@
1
- import type { ContributorConfig } from 'erudit-cog/schema';
1
+ import type { ContributorConfig } from '@erudit-js/cog/schema';
2
2
 
3
3
  export function defineContributor(contributor: Partial<ContributorConfig>) {
4
4
  return contributor;
package/globals/erudit.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { EruditConfig } from 'erudit-cog/schema';
1
+ import type { EruditConfig } from '@erudit-js/cog/schema';
2
2
 
3
3
  export function defineEruditConfig(eruditConfig: Partial<EruditConfig>) {
4
4
  return eruditConfig;
package/module/bitran.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { addTemplate } from 'nuxt/kit';
2
2
  import type { Nuxt } from 'nuxt/schema';
3
- import type { EruditBitranConfig } from 'erudit-cog/schema';
3
+ import type { EruditBitranConfig } from '@erudit-js/cog/schema';
4
4
 
5
5
  import { eruditEndNuxtPath, projectPath } from '@erudit/globalPath';
6
6
  import { logger } from '@erudit/module/logger';
@@ -22,7 +22,7 @@ export async function setupBitranConfig(_nuxt: Nuxt) {
22
22
  filename: templateFilename,
23
23
  write: true,
24
24
  getContents: () => `
25
- import type { EruditBitranConfig } from 'erudit-cog/schema';
25
+ import type { EruditBitranConfig } from '@erudit-js/cog/schema';
26
26
  ${config ? `import bitranConfig from '${projectPath('bitran')}';` : ''}
27
27
  export default ${config ? 'bitranConfig' : '{}'} as Partial<EruditBitranConfig>;
28
28
  `,
package/module/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { addTemplate } from 'nuxt/kit';
2
2
  import type { Nuxt } from 'nuxt/schema';
3
- import type { EruditConfig } from 'erudit-cog/schema';
3
+ import type { EruditConfig } from '@erudit-js/cog/schema';
4
4
 
5
5
  import { eruditEndNuxtPath, projectPath } from '@erudit/globalPath';
6
6
  import { logger } from '@erudit/module/logger';
@@ -22,7 +22,7 @@ export async function setupEruditConfig(_nuxt: Nuxt) {
22
22
  filename: templateFilename,
23
23
  write: true,
24
24
  getContents: () => `
25
- import type { EruditConfig } from 'erudit-cog/schema';
25
+ import type { EruditConfig } from '@erudit-js/cog/schema';
26
26
  export default ${JSON.stringify(config, null, ' ')} as Partial<EruditConfig>;
27
27
  `,
28
28
  });
package/module/index.ts CHANGED
@@ -28,15 +28,14 @@ export default defineNuxtModule({
28
28
  }
29
29
 
30
30
  {
31
- // Handle sub dependencies
32
- const subDeps = eruditConfig.subDeps || [];
33
-
34
31
  const transpile = (_nuxt.options.build.transpile ||= []);
35
32
  const optimizeDeps = _nuxt.options.vite.optimizeDeps || {};
36
33
  const optimizeDepsInclude = (optimizeDeps.include ||= []);
37
34
 
38
- transpile.push(...subDeps);
39
- optimizeDepsInclude.push(...subDeps);
35
+ transpile.push(...(eruditConfig.nuxt?.transpile || []));
36
+ optimizeDepsInclude.push(
37
+ ...(eruditConfig.nuxt?.optimizeDeps || []),
38
+ );
40
39
  }
41
40
 
42
41
  // TODO: Watch for contributors folder and create/update template with their IDs
package/module/logger.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createConsola } from 'consola';
2
- import { brandColorTitle } from 'erudit-cog/utils/brandNode';
2
+ import { brandColorTitle } from '@erudit-js/cog/utils/brandNode';
3
3
 
4
4
  const tag = brandColorTitle + ' Module';
5
5
 
package/nuxt.config.ts CHANGED
@@ -1,5 +1,3 @@
1
- //import { elementPackages } from '@erudit-js/bitran-elements';
2
-
3
1
  import { eruditPath, projectPath } from './globalPath';
4
2
 
5
3
  export default defineNuxtConfig({
@@ -24,29 +22,11 @@ export default defineNuxtConfig({
24
22
  include: [eruditPath('**/*'), projectPath('**/*')],
25
23
  },
26
24
  },
27
- // modulesDir: [
28
- // 'D:/code/erudit-js/erudit/node_modules',
29
- // 'D:/code/erudit-js/bitran-elements/node_modules',
30
- // ],
31
25
  build: {
32
26
  transpile: [
33
27
  'yaml',
34
28
  '@bitran-js/renderer-vue',
35
29
  '@erudit-js/bitran-elements',
36
- // '@bitran-js/renderer-vue',
37
- // // '@erudit-js/bitran-elements',
38
- // // '@erudit-js/bitran-elements/heading/renderer',
39
- // 'yaml',
40
- //...elementPackages,
41
- // (ctx) => (ctx.isClient ? 'slugify' : false),
42
- // 'katex',
43
- // '@bitran-js/core',
44
- // '@bitran-js/transpiler',
45
- // '@bitran-js/renderer-vue',
46
- // '@erudit-js/bitran-elements',
47
- // '@erudit-js/bitran-elements/heading/shared',
48
- // '@erudit-js/bitran-elements/heading/transpiler',
49
- // '@erudit-js/bitran-elements/heading/renderer',
50
30
  ],
51
31
  },
52
32
  ignore: [
@@ -104,26 +84,7 @@ export default defineNuxtConfig({
104
84
  vite: {
105
85
  optimizeDeps: {
106
86
  noDiscovery: true,
107
- include: [
108
- 'yaml',
109
- '@floating-ui/vue',
110
- // '@bitran-js/core',
111
- // '@bitran-js/transpiler',
112
- // // '@bitran-js/renderer-vue',
113
- // // '@erudit-js/bitran-elements',
114
- // 'gradient-string',
115
- // '@floating-ui/vue',
116
- // 'yaml',
117
- // //
118
- //...elementPackages,
119
- // '@bitran-js/core',
120
- // '@bitran-js/transpiler',
121
- // '@bitran-js/renderer-vue',
122
- // '@erudit-js/bitran-elements',
123
- // '@erudit-js/bitran-elements/heading/shared',
124
- // '@erudit-js/bitran-elements/heading/transpiler',
125
- // '@erudit-js/bitran-elements/heading/renderer',
126
- ],
87
+ include: ['yaml', '@floating-ui/vue'],
127
88
  },
128
89
  server: { fs: { strict: false } },
129
90
  css: {