@vuepress/client 2.0.0-beta.49 → 2.0.0-beta.50-pre.1

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/dist/app.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  usePageHead,
16
16
  usePageLang,
17
17
  withBase
18
- } from "./chunk-OOQFWU6B.js";
18
+ } from "./chunk-V3MKNX2O.js";
19
19
 
20
20
  // src/app.ts
21
21
  import { clientConfigs } from "@internal/clientConfigs";
@@ -34,24 +34,30 @@ import {
34
34
 
35
35
  // src/routes.ts
36
36
  import { pagesRoutes } from "@internal/pagesRoutes";
37
- var createRoutes = () => pagesRoutes.reduce((result, [name, path, meta, redirects]) => {
38
- result.push({
39
- name,
40
- path,
41
- component: Vuepress,
42
- meta
43
- }, ...redirects.map((item) => ({
44
- path: item,
45
- redirect: path
46
- })));
47
- return result;
48
- }, [
49
- {
50
- name: "404",
51
- path: "/:catchAll(.*)",
52
- component: Vuepress
53
- }
54
- ]);
37
+ var createRoutes = () => pagesRoutes.reduce(
38
+ (result, [name, path, meta, redirects]) => {
39
+ result.push(
40
+ {
41
+ name,
42
+ path,
43
+ component: Vuepress,
44
+ meta
45
+ },
46
+ ...redirects.map((item) => ({
47
+ path: item,
48
+ redirect: path
49
+ }))
50
+ );
51
+ return result;
52
+ },
53
+ [
54
+ {
55
+ name: "404",
56
+ path: "/:catchAll(.*)",
57
+ component: Vuepress
58
+ }
59
+ ]
60
+ );
55
61
 
56
62
  // src/router.ts
57
63
  var historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;
@@ -79,30 +85,6 @@ var createVueRouter = () => {
79
85
  return router;
80
86
  };
81
87
 
82
- // src/setupDevtools.ts
83
- import { setupDevtoolsPlugin } from "@vue/devtools-api";
84
- var COMPONENT_STATE_TYPE = "VuePress";
85
- var setupDevtools = (app, globalComputed) => {
86
- setupDevtoolsPlugin({
87
- app,
88
- id: "org.vuejs.vuepress",
89
- label: "VuePress",
90
- packageName: "@vuepress/client",
91
- homepage: "https://v2.vuepress.vuejs.org",
92
- logo: "https://v2.vuepress.vuejs.org/images/hero.png",
93
- componentStateTypes: [COMPONENT_STATE_TYPE]
94
- }, (api) => {
95
- api.on.inspectComponent((payload) => {
96
- payload.instanceData.state.push(...Object.entries(globalComputed).map(([name, item]) => ({
97
- type: COMPONENT_STATE_TYPE,
98
- key: name,
99
- editable: false,
100
- value: item.value
101
- })));
102
- });
103
- });
104
- };
105
-
106
88
  // src/setupGlobalComponents.ts
107
89
  var setupGlobalComponents = (app) => {
108
90
  app.component("ClientOnly", ClientOnly);
@@ -112,11 +94,28 @@ var setupGlobalComponents = (app) => {
112
94
  // src/setupGlobalComputed.ts
113
95
  import { computed } from "vue";
114
96
  var setupGlobalComputed = (app, router) => {
115
- const routeLocale = computed(() => resolvers.resolveRouteLocale(siteData.value.locales, router.currentRoute.value.path));
116
- const siteLocaleData = computed(() => resolvers.resolveSiteLocaleData(siteData.value, routeLocale.value));
117
- const pageFrontmatter = computed(() => resolvers.resolvePageFrontmatter(pageData.value));
118
- const pageHeadTitle = computed(() => resolvers.resolvePageHeadTitle(pageData.value, siteLocaleData.value));
119
- const pageHead = computed(() => resolvers.resolvePageHead(pageHeadTitle.value, pageFrontmatter.value, siteLocaleData.value));
97
+ const routeLocale = computed(
98
+ () => resolvers.resolveRouteLocale(
99
+ siteData.value.locales,
100
+ router.currentRoute.value.path
101
+ )
102
+ );
103
+ const siteLocaleData = computed(
104
+ () => resolvers.resolveSiteLocaleData(siteData.value, routeLocale.value)
105
+ );
106
+ const pageFrontmatter = computed(
107
+ () => resolvers.resolvePageFrontmatter(pageData.value)
108
+ );
109
+ const pageHeadTitle = computed(
110
+ () => resolvers.resolvePageHeadTitle(pageData.value, siteLocaleData.value)
111
+ );
112
+ const pageHead = computed(
113
+ () => resolvers.resolvePageHead(
114
+ pageHeadTitle.value,
115
+ pageFrontmatter.value,
116
+ siteLocaleData.value
117
+ )
118
+ );
120
119
  const pageLang = computed(() => resolvers.resolvePageLang(pageData.value));
121
120
  app.provide(routeLocaleSymbol, routeLocale);
122
121
  app.provide(siteLocaleDataSymbol, siteLocaleData);
@@ -192,7 +191,10 @@ var setupUpdateHead = () => {
192
191
  onMounted(() => {
193
192
  loadHead();
194
193
  updateHead();
195
- watch(() => __VUEPRESS_DEV__ ? head.value : route.path, () => updateHead());
194
+ watch(
195
+ () => __VUEPRESS_DEV__ ? head.value : route.path,
196
+ () => updateHead()
197
+ );
196
198
  });
197
199
  };
198
200
  var queryHeadTag = ([
@@ -250,7 +252,9 @@ var createVueApp = async () => {
250
252
  }
251
253
  return () => [
252
254
  h(RouterView),
253
- ...clientConfigs.flatMap(({ rootComponents = [] }) => rootComponents.map((component) => h(component)))
255
+ ...clientConfigs.flatMap(
256
+ ({ rootComponents = [] }) => rootComponents.map((component) => h(component))
257
+ )
254
258
  ];
255
259
  }
256
260
  });
@@ -258,6 +262,7 @@ var createVueApp = async () => {
258
262
  setupGlobalComponents(app);
259
263
  const globalComputed = setupGlobalComputed(app, router);
260
264
  if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
265
+ const { setupDevtools } = await import("./setupDevtools-EXVHPMXB.js");
261
266
  setupDevtools(app, globalComputed);
262
267
  }
263
268
  for (const clientConfig of clientConfigs) {
@@ -28,7 +28,9 @@ if (import.meta.webpackHot || import.meta.hot) {
28
28
 
29
29
  // src/composables/pageFrontmatter.ts
30
30
  import { inject } from "vue";
31
- var pageFrontmatterSymbol = Symbol(__VUEPRESS_DEV__ ? "pageFrontmatter" : "");
31
+ var pageFrontmatterSymbol = Symbol(
32
+ __VUEPRESS_DEV__ ? "pageFrontmatter" : ""
33
+ );
32
34
  var usePageFrontmatter = () => {
33
35
  const pageFrontmatter = inject(pageFrontmatterSymbol);
34
36
  if (!pageFrontmatter) {
@@ -39,7 +41,9 @@ var usePageFrontmatter = () => {
39
41
 
40
42
  // src/composables/pageHead.ts
41
43
  import { inject as inject2 } from "vue";
42
- var pageHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "pageHead" : "");
44
+ var pageHeadSymbol = Symbol(
45
+ __VUEPRESS_DEV__ ? "pageHead" : ""
46
+ );
43
47
  var usePageHead = () => {
44
48
  const pageHead = inject2(pageHeadSymbol);
45
49
  if (!pageHead) {
@@ -50,7 +54,9 @@ var usePageHead = () => {
50
54
 
51
55
  // src/composables/pageHeadTitle.ts
52
56
  import { inject as inject3 } from "vue";
53
- var pageHeadTitleSymbol = Symbol(__VUEPRESS_DEV__ ? "pageHeadTitle" : "");
57
+ var pageHeadTitleSymbol = Symbol(
58
+ __VUEPRESS_DEV__ ? "pageHeadTitle" : ""
59
+ );
54
60
  var usePageHeadTitle = () => {
55
61
  const pageHeadTitle = inject3(pageHeadTitleSymbol);
56
62
  if (!pageHeadTitle) {
@@ -61,7 +67,9 @@ var usePageHeadTitle = () => {
61
67
 
62
68
  // src/composables/pageLang.ts
63
69
  import { inject as inject4 } from "vue";
64
- var pageLangSymbol = Symbol(__VUEPRESS_DEV__ ? "pageLang" : "");
70
+ var pageLangSymbol = Symbol(
71
+ __VUEPRESS_DEV__ ? "pageLang" : ""
72
+ );
65
73
  var usePageLang = () => {
66
74
  const pageLang = inject4(pageLangSymbol);
67
75
  if (!pageLang) {
@@ -72,7 +80,9 @@ var usePageLang = () => {
72
80
 
73
81
  // src/composables/routeLocale.ts
74
82
  import { inject as inject5 } from "vue";
75
- var routeLocaleSymbol = Symbol(__VUEPRESS_DEV__ ? "routeLocale" : "");
83
+ var routeLocaleSymbol = Symbol(
84
+ __VUEPRESS_DEV__ ? "routeLocale" : ""
85
+ );
76
86
  var useRouteLocale = () => {
77
87
  const routeLocale = inject5(routeLocaleSymbol);
78
88
  if (!routeLocale) {
@@ -94,7 +104,9 @@ if (import.meta.webpackHot || import.meta.hot) {
94
104
 
95
105
  // src/composables/siteLocaleData.ts
96
106
  import { inject as inject6 } from "vue";
97
- var siteLocaleDataSymbol = Symbol(__VUEPRESS_DEV__ ? "siteLocaleData" : "");
107
+ var siteLocaleDataSymbol = Symbol(
108
+ __VUEPRESS_DEV__ ? "siteLocaleData" : ""
109
+ );
98
110
  var useSiteLocaleData = () => {
99
111
  const siteLocaleData = inject6(siteLocaleDataSymbol);
100
112
  if (!siteLocaleData) {
@@ -105,7 +117,9 @@ var useSiteLocaleData = () => {
105
117
 
106
118
  // src/composables/updateHead.ts
107
119
  import { inject as inject7 } from "vue";
108
- var updateHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "updateHead" : "");
120
+ var updateHeadSymbol = Symbol(
121
+ __VUEPRESS_DEV__ ? "updateHead" : ""
122
+ );
109
123
  var useUpdateHead = () => {
110
124
  const updateHead = inject7(updateHeadSymbol);
111
125
  if (!updateHead) {
@@ -175,8 +189,13 @@ var Content = defineComponent2({
175
189
  },
176
190
  setup(props) {
177
191
  const page = usePageData();
178
- const pageComponent = computed(() => pagesComponents[props.pageKey || page.value.key]);
179
- return () => pageComponent.value ? h(pageComponent.value) : h("div", __VUEPRESS_DEV__ ? "Page does not exist. This is a fallback content." : "404 Not Found");
192
+ const pageComponent = computed(
193
+ () => pagesComponents[props.pageKey || page.value.key]
194
+ );
195
+ return () => pageComponent.value ? h(pageComponent.value) : h(
196
+ "div",
197
+ __VUEPRESS_DEV__ ? "Page does not exist. This is a fallback content." : "404 Not Found"
198
+ );
180
199
  }
181
200
  });
182
201
 
package/dist/index.d.ts CHANGED
@@ -3,7 +3,38 @@ export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/share
3
3
  import * as vue from 'vue';
4
4
  import { Ref, ComputedRef, InjectionKey, App, Component } from 'vue';
5
5
  import { Router, RouteMeta } from 'vue-router';
6
- export { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
6
+
7
+ declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
8
+ [key: string]: any;
9
+ }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
10
+
11
+ /**
12
+ * Markdown rendered content
13
+ */
14
+ declare const Content: vue.DefineComponent<{
15
+ pageKey: {
16
+ type: StringConstructor;
17
+ required: false;
18
+ default: string;
19
+ };
20
+ }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
21
+ [key: string]: any;
22
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
23
+ pageKey: {
24
+ type: StringConstructor;
25
+ required: false;
26
+ default: string;
27
+ };
28
+ }>>, {
29
+ pageKey: string;
30
+ }>;
31
+
32
+ /**
33
+ * Global Layout
34
+ */
35
+ declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
36
+ [key: string]: any;
37
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
7
38
 
8
39
  /**
9
40
  * Ref wrapper of `PageData`
@@ -189,6 +220,11 @@ interface ClientConfig {
189
220
  rootComponents?: Component[];
190
221
  }
191
222
 
223
+ declare type CreateVueAppFunction = () => Promise<{
224
+ app: App;
225
+ router: Router;
226
+ }>;
227
+
192
228
  declare type PageRouteItem = [
193
229
  name: string,
194
230
  path: string,
@@ -196,38 +232,6 @@ declare type PageRouteItem = [
196
232
  redirects: string[]
197
233
  ];
198
234
 
199
- declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
200
- [key: string]: any;
201
- }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
202
-
203
- /**
204
- * Markdown rendered content
205
- */
206
- declare const Content: vue.DefineComponent<{
207
- pageKey: {
208
- type: StringConstructor;
209
- required: false;
210
- default: string;
211
- };
212
- }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
213
- [key: string]: any;
214
- }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
215
- pageKey: {
216
- type: StringConstructor;
217
- required: false;
218
- default: string;
219
- };
220
- }>>, {
221
- pageKey: string;
222
- }>;
223
-
224
- /**
225
- * Global Layout
226
- */
227
- declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
228
- [key: string]: any;
229
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
230
-
231
235
  /**
232
236
  * A helper function to help you define vuepress client config file
233
237
  */
@@ -253,4 +257,4 @@ declare const resolvers: {
253
257
  */
254
258
  declare const withBase: (url: string) => string;
255
259
 
256
- export { ClientConfig, ClientOnly, Content, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PageRouteItem, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, Vuepress, defineClientConfig, pageData, pageDataEmpty, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
260
+ export { ClientConfig, ClientOnly, Content, CreateVueAppFunction, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PageRouteItem, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, Vuepress, defineClientConfig, pageData, pageDataEmpty, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  useSiteLocaleData,
26
26
  useUpdateHead,
27
27
  withBase
28
- } from "./chunk-OOQFWU6B.js";
28
+ } from "./chunk-V3MKNX2O.js";
29
29
 
30
30
  // src/helpers/defineClientConfig.ts
31
31
  var defineClientConfig = (clientConfig) => clientConfig;
@@ -0,0 +1,88 @@
1
+ // src/setupDevtools.ts
2
+ import { setupDevtoolsPlugin } from "@vue/devtools-api";
3
+ import { watch } from "vue";
4
+ var PLUGIN_ID = "org.vuejs.vuepress";
5
+ var PLUGIN_LABEL = "VuePress";
6
+ var PLUGIN_COMPONENT_STATE_TYPE = PLUGIN_LABEL;
7
+ var INSPECTOR_ID = PLUGIN_ID;
8
+ var INSPECTOR_LABEL = PLUGIN_LABEL;
9
+ var INSPECTOR_GLOBAL_COMPUTED_ID = "global-computed";
10
+ var INSPECTOR_GLOBAL_COMPUTED_LABEL = "Global Computed";
11
+ var setupDevtools = (app, globalComputed) => {
12
+ setupDevtoolsPlugin(
13
+ {
14
+ app,
15
+ id: PLUGIN_ID,
16
+ label: PLUGIN_LABEL,
17
+ packageName: "@vuepress/client",
18
+ homepage: "https://v2.vuepress.vuejs.org",
19
+ logo: "https://v2.vuepress.vuejs.org/images/hero.png",
20
+ componentStateTypes: [PLUGIN_COMPONENT_STATE_TYPE]
21
+ },
22
+ (api) => {
23
+ const globalComputedEntries = Object.entries(globalComputed);
24
+ const globalComputedKeys = Object.keys(globalComputed);
25
+ const globalComputedValues = Object.values(globalComputed);
26
+ api.on.inspectComponent((payload) => {
27
+ payload.instanceData.state.push(
28
+ ...globalComputedEntries.map(([name, item]) => ({
29
+ type: PLUGIN_COMPONENT_STATE_TYPE,
30
+ editable: false,
31
+ key: name,
32
+ value: item.value
33
+ }))
34
+ );
35
+ });
36
+ api.addInspector({
37
+ id: INSPECTOR_ID,
38
+ label: INSPECTOR_LABEL,
39
+ icon: "article"
40
+ });
41
+ api.on.getInspectorTree((payload) => {
42
+ if (payload.inspectorId !== INSPECTOR_ID)
43
+ return;
44
+ payload.rootNodes = [
45
+ {
46
+ id: INSPECTOR_GLOBAL_COMPUTED_ID,
47
+ label: INSPECTOR_GLOBAL_COMPUTED_LABEL,
48
+ children: globalComputedKeys.map((name) => ({
49
+ id: name,
50
+ label: name
51
+ }))
52
+ }
53
+ ];
54
+ });
55
+ api.on.getInspectorState((payload) => {
56
+ if (payload.inspectorId !== INSPECTOR_ID)
57
+ return;
58
+ if (payload.nodeId === INSPECTOR_GLOBAL_COMPUTED_ID) {
59
+ payload.state = {
60
+ [INSPECTOR_GLOBAL_COMPUTED_LABEL]: globalComputedEntries.map(
61
+ ([name, item]) => ({
62
+ key: name,
63
+ value: item.value
64
+ })
65
+ )
66
+ };
67
+ }
68
+ if (globalComputedKeys.includes(payload.nodeId)) {
69
+ payload.state = {
70
+ [INSPECTOR_GLOBAL_COMPUTED_LABEL]: [
71
+ {
72
+ key: payload.nodeId,
73
+ value: globalComputed[payload.nodeId].value
74
+ }
75
+ ]
76
+ };
77
+ }
78
+ });
79
+ watch(globalComputedValues, () => {
80
+ api.notifyComponentUpdate();
81
+ api.sendInspectorState(INSPECTOR_ID);
82
+ });
83
+ }
84
+ );
85
+ };
86
+ export {
87
+ setupDevtools
88
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/client",
3
- "version": "2.0.0-beta.49",
3
+ "version": "2.0.0-beta.50-pre.1",
4
4
  "description": "Client package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -33,22 +33,20 @@
33
33
  "types.d.ts"
34
34
  ],
35
35
  "dependencies": {
36
- "@vue/devtools-api": "^6.2.0",
37
- "@vuepress/shared": "2.0.0-beta.49",
36
+ "@vue/devtools-api": "^6.2.1",
37
+ "@vuepress/shared": "2.0.0-beta.50-pre.1",
38
38
  "vue": "^3.2.37",
39
- "vue-router": "^4.1.2"
39
+ "vue-router": "^4.1.3"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
44
  "tsup": {
45
45
  "clean": true,
46
- "dts": [
47
- "src/index.ts"
48
- ],
46
+ "dts": "./src/index.ts",
49
47
  "entry": [
50
- "src/app.ts",
51
- "src/index.ts"
48
+ "./src/app.ts",
49
+ "./src/index.ts"
52
50
  ],
53
51
  "external": [
54
52
  "@internal/clientConfigs",
@@ -61,10 +59,10 @@
61
59
  "format": [
62
60
  "esm"
63
61
  ],
64
- "outDir": "dist",
62
+ "outDir": "./dist",
65
63
  "sourcemap": false,
66
64
  "target": "es2020",
67
- "tsconfig": "tsconfig.dts.json"
65
+ "tsconfig": "./tsconfig.dts.json"
68
66
  },
69
67
  "scripts": {
70
68
  "build": "tsup",
package/dist/app.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
2
- import 'vue';
3
- import 'vue-router';
4
-
5
- declare const createVueApp: CreateVueAppFunction;
6
-
7
- export { createVueApp };
@@ -1,9 +0,0 @@
1
- import { App } from 'vue';
2
- import { Router } from 'vue-router';
3
-
4
- declare type CreateVueAppFunction = () => Promise<{
5
- app: App;
6
- router: Router;
7
- }>;
8
-
9
- export { CreateVueAppFunction as C };