histoire 0.11.9 → 0.12.0

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.
@@ -192,7 +192,7 @@ function generateBaseHtml(head, body, ctx) {
192
192
  }
193
193
  function generateEntryHtml(jsEntryFile, cssEntryFile, variables, ctx) {
194
194
  return generateBaseHtml(`<link rel="stylesheet" href="${ctx.resolvedViteConfig.base}${cssEntryFile}">
195
- ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.config.theme.favicon}"/>` : ''}
195
+ ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.resolvedViteConfig.base}${ctx.config.theme.favicon}"/>` : ''}
196
196
  ${variables.HEAD ?? ''}`, `<div id="app"></div>
197
197
  <script type="module" src="${ctx.resolvedViteConfig.base}${jsEntryFile}"></script>`, ctx);
198
198
  }
@@ -22,9 +22,10 @@ export function useCollectStories(options, ctx) {
22
22
  },
23
23
  transformMode: ctx.config.viteNodeTransformMode,
24
24
  });
25
+ const maxThreads = ctx.config.collectMaxThreads ?? cpus().length;
25
26
  const threadsCount = ctx.mode === 'dev'
26
- ? Math.max(cpus().length / 2, 1)
27
- : Math.max(cpus().length - 1, 1);
27
+ ? Math.max(Math.min(maxThreads, cpus().length / 2), 1)
28
+ : Math.max(Math.min(maxThreads, cpus().length - 1), 1);
28
29
  console.log(pc.blue(`Using ${threadsCount} threads for story collection`));
29
30
  const threadPool = new Tinypool({
30
31
  filename: new URL('./worker.js', import.meta.url).href,
@@ -1,4 +1,5 @@
1
1
  import type { HistoireConfig, ConfigMode } from '@histoire/shared';
2
+ import type { Context } from './context.js';
2
3
  export declare function getDefaultConfig(): HistoireConfig;
3
4
  export declare const configFileNames: string[];
4
5
  export declare function resolveConfigFile(cwd?: string): string;
@@ -13,8 +14,7 @@ export declare const mergeConfig: <Source extends {
13
14
  [x: symbol]: any;
14
15
  } | (number | boolean | any[] | Record<never, any>))[]>(source: Source, ...defaults: Defaults) => import("defu").Defu<Source, Defaults>;
15
16
  export declare function resolveConfig(cwd: string, mode: ConfigMode): Promise<HistoireConfig>;
16
- export declare function processConfig(config: HistoireConfig, mode: ConfigMode): Promise<HistoireConfig>;
17
- export declare function processDefaultConfig(defaultConfig: HistoireConfig, preUserConfig: HistoireConfig, mode: ConfigMode, cwd: string): Promise<HistoireConfig>;
17
+ export declare function processConfig(ctx: Context): Promise<void>;
18
18
  export declare function defineConfig(config: Partial<HistoireConfig>): Partial<HistoireConfig>;
19
19
  declare module 'vite' {
20
20
  interface UserConfig {
@@ -4,6 +4,7 @@ import { resolveConfig as resolveViteConfig, mergeConfig as mergeViteConfig, } f
4
4
  import jiti from 'jiti';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import pc from 'picocolors';
7
+ import fs from 'node:fs';
7
8
  import { defaultColors } from './colors.js';
8
9
  import { findUp } from './util/find-up.js';
9
10
  import { tailwindTokens } from './builtin-plugins/tailwind-tokens.js';
@@ -212,9 +213,9 @@ export async function resolveConfig(cwd = process.cwd(), mode) {
212
213
  const viteHistoireConfig = (viteConfig.histoire ?? {});
213
214
  const preUserConfig = mergeConfig(result, viteHistoireConfig);
214
215
  const processedDefaultConfig = await processDefaultConfig(getDefaultConfig(), preUserConfig, mode, cwd);
215
- return processConfig(mergeConfig(preUserConfig, processedDefaultConfig), mode);
216
+ return resolveConfigPlugins(mergeConfig(preUserConfig, processedDefaultConfig), mode);
216
217
  }
217
- export async function processConfig(config, mode) {
218
+ async function resolveConfigPlugins(config, mode) {
218
219
  for (const plugin of config.plugins) {
219
220
  if (plugin.config) {
220
221
  const result = await plugin.config(config, mode);
@@ -223,10 +224,9 @@ export async function processConfig(config, mode) {
223
224
  }
224
225
  }
225
226
  }
226
- config.outDir = path.resolve(process.cwd(), config.outDir);
227
227
  return config;
228
228
  }
229
- export async function processDefaultConfig(defaultConfig, preUserConfig, mode, cwd) {
229
+ async function processDefaultConfig(defaultConfig, preUserConfig, mode, cwd) {
230
230
  // Apply plugins
231
231
  for (const plugin of [...defaultConfig.plugins, ...preUserConfig.plugins ?? []]) {
232
232
  if (plugin.defaultConfig) {
@@ -238,6 +238,66 @@ export async function processDefaultConfig(defaultConfig, preUserConfig, mode, c
238
238
  }
239
239
  return defaultConfig;
240
240
  }
241
+ export async function processConfig(ctx) {
242
+ const { config, root } = ctx;
243
+ // Resolve files paths
244
+ const resolveFsPath = (file, force = false) => {
245
+ if (force || file.startsWith('./') || file.startsWith('../')) {
246
+ return path.resolve(root, file);
247
+ }
248
+ return file;
249
+ };
250
+ const fileCheck = (file, resolvedFile, configPathForError) => {
251
+ if (!file.startsWith('http') && !file.startsWith('@') && !fs.existsSync(resolvedFile)) {
252
+ console.warn(pc.yellow(`Histoire config: ${configPathForError} file ${file} does not exist (resolved to ${resolvedFile}), check for typos in the paths`));
253
+ }
254
+ };
255
+ config.outDir = resolveFsPath(config.outDir, true);
256
+ // Theme
257
+ if (config.theme?.logo?.square) {
258
+ const file = config.theme.logo.square;
259
+ config.theme.logo.square = resolveFsPath(file);
260
+ fileCheck(file, config.theme.logo.square, 'theme.logo.square');
261
+ }
262
+ if (config.theme?.logo?.light) {
263
+ const file = config.theme.logo.light;
264
+ config.theme.logo.light = resolveFsPath(file);
265
+ fileCheck(file, config.theme.logo.light, 'theme.logo.light');
266
+ }
267
+ if (config.theme?.logo?.dark) {
268
+ const file = config.theme.logo.dark;
269
+ config.theme.logo.dark = resolveFsPath(file);
270
+ fileCheck(file, config.theme.logo.dark, 'theme.logo.dark');
271
+ }
272
+ if (config.theme?.favicon) {
273
+ let file = config.theme.favicon;
274
+ if (file.startsWith('/')) {
275
+ file = file.slice(1);
276
+ }
277
+ if (!file.startsWith('http')) {
278
+ const publicDir = path.resolve(ctx.resolvedViteConfig.root, ctx.resolvedViteConfig.publicDir);
279
+ // Resolve URL path
280
+ if (file.startsWith('./') || file.startsWith('../')) {
281
+ const resolvedFile = resolveFsPath(file, true);
282
+ const relativeFile = path.relative(publicDir, resolvedFile);
283
+ if (relativeFile.startsWith('..')) {
284
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that is not in the vite 'public' directory: ${file} (resolved as ${resolvedFile})`));
285
+ }
286
+ if (!fs.existsSync(resolvedFile)) {
287
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that does not exist: ${file} (resolved as ${resolvedFile})`));
288
+ }
289
+ config.theme.favicon = relativeFile;
290
+ }
291
+ else {
292
+ // Check if URL path is valid
293
+ const resolvedFile = path.resolve(publicDir, file);
294
+ if (!fs.existsSync(resolvedFile)) {
295
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that does not exist: ${file} (resolved as ${resolvedFile}).\nThe favicon file should be placed in the vite 'public' directory.\nExample: if the file is in <project>/public/img/favicon.ico, you can put 'img/favicon.ico' or './public/img/favicon.ico'.`));
296
+ }
297
+ }
298
+ }
299
+ }
300
+ }
241
301
  export function defineConfig(config) {
242
302
  return config;
243
303
  }
