itube-specs 0.0.811 → 0.0.814

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # itube-specs
2
2
 
3
3
  Общий **Nuxt Layer** для сайтов itube. Держит единую базу: компоненты, composables, сервисы, утилиты,
4
- runtime-хелперы, типы и lib-данные. Приложения расширяют слой (`extends: ['itube-specs']`) и форкаются
5
- под разные сайты одной ниши поэтому слой должен оставаться **самодостаточным и site-agnostic**.
4
+ runtime-хелперы, типы, lib-данные, а также middleware, SSR-плагины и BFF-хендлеры (`server/api`).
5
+ Приложения расширяют слой (`extends: ['itube-specs']`) и форкаются под разные сайты одной ниши
6
+ поэтому слой должен оставаться **самодостаточным и site-agnostic**.
6
7
 
7
8
  > Bitbucket: https://bitbucket.org/luckytube/specs/src/master/
8
9
 
@@ -76,9 +77,15 @@ runtime/ # runtime-значения и хелперы (barrel index.ts)
76
77
  constants/ # доменные `as const` (Niche, PlaylistType, AdSpotType, …)
77
78
  utils/ # чистые хелперы, cleaners/, converters/
78
79
  types/ # .d.ts типы (barrel index.d.ts — с расширением .d.ts в реэкспортах)
