@tutorialkit-rb/astro 1.5.2-rb.0.1.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.
- package/README.md +14 -0
- package/dist/default/components/DownloadButton.tsx +44 -0
- package/dist/default/components/HeadTags.astro +3 -0
- package/dist/default/components/LoginButton.tsx +55 -0
- package/dist/default/components/Logo.astro +30 -0
- package/dist/default/components/MainContainer.astro +86 -0
- package/dist/default/components/MetaTags.astro +44 -0
- package/dist/default/components/MobileContentToggle.astro +44 -0
- package/dist/default/components/NavCard.astro +23 -0
- package/dist/default/components/NavWrapper.tsx +11 -0
- package/dist/default/components/OpenInStackblitzLink.tsx +37 -0
- package/dist/default/components/PageLoadingIndicator.astro +66 -0
- package/dist/default/components/ResizablePanel.astro +247 -0
- package/dist/default/components/ThemeSwitch.tsx +24 -0
- package/dist/default/components/TopBar.astro +20 -0
- package/dist/default/components/TopBarWrapper.astro +30 -0
- package/dist/default/components/TutorialContent.astro +48 -0
- package/dist/default/components/WorkspacePanelWrapper.tsx +25 -0
- package/dist/default/components/setup.ts +20 -0
- package/dist/default/components/webcontainer.ts +46 -0
- package/dist/default/env-default.d.ts +19 -0
- package/dist/default/layouts/Layout.astro +98 -0
- package/dist/default/pages/[...slug].astro +39 -0
- package/dist/default/pages/index.astro +25 -0
- package/dist/default/stores/auth-store.ts +6 -0
- package/dist/default/stores/theme-store.ts +32 -0
- package/dist/default/stores/view-store.ts +5 -0
- package/dist/default/styles/base.css +11 -0
- package/dist/default/styles/markdown.css +400 -0
- package/dist/default/styles/panel.css +7 -0
- package/dist/default/styles/variables.css +396 -0
- package/dist/default/utils/constants.ts +6 -0
- package/dist/default/utils/content/files-ref.ts +25 -0
- package/dist/default/utils/content/squash.ts +37 -0
- package/dist/default/utils/content.ts +446 -0
- package/dist/default/utils/logger.ts +56 -0
- package/dist/default/utils/logo.ts +17 -0
- package/dist/default/utils/nav.ts +65 -0
- package/dist/default/utils/publicAsset.ts +27 -0
- package/dist/default/utils/routes.ts +34 -0
- package/dist/default/utils/url.ts +22 -0
- package/dist/default/utils/workspace.ts +31 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +972 -0
- package/dist/integrations.d.ts +10 -0
- package/dist/remark/callouts.d.ts +3 -0
- package/dist/remark/import-file.d.ts +7 -0
- package/dist/remark/index.d.ts +2 -0
- package/dist/types.d.ts +9 -0
- package/dist/utils.d.ts +2 -0
- package/dist/vite-plugins/core.d.ts +2 -0
- package/dist/vite-plugins/css.d.ts +4 -0
- package/dist/vite-plugins/override-components.d.ts +78 -0
- package/dist/vite-plugins/store.d.ts +2 -0
- package/dist/webcontainer-files/cache.d.ts +21 -0
- package/dist/webcontainer-files/cache.spec.d.ts +1 -0
- package/dist/webcontainer-files/constants.d.ts +4 -0
- package/dist/webcontainer-files/filesmap.d.ts +38 -0
- package/dist/webcontainer-files/filesmap.spec.d.ts +1 -0
- package/dist/webcontainer-files/index.d.ts +8 -0
- package/dist/webcontainer-files/utils.d.ts +6 -0
- package/package.json +85 -0
- package/types.d.ts +12 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ExpressiveCodePlugin } from 'astro-expressive-code';
|
|
2
|
+
export declare function extraIntegrations({ root, expressiveCodePlugins, }: {
|
|
3
|
+
root: string;
|
|
4
|
+
expressiveCodePlugins?: ExpressiveCodePlugin[];
|
|
5
|
+
}): (import("astro").AstroIntegration | {
|
|
6
|
+
name: string;
|
|
7
|
+
hooks: {
|
|
8
|
+
"astro:config:setup": (args: unknown) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
})[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
import type { Transformer } from 'unified';
|
|
3
|
+
interface RemarkImportFilePluginOptions {
|
|
4
|
+
templatesPath: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function remarkImportFilePlugin(options: RemarkImportFilePluginOptions): () => Transformer<Root>;
|
|
7
|
+
export {};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro';
|
|
2
|
+
export type AstroConfigSetupOptions = Parameters<NonNullable<AstroIntegration['hooks']['astro:config:setup']>>[0];
|
|
3
|
+
export type AstroServerSetupOptions = Parameters<Required<AstroIntegration['hooks']>['astro:server:setup']>['0'];
|
|
4
|
+
export type AstroBuildDoneOptions = Parameters<Required<AstroIntegration['hooks']>['astro:build:done']>['0'];
|
|
5
|
+
export type ViteDevServer = AstroServerSetupOptions['server'];
|
|
6
|
+
export type VitePlugin = ViteDevServer['config']['plugins'][0];
|
|
7
|
+
export type Files = Record<string, string | {
|
|
8
|
+
base64: string;
|
|
9
|
+
}>;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plugin that lets users override TutorialKit's components.
|
|
3
|
+
*
|
|
4
|
+
* The virtual module can be imported as:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { TopBar } from 'tutorialkit:override-components';
|
|
8
|
+
*
|
|
9
|
+
* <TopBar />
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* User can override the components in `astro.config.ts`:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* export default defineConfig({
|
|
16
|
+
* integrations: [
|
|
17
|
+
* tutorialkit({
|
|
18
|
+
* components: {
|
|
19
|
+
* TopBar: './CustomTopBar.astro',
|
|
20
|
+
* Dialog: './CustomDialog.tsx',
|
|
21
|
+
* HeadTags: './CustomHeadLinks.astro',
|
|
22
|
+
* },
|
|
23
|
+
* }),
|
|
24
|
+
* ],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
import type { VitePlugin } from '../types.js';
|
|
29
|
+
export interface OverrideComponentsOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Component for overriding the top bar.
|
|
32
|
+
*
|
|
33
|
+
* This component has slots that are used to pass TutorialKit's default components:
|
|
34
|
+
* - `logo`: Logo of the application
|
|
35
|
+
* - `open-in-stackblitz-link`: Link for opening current lesson in StackBlitz
|
|
36
|
+
* - `theme-switch`: Switch for changing the theme
|
|
37
|
+
* - `login-button`: For StackBlitz Enterprise user, the login button
|
|
38
|
+
*
|
|
39
|
+
* Usage:
|
|
40
|
+
*
|
|
41
|
+
* ```jsx
|
|
42
|
+
* <slot name="logo" />
|
|
43
|
+
* <slot name="open-in-stackblitz-link" />
|
|
44
|
+
* <slot name="theme-switch" />
|
|
45
|
+
* <slot name="login-button" />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
TopBar?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Component for overriding confirmation dialogs.
|
|
51
|
+
*
|
|
52
|
+
* This component has to be a React component and be the default export of that module.
|
|
53
|
+
* It will receive same props that `@tutorialkit-rb/react/dialog` supports.
|
|
54
|
+
*/
|
|
55
|
+
Dialog?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Component for overriding title, links and metadata in the `<head>` tag.
|
|
58
|
+
*
|
|
59
|
+
* This component has slots that are used to pass TutorialKit's default tags:
|
|
60
|
+
*
|
|
61
|
+
* - `title`: The page title
|
|
62
|
+
* - `links`: Links for the favicon, fonts and other assets
|
|
63
|
+
* - `meta`: Metadata and Open Graph tags
|
|
64
|
+
*
|
|
65
|
+
* ```jsx
|
|
66
|
+
* <slot name="title" />
|
|
67
|
+
* <slot name="links" />
|
|
68
|
+
* <slot name="meta" />
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
HeadTags?: string;
|
|
72
|
+
}
|
|
73
|
+
interface Options {
|
|
74
|
+
components?: OverrideComponentsOptions;
|
|
75
|
+
defaultRoutes: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare function overrideComponents({ components, defaultRoutes }: Options): VitePlugin;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AstroIntegrationLogger } from 'astro';
|
|
2
|
+
import type { ViteDevServer } from '../types.js';
|
|
3
|
+
import { FilesMapGraph } from './filesmap.js';
|
|
4
|
+
import { type ContentDirs } from './utils.js';
|
|
5
|
+
export declare class FilesMapCache {
|
|
6
|
+
private _filesMapGraph;
|
|
7
|
+
private _logger;
|
|
8
|
+
private _server;
|
|
9
|
+
private _dirs;
|
|
10
|
+
private _cache;
|
|
11
|
+
private _requestsQueue;
|
|
12
|
+
private _readiness;
|
|
13
|
+
private _resolve;
|
|
14
|
+
private _hotPaths;
|
|
15
|
+
private _timeoutId;
|
|
16
|
+
constructor(_filesMapGraph: FilesMapGraph, _logger: AstroIntegrationLogger, _server: ViteDevServer, _dirs: ContentDirs);
|
|
17
|
+
generateFileMapForPath(filePath: string): void;
|
|
18
|
+
canHandle(reqURL: string | undefined): Promise<string | false>;
|
|
19
|
+
private _invalidateCacheForDependencies;
|
|
20
|
+
private _generateFileMaps;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AstroIntegrationLogger } from 'astro';
|
|
2
|
+
import type { Files } from '../types';
|
|
3
|
+
export declare class FilesMapGraph {
|
|
4
|
+
private _nodes;
|
|
5
|
+
constructor(_nodes?: Map<string, FilesMap>);
|
|
6
|
+
getFilesMapByFolder(folder: string): FilesMap | undefined;
|
|
7
|
+
allFilesMap(): IterableIterator<FilesMap>;
|
|
8
|
+
updateFilesMapByFolder(folder: string, logger: AstroIntegrationLogger): void;
|
|
9
|
+
}
|
|
10
|
+
export declare class FilesMap {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the graph of nodes by connecting them to one another.
|
|
14
|
+
* The graph is expected to be acyclic but this function won't throw any
|
|
15
|
+
* exception if it isn't.
|
|
16
|
+
*
|
|
17
|
+
* Instead when a `FilesMap` is turned into a JSON file, a warning will be
|
|
18
|
+
* printed if a cycle is found.
|
|
19
|
+
*
|
|
20
|
+
* @param folders initial folders found after a lookup.
|
|
21
|
+
*/
|
|
22
|
+
static initGraph(folders: string[], logger: AstroIntegrationLogger): Promise<FilesMapGraph>;
|
|
23
|
+
private _extend;
|
|
24
|
+
private _dependents;
|
|
25
|
+
/**
|
|
26
|
+
* Construct a new FileMap. To connect it to its graph, call
|
|
27
|
+
* `FileMap.initGraph` or `init(graph)`.
|
|
28
|
+
*
|
|
29
|
+
* @param path resolved path of this file map.
|
|
30
|
+
*/
|
|
31
|
+
constructor(path: string);
|
|
32
|
+
update(graph: Map<string, FilesMap>, logger: AstroIntegrationLogger): void;
|
|
33
|
+
extend(other: FilesMap): void;
|
|
34
|
+
unlink(): void;
|
|
35
|
+
allDependents(): Generator<FilesMap>;
|
|
36
|
+
toFiles(logger: AstroIntegrationLogger): Promise<Files>;
|
|
37
|
+
private _toFilePathsCheckCycles;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AstroBuildDoneOptions, AstroServerSetupOptions } from '../types.js';
|
|
2
|
+
export declare class WebContainerFiles {
|
|
3
|
+
private _watcher;
|
|
4
|
+
serverSetup(projectRoot: string, { server, logger }: AstroServerSetupOptions): Promise<void>;
|
|
5
|
+
serverDone(): Promise<void> | undefined;
|
|
6
|
+
buildAssets(projectRoot: string, { dir, logger }: AstroBuildDoneOptions): Promise<void>;
|
|
7
|
+
private _folders;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ContentDirs {
|
|
2
|
+
templatesDir: string;
|
|
3
|
+
contentDir: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function getFilesRef(pathToFolder: string, { contentDir, templatesDir }: ContentDirs): string;
|
|
6
|
+
export declare function getAllFilesMap({ contentDir, templatesDir }: ContentDirs): Promise<string[]>;
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tutorialkit-rb/astro",
|
|
3
|
+
"version": "1.5.2-rb.0.1.0",
|
|
4
|
+
"description": "TutorialKit integration for Astro (https://astro.build)",
|
|
5
|
+
"author": "StackBlitz Inc.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bugs": "https://github.com/stackblitz/tutorialkit/issues",
|
|
8
|
+
"homepage": "https://github.com/stackblitz/tutorialkit",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/Bakaface/tutorialkit.rb",
|
|
13
|
+
"directory": "packages/astro"
|
|
14
|
+
},
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./dist/index.js",
|
|
18
|
+
"./types": "./types.d.ts",
|
|
19
|
+
"./default-theme.css": "./dist/default/styles/variables.css",
|
|
20
|
+
"./default/pages/index.astro": "./dist/default/pages/index.astro",
|
|
21
|
+
"./default/pages/[...slug].astro": "./dist/default/pages/[...slug].astro",
|
|
22
|
+
"./default/components/TopBar.astro": "./dist/default/components/TopBar.astro",
|
|
23
|
+
"./default/components/HeadTags.astro": "./dist/default/components/HeadTags.astro",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"types.d.ts"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "node ./scripts/build.js",
|
|
32
|
+
"dev": "node ./scripts/build.js --watch",
|
|
33
|
+
"test": "vitest"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@astrojs/mdx": "^3.1.1",
|
|
37
|
+
"@astrojs/react": "^3.6.0",
|
|
38
|
+
"@expressive-code/plugin-collapsible-sections": "^0.35.3",
|
|
39
|
+
"@expressive-code/plugin-line-numbers": "^0.35.3",
|
|
40
|
+
"@nanostores/react": "0.7.2",
|
|
41
|
+
"@stackblitz/sdk": "^1.11.0",
|
|
42
|
+
"@tutorialkit-rb/react": "1.5.2",
|
|
43
|
+
"@tutorialkit-rb/runtime": "1.5.2",
|
|
44
|
+
"@tutorialkit-rb/theme": "1.5.2",
|
|
45
|
+
"@tutorialkit-rb/types": "1.5.2",
|
|
46
|
+
"@types/react": "^18.3.3",
|
|
47
|
+
"@unocss/reset": "^0.62.2",
|
|
48
|
+
"@webcontainer/api": "1.5.1",
|
|
49
|
+
"astro": "^4.15.0",
|
|
50
|
+
"astro-expressive-code": "^0.35.3",
|
|
51
|
+
"chokidar": "3.6.0",
|
|
52
|
+
"fast-glob": "^3.3.2",
|
|
53
|
+
"front-matter": "^4.0.2",
|
|
54
|
+
"hastscript": "^9.0.0",
|
|
55
|
+
"kleur": "4.1.5",
|
|
56
|
+
"mdast-util-directive": "^3.0.0",
|
|
57
|
+
"mdast-util-to-markdown": "^2.1.0",
|
|
58
|
+
"nanostores": "^0.10.3",
|
|
59
|
+
"react": "^18.3.1",
|
|
60
|
+
"react-dom": "^18.3.1",
|
|
61
|
+
"remark-directive": "^3.0.0",
|
|
62
|
+
"unified": "^11.0.5",
|
|
63
|
+
"unist-util-visit": "^5.0.0",
|
|
64
|
+
"unocss": "^0.59.4",
|
|
65
|
+
"zod": "3.23.8"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@tutorialkit-rb/types": "1.5.2",
|
|
69
|
+
"@types/mdast": "^4.0.4",
|
|
70
|
+
"esbuild": "^0.20.2",
|
|
71
|
+
"esbuild-node-externals": "^1.13.1",
|
|
72
|
+
"execa": "^9.2.0",
|
|
73
|
+
"typescript": "^5.4.5",
|
|
74
|
+
"vite-plugin-inspect": "0.8.4",
|
|
75
|
+
"vitest": "^3.0.5"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"astro": "^4.15.0"
|
|
79
|
+
},
|
|
80
|
+
"keywords": [
|
|
81
|
+
"ruby",
|
|
82
|
+
"rails",
|
|
83
|
+
"wasm"
|
|
84
|
+
]
|
|
85
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @blitz/lines-around-comment */
|
|
2
|
+
|
|
3
|
+
declare module 'tutorialkit:store' {
|
|
4
|
+
const tutorialStore: import('@tutorialkit-rb/runtime').TutorialStore;
|
|
5
|
+
|
|
6
|
+
export default tutorialStore;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'tutorialkit:core' {
|
|
10
|
+
/** Promise that resolves to the webcontainer that's running in the current lesson. */
|
|
11
|
+
export const webcontainer: Promise<import('@webcontainer/api').WebContainer>;
|
|
12
|
+
}
|