@@ -1,5 +1,5 @@
1
1
  import { resolveConfig as resolveViteConfig } from 'vite';
2
- import { resolveConfig } from './config.js';
2
+ import { processConfig, resolveConfig } from './config.js';
3
3
  import { mergeHistoireViteConfig } from './vite.js';
4
4
  export async function createContext(options) {
5
5
  const config = await resolveConfig(process.cwd(), options.mode);
@@ -16,5 +16,6 @@ export async function createContext(options) {
16
16
  markdownFiles: [],
17
17
  };
18
18
  ctx.resolvedViteConfig = await mergeHistoireViteConfig(viteConfig, ctx);
19
+ await processConfig(ctx);
19
20
  return ctx;
20
21
  }
@@ -1,6 +1,6 @@
1
1
  import MarkdownIt from 'markdown-it';
2
2
  import matter from 'gray-matter';
3
- import shiki from 'shiki';
3
+ import { getHighlighter } from 'shiki-es';
4
4
  import anchor from 'markdown-it-anchor';
5
5
  import attrs from 'markdown-it-attrs';
6
6
  import emoji from 'markdown-it-emoji';
@@ -21,7 +21,7 @@ function notifyMarkdownListChange() {
21
21
  }
22
22
  }
23
23
  export async function createMarkdownRenderer(ctx) {
24
- const highlighter = await shiki.getHighlighter({
24
+ const highlighter = await getHighlighter({
25
25
  theme: 'github-dark',
26
26
  });
27
27
  const md = new MarkdownIt({
package/dist/node/vite.js CHANGED
@@ -65,11 +65,12 @@ export async function mergeHistoireViteConfig(viteConfig, ctx) {
65
65
  let flatPlugins = [];
66
66
  if (viteConfig.plugins) {
67
67
  for (const pluginOption of viteConfig.plugins) {
68
- if (Array.isArray(pluginOption)) {
69
- flatPlugins.push(...await Promise.all(pluginOption));
68
+ const resolvedPluginOption = await pluginOption;
69
+ if (Array.isArray(resolvedPluginOption)) {
70
+ flatPlugins.push(...await Promise.all(resolvedPluginOption));
70
71
  }
71
72
  else {
72
- flatPlugins.push(await pluginOption);
73
+ flatPlugins.push(resolvedPluginOption);
73
74
  }
74
75
  }
75
76
  flatPlugins = flatPlugins.filter(Boolean);
@@ -117,7 +118,7 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
117
118
  ],
118
119
  include: optimizeDeps([
119
120
  'flexsearch',
120
- 'shiki',
121
+ 'shiki-es',
121
122
  // Shiki dependencies
122
123
  'vscode-oniguruma',
123
124
  'vscode-textmate',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.11.9",
3
+ "version": "0.12.0",
4
4
  "description": "A fast story book powered by Vite",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,10 +33,10 @@
33
33
  "histoire": "./bin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@histoire/app": "^0.11.9",
37
- "@histoire/controls": "^0.11.9",
38
- "@histoire/shared": "^0.11.9",
39
- "@histoire/vendors": "^0.11.9",
36
+ "@histoire/app": "^0.12.0",
37
+ "@histoire/controls": "^0.12.0",
38
+ "@histoire/shared": "^0.12.0",
39
+ "@histoire/vendors": "^0.12.0",
40
40
  "@types/flexsearch": "^0.7.3",
41
41
  "@types/markdown-it": "^12.2.3",
42
42
  "birpc": "^0.1.1",
@@ -60,13 +60,13 @@
60
60
  "pathe": "^0.2.0",
61
61
  "picocolors": "^1.0.0",
62
62
  "sade": "^1.8.1",
63
- "shiki": "0.11.1",
63
+ "shiki-es": "^0.1.2",
64
64
  "sirv": "^2.0.2",
65
65
  "tinypool": "^0.1.2",
66
- "vite-node": "0.23.4"
66
+ "vite-node": "0.26.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "vite": "^2.9.0 || ^3.0.0"
69
+ "vite": "^2.9.0 || ^3.0.0 || ^4.0.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@peeky/server": "^0.14.0",
@@ -75,9 +75,9 @@
75
75
  "@types/markdown-it": "^12.2.3",
76
76
  "@types/micromatch": "^4.0.2",
77
77
  "@types/node": "^17.0.32",
78
- "rollup": "^2.59.0",
78
+ "rollup": "^3.5.1",
79
79
  "typescript": "^4.7.4",
80
- "vite": "^3.0.5"
80
+ "vite": "^4.0.0"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "rimraf dist && tsc -d",
package/src/node/build.ts CHANGED
@@ -14,11 +14,11 @@ import type {
14
14
  BuildEndCallback,
15
15
  PreviewStoryCallback,
16
16
  } from '@histoire/shared'
17
+ import type { RollupOutput } from 'rollup'
17
18
  import { APP_PATH } from './alias.js'
18
19
  import { Context } from './context.js'
19
20
  import { getViteConfigWithPlugins } from './vite.js'
20
21
  import { findAllStories } from './stories.js'
21
- import type { RollupOutput } from 'rollup'
22
22
  import { useCollectStories } from './collect/index.js'
23
23
  import { BuildPluginApi } from './plugin.js'
24
24
  import { useModuleLoader } from './load.js'
@@ -228,7 +228,7 @@ function generateBaseHtml (head: string, body: string, ctx: Context) {
228
228
  function generateEntryHtml (jsEntryFile: string, cssEntryFile: string, variables: { HEAD?: string }, ctx: Context) {
229
229
  return generateBaseHtml(
230
230
  `<link rel="stylesheet" href="${ctx.resolvedViteConfig.base}${cssEntryFile}">
231
- ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.config.theme.favicon}"/>` : ''}
231
+ ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.resolvedViteConfig.base}${ctx.config.theme.favicon}"/>` : ''}
232
232
  ${variables.HEAD ?? ''}`,
233
233
  `<div id="app"></div>
234
234
  <script type="module" src="${ctx.resolvedViteConfig.base}${jsEntryFile}"></script>`,
@@ -36,9 +36,11 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte
36
36
  transformMode: ctx.config.viteNodeTransformMode,
37
37
  })
38
38
 
39
+ const maxThreads = ctx.config.collectMaxThreads ?? cpus().length
40
+
39
41
  const threadsCount = ctx.mode === 'dev'
40
- ? Math.max(cpus().length / 2, 1)
41
- : Math.max(cpus().length - 1, 1)
42
+ ? Math.max(Math.min(maxThreads, cpus().length / 2), 1)
43
+ : Math.max(Math.min(maxThreads, cpus().length - 1), 1)
42
44
  console.log(pc.blue(`Using ${threadsCount} threads for story collection`))
43
45
 
44
46
  const threadPool = new Tinypool({
@@ -13,10 +13,12 @@ import type {
13
13
  ConfigMode,
14
14
  Plugin,
15
15
  } from '@histoire/shared'
16
+ import fs from 'node:fs'
16
17
  import { defaultColors } from './colors.js'
17
18
  import { findUp } from './util/find-up.js'
18
19
  import { tailwindTokens } from './builtin-plugins/tailwind-tokens.js'
19
20
  import { vanillaSupport } from './builtin-plugins/vanilla-support/plugin.js'
21
+ import type { Context } from './context.js'
20
22
 
21
23
  const __filename = fileURLToPath(import.meta.url)
22
24
 
@@ -232,10 +234,10 @@ export async function resolveConfig (cwd: string = process.cwd(), mode: ConfigMo
232
234
  const preUserConfig = mergeConfig(result, viteHistoireConfig)
233
235
  const processedDefaultConfig = await processDefaultConfig(getDefaultConfig(), preUserConfig, mode, cwd)
234
236
 
235
- return processConfig(mergeConfig(preUserConfig, processedDefaultConfig), mode)
237
+ return resolveConfigPlugins(mergeConfig(preUserConfig, processedDefaultConfig), mode)
236
238
  }
237
239
 
238
- export async function processConfig (config: HistoireConfig, mode: ConfigMode): Promise<HistoireConfig> {
240
+ async function resolveConfigPlugins (config: HistoireConfig, mode: ConfigMode): Promise<HistoireConfig> {
239
241
  for (const plugin of config.plugins) {
240
242
  if (plugin.config) {
241
243
  const result = await plugin.config(config, mode)
@@ -244,11 +246,10 @@ export async function processConfig (config: HistoireConfig, mode: ConfigMode):
244
246
  }
245
247
  }
246
248
  }
247
- config.outDir = path.resolve(process.cwd(), config.outDir)
248
249
  return config
249
250
  }
250
251
 
251
- export async function processDefaultConfig (defaultConfig: HistoireConfig, preUserConfig: HistoireConfig, mode: ConfigMode, cwd: string): Promise<HistoireConfig> {
252
+ async function processDefaultConfig (defaultConfig: HistoireConfig, preUserConfig: HistoireConfig, mode: ConfigMode, cwd: string): Promise<HistoireConfig> {
252
253
  // Apply plugins
253
254
  for (const plugin of [...defaultConfig.plugins, ...preUserConfig.plugins ?? []]) {
254
255
  if (plugin.defaultConfig) {
@@ -261,6 +262,75 @@ export async function processDefaultConfig (defaultConfig: HistoireConfig, preUs
261
262
  return defaultConfig
262
263
  }
263
264
 
265
+ export async function processConfig (ctx: Context) {
266
+ const { config, root } = ctx
267
+
268
+ // Resolve files paths
269
+
270
+ const resolveFsPath = (file: string, force = false) => {
271
+ if (force || file.startsWith('./') || file.startsWith('../')) {
272
+ return path.resolve(root, file)
273
+ }
274
+ return file
275
+ }
276
+
277
+ const fileCheck = (file: string, resolvedFile: string, configPathForError: string) => {
278
+ if (!file.startsWith('http') && !file.startsWith('@') && !fs.existsSync(resolvedFile)) {
279
+ console.warn(pc.yellow(`Histoire config: ${configPathForError} file ${file} does not exist (resolved to ${resolvedFile}), check for typos in the paths`))
280
+ }
281
+ }
282
+
283
+ config.outDir = resolveFsPath(config.outDir, true)
284
+
285
+ // Theme
286
+
287
+ if (config.theme?.logo?.square) {
288
+ const file = config.theme.logo.square
289
+ config.theme.logo.square = resolveFsPath(file)
290
+ fileCheck(file, config.theme.logo.square, 'theme.logo.square')
291
+ }
292
+
293
+ if (config.theme?.logo?.light) {
294
+ const file = config.theme.logo.light
295
+ config.theme.logo.light = resolveFsPath(file)
296
+ fileCheck(file, config.theme.logo.light, 'theme.logo.light')
297
+ }
298
+
299
+ if (config.theme?.logo?.dark) {
300
+ const file = config.theme.logo.dark
301
+ config.theme.logo.dark = resolveFsPath(file)
302
+ fileCheck(file, config.theme.logo.dark, 'theme.logo.dark')
303
+ }
304
+
305
+ if (config.theme?.favicon) {
306
+ let file = config.theme.favicon
307
+ if (file.startsWith('/')) {
308
+ file = file.slice(1)
309
+ }
310
+ if (!file.startsWith('http')) {
311
+ const publicDir = path.resolve(ctx.resolvedViteConfig.root, ctx.resolvedViteConfig.publicDir)
312
+ // Resolve URL path
313
+ if (file.startsWith('./') || file.startsWith('../')) {
314
+ const resolvedFile = resolveFsPath(file, true)
315
+ const relativeFile = path.relative(publicDir, resolvedFile)
316
+ if (relativeFile.startsWith('..')) {
317
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that is not in the vite 'public' directory: ${file} (resolved as ${resolvedFile})`))
318
+ }
319
+ if (!fs.existsSync(resolvedFile)) {
320
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that does not exist: ${file} (resolved as ${resolvedFile})`))
321
+ }
322
+ config.theme.favicon = relativeFile
323
+ } else {
324
+ // Check if URL path is valid
325
+ const resolvedFile = path.resolve(publicDir, file)
326
+ if (!fs.existsSync(resolvedFile)) {
327
+ throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that does not exist: ${file} (resolved as ${resolvedFile}).\nThe favicon file should be placed in the vite 'public' directory.\nExample: if the file is in <project>/public/img/favicon.ico, you can put 'img/favicon.ico' or './public/img/favicon.ico'.`))
328
+ }
329
+ }
330
+ }
331
+ }
332
+ }
333
+
264
334
  export function defineConfig (config: Partial<HistoireConfig>) {
265
335
  return config
266
336
  }
@@ -6,7 +6,7 @@ import type {
6
6
  HistoireConfig,
7
7
  ConfigMode,
8
8
  } from '@histoire/shared'
9
- import { resolveConfig } from './config.js'
9
+ import { processConfig, resolveConfig } from './config.js'
10
10
  import { mergeHistoireViteConfig } from './vite.js'
11
11
 
12
12
  export interface Context {
@@ -42,5 +42,7 @@ export async function createContext (options: CreateContextOptions): Promise<Con
42
42
 
43
43
  ctx.resolvedViteConfig = await mergeHistoireViteConfig(viteConfig as unknown, ctx)
44
44
 
45
+ await processConfig(ctx)
46
+
45
47
  return ctx
46
48
  }
@@ -1,6 +1,6 @@
1
1
  import MarkdownIt from 'markdown-it'
2
2
  import matter from 'gray-matter'
3
- import shiki from 'shiki'
3
+ import { getHighlighter } from 'shiki-es'
4
4
  import anchor from 'markdown-it-anchor'
5
5
  import attrs from 'markdown-it-attrs'
6
6
  import emoji from 'markdown-it-emoji'
@@ -28,7 +28,7 @@ function notifyMarkdownListChange () {
28
28
  }
29
29
 
30
30
  export async function createMarkdownRenderer (ctx: Context) {
31
- const highlighter = await shiki.getHighlighter({
31
+ const highlighter = await getHighlighter({
32
32
  theme: 'github-dark',
33
33
  })
34
34
 
package/src/node/vite.ts CHANGED
@@ -78,10 +78,11 @@ export async function mergeHistoireViteConfig (viteConfig: InlineConfig, ctx: Co
78
78
  let flatPlugins = []
79
79
  if (viteConfig.plugins) {
80
80
  for (const pluginOption of viteConfig.plugins) {
81
- if (Array.isArray(pluginOption)) {
82
- flatPlugins.push(...await Promise.all(pluginOption))
81
+ const resolvedPluginOption = await pluginOption
82
+ if (Array.isArray(resolvedPluginOption)) {
83
+ flatPlugins.push(...await Promise.all(resolvedPluginOption))
83
84
  } else {
84
- flatPlugins.push(await pluginOption)
85
+ flatPlugins.push(resolvedPluginOption)
85
86
  }
86
87
  }
87
88
  flatPlugins = flatPlugins.filter(Boolean)
@@ -141,7 +142,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
141
142
  ],
142
143
  include: optimizeDeps([
143
144
  'flexsearch',
144
- 'shiki',
145
+ 'shiki-es',
145
146
  // Shiki dependencies
146
147
  'vscode-oniguruma',
147
148
  'vscode-textmate',