79
- lib/ # статические scheme/config-данные (barrel index.ts)
80
+ lib/ # статические scheme/config-данные (barrel index.ts): scheme/*, css-breakpoints
81
+ middleware/ # глобальные: auth.global, normalize.global, age.global
82
+ plugins/ # SSR/клиент: country/countries/mobile (SSR), services.client, sentry.client, adv
83
+ server/ # BFF: api/** (тонкие прокси к внешнему API), utils/metrics, plugins/*, tasks
80
84
  ```
81
85
 
86
+ > `middleware`/`plugins`/`server` обязаны быть в `files` (whitelist) — иначе не попадут в паблиш
87
+ > (см. раздел `files`/`exports`).
88
+
82
89
  ---
83
90
 
84
91
  ## Импорты
@@ -87,8 +94,9 @@ lib/ # статические scheme/config-данные (barrel index
87
94
  через имя пакета. Приложения импортируют как `itube-specs/runtime`, `itube-specs/services/...`,
88
95
  `itube-specs/utils/...`, а типы — `itube-specs/types`.
89
96
 
90
- Алиасы `~/…`/`@/…` в файле слоя резолвятся на **приложение**, не на слой — для кода слоя их не используем
91
- (допустимо только для намеренных app-зависимостей, например рекламный компонент `~/config`/`~/utils`).
97
+ Алиасы `~/…`/`@/…` в файле слоя резолвятся на **приложение**, не на слой — в коде слоя их не используем.
98
+ Сейчас таких app-зависимостей в слое не осталось: то, что раньше приходило из приложения (фича-флаги,
99
+ ad-конфиг), теперь читается из `runtimeConfig.public` (значения задаёт приложение).
92
100
 
93
101
  ### `files` / `exports`
94
102
 
@@ -105,10 +113,12 @@ lib/ # статические scheme/config-данные (barrel index
105
113
 
106
114
  ## Что живёт в слое, а что в приложении
107
115
 
108
- - **Слой:** переиспользуемые компоненты, composables, API-сервисы, доменные утилиты, runtime-константы/хелперы,
109
- типы, scheme/lib-данные всё site-agnostic.
110
- - **Приложение:** фича-флаги и прочий `config/`, `assets/scss` (токены), плагины (`$features`, реклама,
111
- sentry), страницы, i18n-локали, BFF-хендлеры `server/` всё site-specific и завязанное на окружение.
116
+ - **Слой:** компоненты, composables, API-сервисы, доменные утилиты, runtime-константы/хелперы, типы,
117
+ `lib/` (scheme, css-breakpoints), middleware (`auth`/`normalize`/`age`), SSR-плагины
118
+ (`country`/`mobile`/`services`/`sentry`/`adv`), BFF-хендлеры `server/api/**` всё site-agnostic.
119
+ - **Приложение:** только per-site**значения** config (флаги/реклама/локали) через `runtimeConfig.public`
120
+ (слой держит пустые контейнеры-заглушки), `assets/scss` (токены), страницы, i18n-локали и остаток
121
+ `server/`, завязанный на локали (`locale-guard`, `site/languages`, `is-locale-blocked`).
112
122
 
113
123
  ---
114
124
 
@@ -130,5 +140,6 @@ lib/ # статические scheme/config-данные (barrel index
130
140
  ## Тесты
131
141
 
132
142
  Vitest через `@nuxt/test-utils`. В слое — **только тесты без app-специфичного окружения** (чистая логика
133
- composables/utils/runtime). Компонентные тесты с монтированием SFC и всё, что требует app-инжектов
134
- (`$features`, SCSS-токены), живёт в **приложении** в слое нет ни scss-инъекции, ни плагинов приложения.
143
+ composables/utils/runtime). Компонентные тесты с монтированием SFC (нужна SCSS-инъекция токенов, которой в слое
144
+ нет) живут в **приложении**. Значения `runtimeConfig` (`featureFlags`/`adsConfig`) в слое пустые контейнеры,
145
+ поэтому его код при бутстрапе в CI не падает, но реальные значения приходят только из приложения.
@@ -61,7 +61,7 @@
61
61
  <script setup lang="ts">
62
62
  import { convertString, formatDate } from '../../runtime';
63
63
  import type { IChannelCard } from '../../types';
64
- import { CSS_BREAKPOINTS } from '~/lib/css-breakpoints';
64
+ import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
65
65
 
66
66
  const props = defineProps<{
67
67
  card: IChannelCard
@@ -176,7 +176,7 @@
176
176
  import { formatDate, ThumbSize } from '../../runtime';
177
177
  import type { IPlaylistCard, IProfileData, IThumbUrls } from '../../types';
178
178
  import { AuthorizationApiService } from '../../services/api/authorization.service';
179
- import { CSS_BREAKPOINTS } from '~/lib/css-breakpoints';
179
+ import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
180
180
 
181
181
  const props = defineProps<{
182
182
  card: IPlaylistCard
@@ -138,7 +138,7 @@
138
138
  <script setup lang="ts">
139
139
  import type { IVideoCard } from '../../../types';
140
140
  import { convertString, getDuration } from '../../../runtime';
141
- import { CSS_BREAKPOINTS } from '~/lib/css-breakpoints';
141
+ import { CSS_BREAKPOINTS } from '../../../lib/css-breakpoints';
142
142
 
143
143
  const featureFlags = useRuntimeConfig().public.featureFlags;
144
144
 
@@ -111,7 +111,7 @@
111
111
  import type { IModelFilter } from '../../types';
112
112
  import { onClickOutside } from '@vueuse/core';
113
113
  import { convertString, checkDeviceWidth } from '../../runtime';
114
- import { CSS_BREAKPOINTS } from '~/lib/css-breakpoints';
114
+ import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
115
115
 
116
116
  const props = defineProps<{
117
117
  filters: IModelFilter[]
@@ -81,7 +81,7 @@ import { AuthSteps, onBackdropClick, checkDeviceWidth } from '../../runtime';
81
81
  import type { CssBreakpoints, IProfileData } from '../../types';
82
82
  import { AuthorizationApiService } from '../../services/api/authorization.service';
83
83
 
84
- import { getNavigationItems } from '~/lib/scheme';
84
+ import { getNavigationItems } from '../../lib';
85
85
 
86
86
  const { t } = useI18n();
87
87
  const { generateLink } = useGenerateLink();
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
 
13
13
  <script setup lang="ts">
14
- import { additionalLinksItems } from '~/lib/scheme';
14
+ import { additionalLinksItems } from '../../lib';
15
15
 
16
16
  const emit = defineEmits<{
17
17
  (eventName: 'close',): void;
@@ -109,7 +109,7 @@
109
109
  <script setup lang="ts">
110
110
  import { onClickOutside } from '@vueuse/core';
111
111
  import { AuthorizationApiService } from '../../services/api/authorization.service';
112
- import { profileNavigationItems } from '~/lib/scheme';
112
+ import { profileNavigationItems } from '../../lib';
113
113
  import type { IProfileData } from '../../types';
114
114
 
115
115
  const userRef = ref<HTMLElement>();
@@ -53,7 +53,7 @@
53
53
  </template>
54
54
 
55
55
  <script setup lang="ts">
56
- import { getNavigationItems } from '~/lib/scheme';
56
+ import { getNavigationItems } from '../../lib';
57
57
  import type { INavigationItems } from '../../types';
58
58
 
59
59
  defineProps<{
@@ -0,0 +1,15 @@
1
+ export type CssBreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
2
+
3
+ /**
4
+ * Брейкпоинты на проекте,
5
+ * должны совпадать с тем что в CSS assets/scss/_breakpoints.scss
6
+ *
7
+ * Используется для свайпера, для установки брейкпоинтов у него.
8
+ */
9
+ export const CSS_BREAKPOINTS: Record<CssBreakpointName, number> = {
10
+ xs: 475,
11
+ sm: 960,
12
+ md: 1350,
13
+ lg: 1600,
14
+ xl: 2560,
15
+ };
package/lib/index.ts CHANGED
@@ -12,3 +12,7 @@ export * from './scheme/sort-models';
12
12
  export * from './scheme/sort-playlists';
