poveste 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/LICENSE +22 -0
- package/README.md +11 -0
- package/bin.mjs +4 -0
- package/client.d.ts +19 -0
- package/client.js +15 -0
- package/dist/controls.d.ts +2 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +1 -0
- package/dist/node/alias.d.ts +3 -0
- package/dist/node/alias.d.ts.map +1 -0
- package/dist/node/alias.js +5 -0
- package/dist/node/bin.d.ts +2 -0
- package/dist/node/bin.d.ts.map +1 -0
- package/dist/node/bin.js +35 -0
- package/dist/node/build-serialize.d.ts +22 -0
- package/dist/node/build-serialize.d.ts.map +1 -0
- package/dist/node/build-serialize.js +36 -0
- package/dist/node/build.d.ts +3 -0
- package/dist/node/build.d.ts.map +1 -0
- package/dist/node/build.js +228 -0
- package/dist/node/builtin-plugins/pinceau-tokens.d.ts +7 -0
- package/dist/node/builtin-plugins/pinceau-tokens.d.ts.map +1 -0
- package/dist/node/builtin-plugins/pinceau-tokens.js +505 -0
- package/dist/node/builtin-plugins/tailwind-tokens.d.ts +6 -0
- package/dist/node/builtin-plugins/tailwind-tokens.d.ts.map +1 -0
- package/dist/node/builtin-plugins/tailwind-tokens.js +523 -0
- package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts +15 -0
- package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/MountStory.js +39 -0
- package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts +39 -0
- package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/RenderStory.js +129 -0
- package/dist/node/builtin-plugins/vanilla-support/client.d.ts +4 -0
- package/dist/node/builtin-plugins/vanilla-support/client.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/client.js +5 -0
- package/dist/node/builtin-plugins/vanilla-support/collect.d.ts +3 -0
- package/dist/node/builtin-plugins/vanilla-support/collect.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/collect.js +33 -0
- package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts +3 -0
- package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/plugin.js +29 -0
- package/dist/node/builtin-plugins/vanilla-support/types.d.ts +36 -0
- package/dist/node/builtin-plugins/vanilla-support/types.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/types.js +3 -0
- package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts +4 -0
- package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts.map +1 -0
- package/dist/node/builtin-plugins/vanilla-support/vanilla.story.js +55 -0
- package/dist/node/collect/index.d.ts +14 -0
- package/dist/node/collect/index.d.ts.map +1 -0
- package/dist/node/collect/index.js +129 -0
- package/dist/node/collect/run.d.ts +3 -0
- package/dist/node/collect/run.d.ts.map +1 -0
- package/dist/node/collect/run.js +7 -0
- package/dist/node/collect/worker.d.ts +14 -0
- package/dist/node/collect/worker.d.ts.map +1 -0
- package/dist/node/collect/worker.js +64 -0
- package/dist/node/colors.d.ts +287 -0
- package/dist/node/colors.d.ts.map +1 -0
- package/dist/node/colors.js +324 -0
- package/dist/node/commands/build.d.ts +5 -0
- package/dist/node/commands/build.d.ts.map +1 -0
- package/dist/node/commands/build.js +9 -0
- package/dist/node/commands/dev.d.ts +8 -0
- package/dist/node/commands/dev.d.ts.map +1 -0
- package/dist/node/commands/dev.js +52 -0
- package/dist/node/commands/preview.d.ts +5 -0
- package/dist/node/commands/preview.d.ts.map +1 -0
- package/dist/node/commands/preview.js +15 -0
- package/dist/node/config.d.ts +40 -0
- package/dist/node/config.d.ts.map +1 -0
- package/dist/node/config.js +330 -0
- package/dist/node/context.d.ts +18 -0
- package/dist/node/context.d.ts.map +1 -0
- package/dist/node/context.js +28 -0
- package/dist/node/dom/dom-keys.d.ts +5 -0
- package/dist/node/dom/dom-keys.d.ts.map +1 -0
- package/dist/node/dom/dom-keys.js +233 -0
- package/dist/node/dom/env.d.ts +5 -0
- package/dist/node/dom/env.d.ts.map +1 -0
- package/dist/node/dom/env.js +47 -0
- package/dist/node/dom/util.d.ts +11 -0
- package/dist/node/dom/util.d.ts.map +1 -0
- package/dist/node/dom/util.js +65 -0
- package/dist/node/index.d.ts +12 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +4 -0
- package/dist/node/load.d.ts +9 -0
- package/dist/node/load.d.ts.map +1 -0
- package/dist/node/load.js +42 -0
- package/dist/node/markdown.d.ts +11 -0
- package/dist/node/markdown.d.ts.map +1 -0
- package/dist/node/markdown.js +228 -0
- package/dist/node/plugin.d.ts +42 -0
- package/dist/node/plugin.d.ts.map +1 -0
- package/dist/node/plugin.js +67 -0
- package/dist/node/preview.d.ts +8 -0
- package/dist/node/preview.d.ts.map +1 -0
- package/dist/node/preview.js +41 -0
- package/dist/node/search.d.ts +17 -0
- package/dist/node/search.d.ts.map +1 -0
- package/dist/node/search.js +72 -0
- package/dist/node/server.d.ts +12 -0
- package/dist/node/server.d.ts.map +1 -0
- package/dist/node/server.js +189 -0
- package/dist/node/stories.d.ts +22 -0
- package/dist/node/stories.d.ts.map +1 -0
- package/dist/node/stories.js +125 -0
- package/dist/node/tree.d.ts +4 -0
- package/dist/node/tree.d.ts.map +1 -0
- package/dist/node/tree.js +117 -0
- package/dist/node/util/find-up.d.ts +2 -0
- package/dist/node/util/find-up.d.ts.map +1 -0
- package/dist/node/util/find-up.js +20 -0
- package/dist/node/util/fs.d.ts +2 -0
- package/dist/node/util/fs.d.ts.map +1 -0
- package/dist/node/util/fs.js +1 -0
- package/dist/node/util/log.d.ts +2 -0
- package/dist/node/util/log.d.ts.map +1 -0
- package/dist/node/util/log.js +9 -0
- package/dist/node/util/slugify.d.ts +2 -0
- package/dist/node/util/slugify.d.ts.map +1 -0
- package/dist/node/util/slugify.js +22 -0
- package/dist/node/util/vendors.d.ts +3 -0
- package/dist/node/util/vendors.d.ts.map +1 -0
- package/dist/node/util/vendors.js +22 -0
- package/dist/node/vendors/controls.d.ts +2 -0
- package/dist/node/vendors/controls.d.ts.map +1 -0
- package/dist/node/vendors/controls.js +1 -0
- package/dist/node/vendors/vue.d.ts +2 -0
- package/dist/node/vendors/vue.d.ts.map +1 -0
- package/dist/node/vendors/vue.js +1 -0
- package/dist/node/virtual/index.d.ts +38 -0
- package/dist/node/virtual/index.d.ts.map +1 -0
- package/dist/node/virtual/index.js +49 -0
- package/dist/node/virtual/markdown.d.ts +3 -0
- package/dist/node/virtual/markdown.d.ts.map +1 -0
- package/dist/node/virtual/markdown.js +19 -0
- package/dist/node/virtual/noop.d.ts +2 -0
- package/dist/node/virtual/noop.d.ts.map +1 -0
- package/dist/node/virtual/noop.js +1 -0
- package/dist/node/virtual/resolved-commands.d.ts +3 -0
- package/dist/node/virtual/resolved-commands.d.ts.map +1 -0
- package/dist/node/virtual/resolved-commands.js +32 -0
- package/dist/node/virtual/resolved-config.d.ts +3 -0
- package/dist/node/virtual/resolved-config.d.ts.map +1 -0
- package/dist/node/virtual/resolved-config.js +10 -0
- package/dist/node/virtual/resolved-generated-global-setup.d.ts +3 -0
- package/dist/node/virtual/resolved-generated-global-setup.d.ts.map +1 -0
- package/dist/node/virtual/resolved-generated-global-setup.js +23 -0
- package/dist/node/virtual/resolved-generated-setup-code.d.ts +3 -0
- package/dist/node/virtual/resolved-generated-setup-code.d.ts.map +1 -0
- package/dist/node/virtual/resolved-generated-setup-code.js +5 -0
- package/dist/node/virtual/resolved-markdown-files.d.ts +3 -0
- package/dist/node/virtual/resolved-markdown-files.d.ts.map +1 -0
- package/dist/node/virtual/resolved-markdown-files.js +17 -0
- package/dist/node/virtual/resolved-stories.d.ts +3 -0
- package/dist/node/virtual/resolved-stories.d.ts.map +1 -0
- package/dist/node/virtual/resolved-stories.js +42 -0
- package/dist/node/virtual/resolved-support-plugins-client.d.ts +3 -0
- package/dist/node/virtual/resolved-support-plugins-client.d.ts.map +1 -0
- package/dist/node/virtual/resolved-support-plugins-client.js +11 -0
- package/dist/node/virtual/resolved-support-plugins-collect.d.ts +3 -0
- package/dist/node/virtual/resolved-support-plugins-collect.d.ts.map +1 -0
- package/dist/node/virtual/resolved-support-plugins-collect.js +11 -0
- package/dist/node/virtual/resolved-theme.d.ts +3 -0
- package/dist/node/virtual/resolved-theme.d.ts.map +1 -0
- package/dist/node/virtual/resolved-theme.js +12 -0
- package/dist/node/virtual/story-source.d.ts +3 -0
- package/dist/node/virtual/story-source.d.ts.map +1 -0
- package/dist/node/virtual/story-source.js +16 -0
- package/dist/node/virtual/story.d.ts +3 -0
- package/dist/node/virtual/story.d.ts.map +1 -0
- package/dist/node/virtual/story.js +7 -0
- package/dist/node/virtual/util.d.ts +3 -0
- package/dist/node/virtual/util.d.ts.map +1 -0
- package/dist/node/virtual/util.js +4 -0
- package/dist/node/virtual/vite-plugin.d.ts +4 -0
- package/dist/node/virtual/vite-plugin.d.ts.map +1 -0
- package/dist/node/virtual/vite-plugin.js +126 -0
- package/dist/node/vite.d.ts +9 -0
- package/dist/node/vite.d.ts.map +1 -0
- package/dist/node/vite.js +337 -0
- package/index.d.ts +1 -0
- package/package.json +89 -0
- package/plugin.d.ts +3 -0
- package/plugin.js +11 -0
- package/src/controls.ts +1 -0
- package/src/node/__tests__/markdown/test1.story.md +7 -0
- package/src/node/__tests__/markdown/test2.story.md +5 -0
- package/src/node/__tests__/markdown.spec.ts +61 -0
- package/src/node/__tests__/tree.spec.ts +109 -0
- package/src/node/alias.ts +8 -0
- package/src/node/bin.ts +43 -0
- package/src/node/build-serialize.ts +62 -0
- package/src/node/build.ts +283 -0
- package/src/node/builtin-plugins/pinceau-tokens.ts +521 -0
- package/src/node/builtin-plugins/tailwind-tokens.ts +536 -0
- package/src/node/builtin-plugins/vanilla-support/MountStory.ts +49 -0
- package/src/node/builtin-plugins/vanilla-support/RenderStory.ts +164 -0
- package/src/node/builtin-plugins/vanilla-support/client.ts +6 -0
- package/src/node/builtin-plugins/vanilla-support/collect.ts +43 -0
- package/src/node/builtin-plugins/vanilla-support/plugin.ts +35 -0
- package/src/node/builtin-plugins/vanilla-support/types.ts +40 -0
- package/src/node/builtin-plugins/vanilla-support/vanilla.story.ts +63 -0
- package/src/node/collect/index.ts +160 -0
- package/src/node/collect/run.ts +9 -0
- package/src/node/collect/worker.ts +97 -0
- package/src/node/colors.ts +340 -0
- package/src/node/commands/build.ts +14 -0
- package/src/node/commands/dev.ts +67 -0
- package/src/node/commands/preview.ts +22 -0
- package/src/node/config.ts +385 -0
- package/src/node/context.ts +60 -0
- package/src/node/dom/dom-keys.ts +238 -0
- package/src/node/dom/env.ts +60 -0
- package/src/node/dom/util.ts +83 -0
- package/src/node/index.ts +12 -0
- package/src/node/load.ts +59 -0
- package/src/node/markdown.ts +267 -0
- package/src/node/plugin.ts +95 -0
- package/src/node/preview.ts +57 -0
- package/src/node/search.ts +84 -0
- package/src/node/server.ts +235 -0
- package/src/node/stories.ts +154 -0
- package/src/node/tree.ts +158 -0
- package/src/node/util/find-up.ts +24 -0
- package/src/node/util/fs.ts +1 -0
- package/src/node/util/log.ts +10 -0
- package/src/node/util/slugify.ts +26 -0
- package/src/node/util/vendors.ts +27 -0
- package/src/node/vendors/controls.ts +1 -0
- package/src/node/vendors/vue.ts +1 -0
- package/src/node/virtual/index.ts +50 -0
- package/src/node/virtual/markdown.ts +21 -0
- package/src/node/virtual/noop.ts +1 -0
- package/src/node/virtual/resolved-commands.ts +42 -0
- package/src/node/virtual/resolved-config.ts +12 -0
- package/src/node/virtual/resolved-generated-global-setup.ts +25 -0
- package/src/node/virtual/resolved-generated-setup-code.ts +7 -0
- package/src/node/virtual/resolved-markdown-files.ts +19 -0
- package/src/node/virtual/resolved-stories.ts +44 -0
- package/src/node/virtual/resolved-support-plugins-client.ts +14 -0
- package/src/node/virtual/resolved-support-plugins-collect.ts +14 -0
- package/src/node/virtual/resolved-theme.ts +14 -0
- package/src/node/virtual/story-source.ts +18 -0
- package/src/node/virtual/story.ts +9 -0
- package/src/node/virtual/util.ts +5 -0
- package/src/node/virtual/vite-plugin.ts +146 -0
- package/src/node/vite.ts +379 -0
- package/tsconfig.json +44 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
+
// Resolve an absolute path to e.g. node_modules/.pnpm/histoire@0.11.7_vite@3.2.4/node_modules/histoire/dist/node/vendors/controls.js
|
|
4
|
+
// https://github.com/histoire-dev/histoire/issues/282
|
|
5
|
+
export const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
// https://github.com/vitejs/vite/issues/9661
|
|
7
|
+
const alias = {
|
|
8
|
+
'@poveste/vendors/vue': path.resolve(__dirname, '../vendors/vue.js'),
|
|
9
|
+
'@poveste/controls': path.resolve(__dirname, '../vendors/controls.js'),
|
|
10
|
+
};
|
|
11
|
+
export function getInjectedImport(request) {
|
|
12
|
+
let id = request;
|
|
13
|
+
if (alias[id]) {
|
|
14
|
+
id = alias[id];
|
|
15
|
+
}
|
|
16
|
+
if (path.isAbsolute(id)) {
|
|
17
|
+
return JSON.stringify(pathToFileURL(id).href);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return JSON.stringify(id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/node/vendors/controls.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@poveste/controls';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/node/vendors/vue.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@poveste/vendors/vue';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const STORIES_ID = "virtual:$histoire-stories";
|
|
2
|
+
export declare const RESOLVED_STORIES_ID = "/__resolved__virtual:$histoire-stories";
|
|
3
|
+
export declare const SETUP_ID = "virtual:$histoire-setup";
|
|
4
|
+
export declare const NOOP_ID = "virtual:$histoire-noop";
|
|
5
|
+
export declare const CONFIG_ID = "virtual:$histoire-config";
|
|
6
|
+
export declare const RESOLVED_CONFIG_ID = "\0virtual:$histoire-config";
|
|
7
|
+
export declare const THEME_ID = "virtual:$histoire-theme";
|
|
8
|
+
export declare const RESOLVED_THEME_ID = "\0virtual:$histoire-theme.css";
|
|
9
|
+
export declare const SEARCH_TITLE_DATA_ID = "virtual:$histoire-search-title-data";
|
|
10
|
+
export declare const RESOLVED_SEARCH_TITLE_DATA_ID = "\0virtual:$histoire-search-title-data";
|
|
11
|
+
export declare const SEARCH_DOCS_DATA_ID = "virtual:$histoire-search-docs-data";
|
|
12
|
+
export declare const RESOLVED_SEARCH_DOCS_DATA_ID = "\0virtual:$histoire-search-docs-data";
|
|
13
|
+
export declare const GENERATED_GLOBAL_SETUP = "virtual:$histoire-generated-global-setup";
|
|
14
|
+
export declare const RESOLVED_GENERATED_GLOBAL_SETUP = "\0virtual:$histoire-generated-global-setup";
|
|
15
|
+
export declare const GENERATED_SETUP_CODE = "virtual:$histoire-generated-setup-code";
|
|
16
|
+
export declare const RESOLVED_GENERATED_SETUP_CODE = "\0virtual:$histoire-generated-setup-code";
|
|
17
|
+
export declare const SUPPORT_PLUGINS_CLIENT = "virtual:$histoire-support-plugins-client";
|
|
18
|
+
export declare const RESOLVED_SUPPORT_PLUGINS_CLIENT = "\0virtual:$histoire-support-plugins-client";
|
|
19
|
+
export declare const SUPPORT_PLUGINS_COLLECT = "virtual:$histoire-support-plugins-collect";
|
|
20
|
+
export declare const RESOLVED_SUPPORT_PLUGINS_COLLECT = "\0virtual:$histoire-support-plugins-collect";
|
|
21
|
+
export declare const MARKDOWN_FILES = "virtual:$histoire-markdown-files";
|
|
22
|
+
export declare const RESOLVED_MARKDOWN_FILES = "\0virtual:$histoire-markdown-files";
|
|
23
|
+
export declare const COMMANDS = "virtual:$histoire-commands";
|
|
24
|
+
export declare const RESOLVED_COMMANDS = "/__resolved__virtual:$histoire-commands";
|
|
25
|
+
export * from './markdown.js';
|
|
26
|
+
export * from './noop.js';
|
|
27
|
+
export * from './resolved-commands.js';
|
|
28
|
+
export * from './resolved-config.js';
|
|
29
|
+
export * from './resolved-generated-global-setup.js';
|
|
30
|
+
export * from './resolved-generated-setup-code.js';
|
|
31
|
+
export * from './resolved-markdown-files.js';
|
|
32
|
+
export * from './resolved-stories.js';
|
|
33
|
+
export * from './resolved-support-plugins-client.js';
|
|
34
|
+
export * from './resolved-support-plugins-collect.js';
|
|
35
|
+
export * from './resolved-theme.js';
|
|
36
|
+
export * from './story-source.js';
|
|
37
|
+
export * from './story.js';
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,8BAA8B,CAAA;AACrD,eAAO,MAAM,mBAAmB,2CAA+B,CAAA;AAE/D,eAAO,MAAM,QAAQ,4BAA4B,CAAA;AACjD,eAAO,MAAM,OAAO,2BAA2B,CAAA;AAC/C,eAAO,MAAM,SAAS,6BAA6B,CAAA;AAEnD,eAAO,MAAM,kBAAkB,+BAAmB,CAAA;AAClD,eAAO,MAAM,QAAQ,4BAA4B,CAAA;AAEjD,eAAO,MAAM,iBAAiB,kCAAsB,CAAA;AACpD,eAAO,MAAM,oBAAoB,wCAAwC,CAAA;AAEzE,eAAO,MAAM,6BAA6B,0CAA8B,CAAA;AACxE,eAAO,MAAM,mBAAmB,uCAAuC,CAAA;AAEvE,eAAO,MAAM,4BAA4B,yCAA6B,CAAA;AACtE,eAAO,MAAM,sBAAsB,6CAA6C,CAAA;AAEhF,eAAO,MAAM,+BAA+B,+CAAgC,CAAA;AAC5E,eAAO,MAAM,oBAAoB,2CAA2C,CAAA;AAE5E,eAAO,MAAM,6BAA6B,6CAA8B,CAAA;AACxE,eAAO,MAAM,sBAAsB,6CAA6C,CAAA;AAEhF,eAAO,MAAM,+BAA+B,+CAAgC,CAAA;AAC5E,eAAO,MAAM,uBAAuB,8CAA8C,CAAA;AAElF,eAAO,MAAM,gCAAgC,gDAAiC,CAAA;AAC9E,eAAO,MAAM,cAAc,qCAAqC,CAAA;AAEhE,eAAO,MAAM,uBAAuB,uCAAwB,CAAA;AAC5D,eAAO,MAAM,QAAQ,+BAA+B,CAAA;AACpD,eAAO,MAAM,iBAAiB,4CAA6B,CAAA;AAE3D,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sCAAsC,CAAA;AACpD,cAAc,oCAAoC,CAAA;AAClD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @TODO wait for virtual modules HMR to work in vite to use `virtual:` and `\0` prefix
|
|
2
|
+
// https://github.com/vitejs/vite/pull/10313
|
|
3
|
+
export const STORIES_ID = 'virtual:$histoire-stories';
|
|
4
|
+
export const RESOLVED_STORIES_ID = `/__resolved__${STORIES_ID}`;
|
|
5
|
+
// export const RESOLVED_STORIES_ID = `\0${STORIES_ID}`
|
|
6
|
+
export const SETUP_ID = 'virtual:$histoire-setup';
|
|
7
|
+
export const NOOP_ID = 'virtual:$histoire-noop';
|
|
8
|
+
export const CONFIG_ID = 'virtual:$histoire-config';
|
|
9
|
+
// export const RESOLVED_CONFIG_ID = `/__resolved__${CONFIG_ID}`
|
|
10
|
+
export const RESOLVED_CONFIG_ID = `\0${CONFIG_ID}`;
|
|
11
|
+
export const THEME_ID = 'virtual:$histoire-theme';
|
|
12
|
+
// export const RESOLVED_THEME_ID = `/__resolved__${THEME_ID}.css`
|
|
13
|
+
export const RESOLVED_THEME_ID = `\0${THEME_ID}.css`;
|
|
14
|
+
export const SEARCH_TITLE_DATA_ID = 'virtual:$histoire-search-title-data';
|
|
15
|
+
// export const RESOLVED_SEARCH_TITLE_DATA_ID = `/__resolved__${SEARCH_TITLE_DATA_ID}`
|
|
16
|
+
export const RESOLVED_SEARCH_TITLE_DATA_ID = `\0${SEARCH_TITLE_DATA_ID}`;
|
|
17
|
+
export const SEARCH_DOCS_DATA_ID = 'virtual:$histoire-search-docs-data';
|
|
18
|
+
// export const RESOLVED_SEARCH_DOCS_DATA_ID = `/__resolved__${SEARCH_DOCS_DATA_ID}`
|
|
19
|
+
export const RESOLVED_SEARCH_DOCS_DATA_ID = `\0${SEARCH_DOCS_DATA_ID}`;
|
|
20
|
+
export const GENERATED_GLOBAL_SETUP = 'virtual:$histoire-generated-global-setup';
|
|
21
|
+
// export const RESOLVED_GENERATED_GLOBAL_SETUP = `/__resolved__${GENERATED_GLOBAL_SETUP}`
|
|
22
|
+
export const RESOLVED_GENERATED_GLOBAL_SETUP = `\0${GENERATED_GLOBAL_SETUP}`;
|
|
23
|
+
export const GENERATED_SETUP_CODE = 'virtual:$histoire-generated-setup-code';
|
|
24
|
+
// export const RESOLVED_GENERATED_SETUP_CODE = `/__resolved__${GENERATED_SETUP_CODE}`
|
|
25
|
+
export const RESOLVED_GENERATED_SETUP_CODE = `\0${GENERATED_SETUP_CODE}`;
|
|
26
|
+
export const SUPPORT_PLUGINS_CLIENT = 'virtual:$histoire-support-plugins-client';
|
|
27
|
+
// export const RESOLVED_SUPPORT_PLUGINS_CLIENT = `/__resolved__${SUPPORT_PLUGINS_CLIENT}`
|
|
28
|
+
export const RESOLVED_SUPPORT_PLUGINS_CLIENT = `\0${SUPPORT_PLUGINS_CLIENT}`;
|
|
29
|
+
export const SUPPORT_PLUGINS_COLLECT = 'virtual:$histoire-support-plugins-collect';
|
|
30
|
+
// export const RESOLVED_SUPPORT_PLUGINS_COLLECT = `/__resolved__${SUPPORT_PLUGINS_COLLECT}`
|
|
31
|
+
export const RESOLVED_SUPPORT_PLUGINS_COLLECT = `\0${SUPPORT_PLUGINS_COLLECT}`;
|
|
32
|
+
export const MARKDOWN_FILES = 'virtual:$histoire-markdown-files';
|
|
33
|
+
// export const RESOLVED_MARKDOWN_FILES = `/__resolved__${MARKDOWN_FILES}`
|
|
34
|
+
export const RESOLVED_MARKDOWN_FILES = `\0${MARKDOWN_FILES}`;
|
|
35
|
+
export const COMMANDS = 'virtual:$histoire-commands';
|
|
36
|
+
export const RESOLVED_COMMANDS = `/__resolved__${COMMANDS}`;
|
|
37
|
+
export * from './markdown.js';
|
|
38
|
+
export * from './noop.js';
|
|
39
|
+
export * from './resolved-commands.js';
|
|
40
|
+
export * from './resolved-config.js';
|
|
41
|
+
export * from './resolved-generated-global-setup.js';
|
|
42
|
+
export * from './resolved-generated-setup-code.js';
|
|
43
|
+
export * from './resolved-markdown-files.js';
|
|
44
|
+
export * from './resolved-stories.js';
|
|
45
|
+
export * from './resolved-support-plugins-client.js';
|
|
46
|
+
export * from './resolved-support-plugins-collect.js';
|
|
47
|
+
export * from './resolved-theme.js';
|
|
48
|
+
export * from './story-source.js';
|
|
49
|
+
export * from './story.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,UAkBhD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function markdown(ctx, id) {
|
|
2
|
+
const fileId = id.slice('/__resolved__virtual:md:'.length);
|
|
3
|
+
const file = ctx.markdownFiles.find(f => f.id === fileId);
|
|
4
|
+
if (!file) {
|
|
5
|
+
throw new Error(`Markdown file not found: ${fileId}`);
|
|
6
|
+
}
|
|
7
|
+
const { html, frontmatter, relativePath } = file;
|
|
8
|
+
return `export const html = ${JSON.stringify(html)}
|
|
9
|
+
export const frontmatter = ${JSON.stringify(frontmatter)}
|
|
10
|
+
export const relativePath = ${JSON.stringify(relativePath)}
|
|
11
|
+
|
|
12
|
+
if (import.meta.hot) {
|
|
13
|
+
import.meta.hot.accept(newModule => {
|
|
14
|
+
if (newModule) {
|
|
15
|
+
window.__hst_md_hmr(newModule)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}`;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/noop.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAkC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const noop = () => `export default () => {}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-commands.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,UAY5C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const serializedFields = ['id', 'label', 'prompts', 'icon', 'searchText'];
|
|
2
|
+
export function resolvedCommands(ctx) {
|
|
3
|
+
const imports = [];
|
|
4
|
+
const commands = [];
|
|
5
|
+
for (const command of ctx.registeredCommands) {
|
|
6
|
+
const fields = getCommandFields(command, imports);
|
|
7
|
+
commands.push(`{ ${fields.join(', ')} }`);
|
|
8
|
+
}
|
|
9
|
+
return `${imports.join('\n')}
|
|
10
|
+
export const registeredCommands = [${commands.join(', ')}]
|
|
11
|
+
`;
|
|
12
|
+
}
|
|
13
|
+
function getCommandFields(command, imports) {
|
|
14
|
+
const fields = [];
|
|
15
|
+
for (const field of serializedFields) {
|
|
16
|
+
if (command[field] != null) {
|
|
17
|
+
fields.push(`${field}: ${JSON.stringify(command[field])}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Add client-side data
|
|
21
|
+
if (command.clientSetupFile) {
|
|
22
|
+
const importedVar = `__setup${imports.length}__`;
|
|
23
|
+
if (typeof command.clientSetupFile === 'string') {
|
|
24
|
+
imports.push(`import ${importedVar} from '${command.clientSetupFile}'`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
imports.push(`import { ${command.clientSetupFile.importName} as ${importedVar} } from '${command.clientSetupFile.file}'`);
|
|
28
|
+
}
|
|
29
|
+
fields.push(`...${importedVar}`);
|
|
30
|
+
}
|
|
31
|
+
return fields;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-config.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,UAS1C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function resolvedConfig(ctx) {
|
|
2
|
+
let js = `export const config = ${JSON.stringify(ctx.config)}\n`;
|
|
3
|
+
if (ctx.config.theme?.logo) {
|
|
4
|
+
for (const key in ctx.config.theme.logo) {
|
|
5
|
+
js += `import Logo_${key} from '${ctx.config.theme.logo[key]}'\n`;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
js += `export const logos = {${Object.keys(ctx.config.theme?.logo ?? {}).map(key => `${key}: Logo_${key}`).join(', ')}}\n`;
|
|
9
|
+
return js;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-generated-global-setup.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-generated-global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,UAoBxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GENERATED_SETUP_CODE } from './index.js';
|
|
2
|
+
import { ID_SEPARATOR } from './util.js';
|
|
3
|
+
export function resolvedGeneratedGlobalSetup(ctx) {
|
|
4
|
+
if (ctx.config.setupCode) {
|
|
5
|
+
return [
|
|
6
|
+
// Import
|
|
7
|
+
`${ctx.config.setupCode.map((c, index) => `import * as setup_${index} from '${GENERATED_SETUP_CODE}${ID_SEPARATOR}${index}'`).join('\n')}`,
|
|
8
|
+
// List
|
|
9
|
+
`const setupList = [${ctx.config.setupCode.map((c, index) => `setup_${index}`).join(', ')}]`,
|
|
10
|
+
// Setups
|
|
11
|
+
...ctx.supportPlugins.map(p => p.setupFn).flat().map(fnName => `export async function ${fnName} (payload) {
|
|
12
|
+
for (const setup of setupList) {
|
|
13
|
+
if (setup?.${fnName}) {
|
|
14
|
+
await setup.${fnName}(payload)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}`),
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-generated-setup-code.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-generated-setup-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAGlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-markdown-files.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-markdown-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,UAejD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getInjectedImport } from '../util/vendors.js';
|
|
2
|
+
export function resolvedMarkdownFiles(ctx) {
|
|
3
|
+
const filesJs = ctx.markdownFiles.map(f => `${JSON.stringify(f.relativePath)}: () => import(${JSON.stringify(`virtual:md:${f.id}`)})`).join(',');
|
|
4
|
+
return `import { reactive } from ${process.env.HISTOIRE_DEV ? `'vue'` : getInjectedImport('@poveste/vendors/vue')}
|
|
5
|
+
export const markdownFiles = reactive({${filesJs}})
|
|
6
|
+
if (import.meta.hot) {
|
|
7
|
+
if (!window.__hst_md_hmr) {
|
|
8
|
+
window.__hst_md_hmr = (newModule) => {
|
|
9
|
+
markdownFiles[newModule.relativePath] = () => newModule
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
import.meta.hot.accept(newModule => {
|
|
14
|
+
Object.assign(markdownFiles, newModule.markdownFiles)
|
|
15
|
+
})
|
|
16
|
+
}`;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-stories.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,UAwC3C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { makeTree } from '../tree.js';
|
|
2
|
+
export function resolvedStories(ctx) {
|
|
3
|
+
const resolvedStories = ctx.storyFiles.filter(s => !!s.story);
|
|
4
|
+
const files = resolvedStories.map((file, index) => {
|
|
5
|
+
return {
|
|
6
|
+
id: file.id,
|
|
7
|
+
path: file.treePath,
|
|
8
|
+
filePath: file.relativePath,
|
|
9
|
+
story: {
|
|
10
|
+
...file.story,
|
|
11
|
+
docsText: undefined,
|
|
12
|
+
},
|
|
13
|
+
supportPluginId: file.supportPluginId,
|
|
14
|
+
docsFilePath: file.markdownFile?.relativePath,
|
|
15
|
+
index,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
return `${ctx.supportPlugins.map(p => p.importStoriesPrepend).filter(Boolean).join('\n')}
|
|
19
|
+
${resolvedStories.map((file, index) => {
|
|
20
|
+
const supportPlugin = ctx.supportPlugins.find(p => p.id === file.supportPluginId);
|
|
21
|
+
if (!supportPlugin) {
|
|
22
|
+
throw new Error(`Could not find support plugin for story ${file.path}: ${file.supportPluginId}`);
|
|
23
|
+
}
|
|
24
|
+
return supportPlugin.importStoryComponent(file, index);
|
|
25
|
+
}).filter(Boolean).join('\n')}
|
|
26
|
+
export let files = [${files.map(file => `{${JSON.stringify(file).slice(1, -1)}, component: Comp${file.index}, source: () => import('virtual:story-source:${file.story.id}')}`).join(',\n')}]
|
|
27
|
+
export let tree = ${JSON.stringify(makeTree(ctx.config, resolvedStories))}
|
|
28
|
+
const handlers = []
|
|
29
|
+
export function onUpdate (cb) {
|
|
30
|
+
handlers.push(cb)
|
|
31
|
+
}
|
|
32
|
+
if (import.meta.hot) {
|
|
33
|
+
import.meta.hot.accept(newModule => {
|
|
34
|
+
files = newModule.files
|
|
35
|
+
tree = newModule.tree
|
|
36
|
+
handlers.forEach(h => {
|
|
37
|
+
h(newModule.files, newModule.tree)
|
|
38
|
+
newModule.onUpdate(h)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}`;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-support-plugins-client.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-support-plugins-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,UAOxD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { PLUGINS_HAVE_DEV } from './util.js';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
export function resolvedSupportPluginsClient(ctx) {
|
|
5
|
+
const plugins = ctx.supportPlugins.map(p => `'${p.id}': () => import(${JSON.stringify(require.resolve(`${p.moduleName}/client${process.env.HISTOIRE_DEV && PLUGINS_HAVE_DEV.includes(p.moduleName) ? '-dev' : ''}`, {
|
|
6
|
+
paths: [ctx.root, import.meta.url],
|
|
7
|
+
}))})`);
|
|
8
|
+
return `export const clientSupportPlugins = {
|
|
9
|
+
${plugins.join(',\n ')}
|
|
10
|
+
}`;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-support-plugins-collect.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-support-plugins-collect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,UAOzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { PLUGINS_HAVE_DEV } from './util.js';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
export function resolvedSupportPluginsCollect(ctx) {
|
|
5
|
+
const plugins = ctx.supportPlugins.map(p => `'${p.id}': () => import(${JSON.stringify(require.resolve(`${p.moduleName}/collect${process.env.HISTOIRE_DEV && PLUGINS_HAVE_DEV.includes(p.moduleName) ? '-dev' : ''}`, {
|
|
6
|
+
paths: [ctx.root, import.meta.url],
|
|
7
|
+
}))})`);
|
|
8
|
+
return `export const collectSupportPlugins = {
|
|
9
|
+
${plugins.join(',\n ')}
|
|
10
|
+
}`;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-theme.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,UAUzC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { parseColor } from '../colors.js';
|
|
2
|
+
export function resolvedTheme(ctx) {
|
|
3
|
+
let css = '*, ::before, ::after {';
|
|
4
|
+
// Colors
|
|
5
|
+
for (const color in ctx.config.theme?.colors ?? {}) {
|
|
6
|
+
for (const key in ctx.config.theme.colors[color]) {
|
|
7
|
+
css += `--_histoire-color-${color}-${key}: ${parseColor(ctx.config.theme.colors[color][key]).color.join(' ')};`;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
css += '}';
|
|
11
|
+
return css;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-source.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/story-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C,wBAAsB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAazD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { resolve } from 'pathe';
|
|
3
|
+
export async function storySource(ctx, id) {
|
|
4
|
+
const storyId = id.slice('/__resolved__virtual:story-source:'.length);
|
|
5
|
+
const storyFile = ctx.storyFiles.find(f => f.story?.id === storyId);
|
|
6
|
+
if (storyFile) {
|
|
7
|
+
let source;
|
|
8
|
+
if (storyFile.virtual) {
|
|
9
|
+
source = storyFile.moduleCode;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
source = await fs.readFile(resolve(ctx.root, storyFile.relativePath), 'utf-8');
|
|
13
|
+
}
|
|
14
|
+
return `export default ${JSON.stringify(source)}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/story.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,UAM7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAU,CAAA;AAEnC,eAAO,MAAM,gBAAgB,UAE5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAyIjE,UAAU,CAChB"}
|