From d5daaf31a6466f9924fdd895df2e6e86bfff5fa7 Mon Sep 17 00:00:00 2001 From: vanyauhalin Date: Tue, 3 Dec 2024 18:55:52 +0400 Subject: [PATCH] temp: add docspace-sdk-js-resource to site --- pnpm-lock.yaml | 3 ++ site/package.json | 1 + site/pages/DocSpace/JavaScript SDK/Test/g.tsx | 7 +++++ .../DocSpace/JavaScript SDK/Test/index.md | 0 site/resources/docspace-sdk-js.ts | 31 +++++++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 site/pages/DocSpace/JavaScript SDK/Test/g.tsx create mode 100644 site/pages/DocSpace/JavaScript SDK/Test/index.md create mode 100644 site/resources/docspace-sdk-js.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ceb67859..f8be8f22f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4448,6 +4448,9 @@ importers: '@onlyoffice/docspace-resource': specifier: workspace:^ version: link:../packages/docspace-resource + '@onlyoffice/docspace-sdk-js-resource': + specifier: workspace:^ + version: link:../packages/docspace-sdk-js-resource '@onlyoffice/document-builder-hast-element': specifier: workspace:^ version: link:../packages/document-builder-hast-element diff --git a/site/package.json b/site/package.json index 359c38b98..b7e45674a 100644 --- a/site/package.json +++ b/site/package.json @@ -26,6 +26,7 @@ "@onlyoffice/docspace-hosted-solutions-resource": "workspace:^", "@onlyoffice/docspace-plugin-sdk-resource": "workspace:^", "@onlyoffice/docspace-resource": "workspace:^", + "@onlyoffice/docspace-sdk-js-resource": "workspace:^", "@onlyoffice/document-builder-hast-element": "workspace:^", "@onlyoffice/document-builder-html-element": "workspace:^", "@onlyoffice/document-builder-resource": "workspace:^", diff --git a/site/pages/DocSpace/JavaScript SDK/Test/g.tsx b/site/pages/DocSpace/JavaScript SDK/Test/g.tsx new file mode 100644 index 000000000..7fde57152 --- /dev/null +++ b/site/pages/DocSpace/JavaScript SDK/Test/g.tsx @@ -0,0 +1,7 @@ +import {type Data} from "@onlyoffice/eleventy-types" +import * as g from "@/generations/library-next.ts" +import {Resource} from "@/resources/docspace-sdk-js.ts" + +export function data(): Data { + return g.data(Resource.shared) +} diff --git a/site/pages/DocSpace/JavaScript SDK/Test/index.md b/site/pages/DocSpace/JavaScript SDK/Test/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/site/resources/docspace-sdk-js.ts b/site/resources/docspace-sdk-js.ts new file mode 100644 index 000000000..55b885ff1 --- /dev/null +++ b/site/resources/docspace-sdk-js.ts @@ -0,0 +1,31 @@ +import {Resource as S} from "@onlyoffice/docspace-sdk-js-resource" +import {isBuild} from "@onlyoffice/eleventy-env" +import {Resource as F} from "@onlyoffice/fixture-resource/typedoc.ts" + +export const Resource = r() + +type T = typeof S | typeof F +type I = T["shared"] + +function r(): T { + const T = t() + f(T.shared) + return T +} + +function t(): T { + if (isBuild()) { + return S + } + return F +} + +function f(r: I): void { + const e = r.retrieve(0) + + if (e.type !== "declaration") { + throw new Error(`Root entity must be a declaration: ${e.type}`) + } + + e.declaration.name = "SDK" +}