13
13
  export * from './scheme/sort-items-default';
14
14
  export * from './scheme/categories-navigation';
15
+ export * from './scheme/navigation-items';
16
+ export * from './scheme/profile-navigation-items';
17
+ export * from './scheme/additional-links-items';
18
+ export * from './css-breakpoints';
@@ -0,0 +1,24 @@
1
+ import type { ILinkItem } from '../../types';
2
+
3
+ export const additionalLinksItems: ILinkItem[] = [
4
+ {
5
+ title: 'contact',
6
+ name: '/contacts',
7
+ },
8
+ {
9
+ title: 'terms',
10
+ name: '/terms',
11
+ },
12
+ {
13
+ title: 'dmca',
14
+ name: '/dmca',
15
+ },
16
+ {
17
+ title: '2257',
18
+ name: '/2257',
19
+ },
20
+ {
21
+ title: 'privacy',
22
+ name: '/policy',
23
+ },
24
+ ];
@@ -0,0 +1,78 @@
1
+ import type { INavigationItems } from '../../types';
2
+
3
+ /** Пункты главной навигации; часть завязана на фича-флаги, поэтому строится в setup-контексте. */
4
+ export function getNavigationItems(): INavigationItems[] {
5
+ const { featureFlags } = useRuntimeConfig().public;
6
+
7
+ return [
8
+ {
9
+ title: 'videos',
10
+ link: '/',
11
+ icon: 'video-camera',
12
+ },
13
+ {
14
+ title: 'categories',
15
+ link: '/categories',
16
+ icon: 'grid',
17
+ },
18
+ {
19
+ title: 'gay_models',
20
+ link: '/models',
21
+ icon: 'user',
22
+ },
23
+ {
24
+ title: 'channels',
25
+ link: '/channels',
26
+ icon: 'play-circle',
27
+ },
28
+ {
29
+ title: 'playlists',
30
+ link: '/playlists',
31
+ icon: 'list',
32
+ },
33
+ ...(featureFlags.FeatureLiveEnabled ? [{
34
+ title: 'live_sex',
35
+ link: '/2257',
36
+ icon: 'photo-cam',
37
+ accent: true,
38
+ }] : []),
39
+ ...(featureFlags.FeatureHistoryEnabled ? [{
40
+ title: 'history',
41
+ link: '/2257',
42
+ icon: 'time',
43
+ top: true,
44
+ }] : []),
45
+ ...(featureFlags.FeatureFavoritesEnabled ? [{
46
+ title: 'favorites',
47
+ icon: 'heart',
48
+ top: true,
49
+ childs: [
50
+ {
51
+ title: 'videos',
52
+ icon: 'video-camera',
53
+ link: '/favorites',
54
+ },
55
+ {
56
+ title: 'watch_later',
57
+ icon: 'time',
58
+ link: '/2257',
59
+ },
60
+ {
61
+ title: 'playlists',
62
+ icon: 'list',
63
+ link: '/2257',
64
+ },
65
+ {
66
+ title: 'models',
67
+ icon: 'user',
68
+ link: '/2257',
69
+ },
70
+ {
71
+ title: 'channels',
72
+ icon: 'play-circle',
73
+ link: '/2257',
74
+ },
75
+ ],
76
+ }] : []),
77
+ ];
78
+ }
@@ -0,0 +1,47 @@
1
+ export const profileNavigationItems = [
2
+ {
3
+ value: '/user/profile?edit=true',
4
+ title: 'history',
5
+ icon: 'time',
6
+ group: 1,
7
+ },
8
+ {
9
+ value: '/user/profile?edit=true',
10
+ title: 'favorites',
11
+ icon: 'heart',
12
+ group: 1,
13
+ childs: [
14
+ {
15
+ value: '/user/profile?edit=true',
16
+ title: 'videos',
17
+ icon: 'video-camera',
18
+ },
19
+ {
20
+ value: '/user/profile?edit=true',
21
+ title: 'watch_later',
22
+ icon: 'time',
23
+ },
24
+ {
25
+ value: '/user/profile?edit=true',
26
+ title: 'playlists',
27
+ icon: 'list',
28
+ },
29
+ {
30
+ value: '/user/profile?edit=true',
31
+ title: 'models',
32
+ icon: 'user',
33
+ },
34
+ {
35
+ value: '/user/profile?edit=true',
36
+ title: 'channels',
37
+ icon: 'play-circle',
38
+ },
39
+ ]
40
+ },
41
+ {
42
+ value: '/user/settings',
43
+ title: 'edit_profile',
44
+ icon: 'settings',
45
+ group: 2,
46
+ },
47
+ ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.811",
4
+ "version": "0.0.814",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {