From c57d387e1af3e8437a8557b7f00a67a0a817f2b4 Mon Sep 17 00:00:00 2001 From: Gabriel Grubba <70247653+Grubba27@users.noreply.github.com> Date: Thu, 21 Dec 2023 17:14:22 -0300 Subject: [PATCH] finished meteor core --- v3-docs/docs/.vitepress/config.mts | 13 ++++++++- v3-docs/docs/api/meteor.md | 12 ++++++++ v3-docs/docs/components/helpers/Functions.vue | 29 ++++++++++--------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/v3-docs/docs/.vitepress/config.mts b/v3-docs/docs/.vitepress/config.mts index c1a16307cf..bc8653d3df 100644 --- a/v3-docs/docs/.vitepress/config.mts +++ b/v3-docs/docs/.vitepress/config.mts @@ -23,7 +23,14 @@ export default defineConfig({ { text: "API map", link: "/api/index" }, { text: "Runtime API Examples", link: "/api-examples" }, { text: "Accounts", link: "/api/accounts" }, - { text: "Meteor", link: "/api/meteor" }, + { + text: "Meteor", + link: "/api/meteor", + items: [ + { text: "Core", link: "/api/meteor#core" }, + { text: "Methods", link: "/api/meteor#methods" }, + ], + }, ], }, ], @@ -39,5 +46,9 @@ export default defineConfig({ copyright: 'Copyright (c) 2011 - present Meteor Software.', }, + editLink: { + pattern: 'https://github.com/meteor/meteor/edit/main/v3-docs/docs/:path', + text: 'Edit this page on GitHub' + } }, }); diff --git a/v3-docs/docs/api/meteor.md b/v3-docs/docs/api/meteor.md index 489f999653..383b515fbd 100644 --- a/v3-docs/docs/api/meteor.md +++ b/v3-docs/docs/api/meteor.md @@ -2,6 +2,9 @@ Meteor global object has many functions and properties for handling utilities, network and much more. + +### Core APIs {#core} + On a server, the function will run as soon as the server process is @@ -51,6 +54,11 @@ Meteor.startup(() => { ::: + + + + + @@ -70,3 +78,7 @@ should be kept in the `server` directory. + + + +### Method APIs {#methods} diff --git a/v3-docs/docs/components/helpers/Functions.vue b/v3-docs/docs/components/helpers/Functions.vue index 4d56117f3b..2a7b714da3 100644 --- a/v3-docs/docs/components/helpers/Functions.vue +++ b/v3-docs/docs/components/helpers/Functions.vue @@ -15,7 +15,7 @@ const props = defineProps<{ optional: boolean; }[]; }>() -const removeTags = (str) => str.replace(/<[^>]*>?/gm, '') +const removeTags = (str) => str?.replace(/<[^>]*>?/gm, '') const primitiveMap = { function: '{Function}', @@ -33,27 +33,30 @@ const primitiveDefault = { Object: ' {}', } -const makePrimitiveHTML = (primitive, index) => { - if (index === 0) { - return primitiveDefault[primitive] + ``; - } - return primitiveDefault[primitive] + `,`; +const comma = `,` +const br = `
`; +const comment = ` // this param is optional ` + +const line = ({ html, pre, post } = { pre: '', post: '', html: '' }) => `${pre}${html}${post}` +const makePrimitiveHTML = (primitive, arr, index, isComment) => { + if (arr.length > 1) return line( + { + html: primitiveDefault[primitive] + `${comma}`, + pre: index === 0 ? '' : br, + post: isComment ? comment : '', + } + ); + return primitiveDefault[primitive] + ``; } -const wrapInOptional = (optionalParam) => { - return `[${optionalParam}]` -}