histoire 0.2.4 → 0.3.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.
Files changed (178) hide show
  1. package/dist/client/app/App.vue +9 -4
  2. package/dist/client/app/codegen/const.d.ts +1 -0
  3. package/dist/client/app/codegen/const.js +3 -0
  4. package/dist/client/app/codegen/vue3.js +82 -21
  5. package/dist/client/app/components/app/Breadcrumb.vue +1 -1
  6. package/dist/client/app/components/base/BaseEmpty.vue +17 -1
  7. package/dist/client/app/components/exposed/Story.vue +22 -1
  8. package/dist/client/app/components/exposed/Variant.vue +13 -1
  9. package/dist/client/app/components/sandbox/SandboxVue3.vue +6 -4
  10. package/dist/client/app/components/sandbox/lib.js +2 -1
  11. package/dist/client/app/components/search/SearchItem.vue +1 -0
  12. package/dist/client/app/components/search/SearchLoading.vue +16 -0
  13. package/dist/client/app/components/search/SearchModal.vue +12 -149
  14. package/dist/client/app/components/search/SearchPane.vue +210 -0
  15. package/dist/client/app/components/search/search-data.d.ts +2 -0
  16. package/dist/client/app/components/search/search-data.js +7 -0
  17. package/dist/client/app/components/story/StoryControls.vue +5 -0
  18. package/dist/client/app/components/story/StoryDocs.vue +18 -11
  19. package/dist/client/app/components/story/StoryEvent.vue +53 -0
  20. package/dist/client/app/components/story/StoryEvents.vue +45 -0
  21. package/dist/client/app/components/story/StoryResponsivePreview.vue +41 -8
  22. package/dist/client/app/components/story/StorySidePanel.vue +28 -3
  23. package/dist/client/app/components/story/StorySourceCode.vue +24 -14
  24. package/dist/client/app/components/story/StoryView.vue +16 -2
  25. package/dist/client/app/components/tree/StoryGroup.vue +75 -0
  26. package/dist/client/app/components/{story → tree}/StoryList.vue +8 -2
  27. package/{src/client/app/components/story → dist/client/app/components/tree}/StoryListFolder.vue +10 -8
  28. package/{src/client/app/components/story → dist/client/app/components/tree}/StoryListItem.vue +7 -4
  29. package/dist/client/app/router.d.ts +1 -0
  30. package/dist/client/app/router.js +3 -1
  31. package/dist/client/app/sandbox.js +11 -1
  32. package/dist/client/app/stores/events.d.ts +29 -0
  33. package/dist/client/app/stores/events.js +25 -0
  34. package/dist/client/app/stores/folder.d.ts +10 -0
  35. package/dist/client/app/stores/folder.js +47 -0
  36. package/dist/client/app/stores/story.d.ts +20 -8
  37. package/dist/client/app/stores/story.js +20 -28
  38. package/dist/client/app/style/floating-vue.pcss +3 -1
  39. package/dist/client/app/style/main.pcss +5 -0
  40. package/dist/client/app/style/sandbox.css +2 -0
  41. package/dist/client/app/types.d.ts +9 -1
  42. package/dist/client/app/util/const.d.ts +1 -0
  43. package/dist/client/app/util/const.js +1 -0
  44. package/dist/client/app/util/events.d.ts +1 -0
  45. package/dist/client/app/util/events.js +31 -0
  46. package/dist/client/app/util/mapping.js +2 -2
  47. package/dist/client/index.d.ts +4 -3
  48. package/dist/client/index.js +2 -1
  49. package/dist/client/server/index.d.ts +7 -2
  50. package/dist/client/server/index.js +8 -26
  51. package/{src/client/server/Story.server.vue → dist/client/server/vue3/Story.vue} +21 -4
  52. package/dist/client/server/{Variant.server.vue → vue3/Variant.vue} +0 -0
  53. package/dist/client/server/vue3/run.d.ts +2 -0
  54. package/dist/client/server/vue3/run.js +32 -0
  55. package/dist/node/alias.d.ts +2 -1
  56. package/dist/node/alias.js +3 -2
  57. package/dist/node/build.js +74 -21
  58. package/dist/node/builtin-plugins/tailwind-tokens.d.ts +5 -0
  59. package/dist/node/builtin-plugins/tailwind-tokens.js +510 -0
  60. package/dist/node/collect/index.js +5 -3
  61. package/dist/node/collect/worker.js +6 -2
  62. package/dist/node/commands/preview.js +4 -25
  63. package/dist/node/config.d.ts +111 -5
  64. package/dist/node/config.js +40 -23
  65. package/dist/node/context.d.ts +3 -3
  66. package/dist/node/context.js +1 -1
  67. package/dist/node/index.d.ts +1 -0
  68. package/dist/node/index.js +1 -0
  69. package/dist/node/load.d.ts +12 -0
  70. package/dist/node/load.js +42 -0
  71. package/dist/node/plugin.d.ts +67 -11
  72. package/dist/node/plugin.js +42 -245
  73. package/dist/node/preview.d.ts +8 -0
  74. package/dist/node/preview.js +41 -0
  75. package/dist/node/search.d.ts +2 -0
  76. package/dist/node/search.js +68 -0
  77. package/dist/node/server.js +43 -21
  78. package/dist/node/stories.d.ts +2 -0
  79. package/dist/node/stories.js +9 -4
  80. package/dist/node/tree.d.ts +16 -12
  81. package/dist/node/tree.js +45 -5
  82. package/dist/node/types.d.ts +11 -0
  83. package/dist/node/util/find-up.d.ts +1 -0
  84. package/dist/node/util/find-up.js +20 -0
  85. package/dist/node/vite.d.ts +13 -0
  86. package/dist/node/vite.js +278 -0
  87. package/dist/style.css +174 -36
  88. package/package.json +7 -6
  89. package/scripts/copy.mjs +2 -1
  90. package/src/client/app/App.vue +9 -4
  91. package/src/client/app/codegen/const.ts +3 -0
  92. package/src/client/app/codegen/vue3.ts +80 -22
  93. package/src/client/app/components/app/Breadcrumb.vue +1 -1
  94. package/src/client/app/components/base/BaseEmpty.vue +17 -1
  95. package/src/client/app/components/exposed/Story.vue +22 -1
  96. package/src/client/app/components/exposed/Variant.vue +13 -1
  97. package/src/client/app/components/sandbox/SandboxVue3.vue +6 -4
  98. package/src/client/app/components/sandbox/lib.ts +3 -1
  99. package/src/client/app/components/search/SearchItem.vue +1 -0
  100. package/src/client/app/components/search/SearchLoading.vue +16 -0
  101. package/src/client/app/components/search/SearchModal.vue +12 -149
  102. package/src/client/app/components/search/SearchPane.vue +210 -0
  103. package/src/client/app/components/search/search-data.ts +9 -0
  104. package/src/client/app/components/story/StoryControls.vue +5 -0
  105. package/src/client/app/components/story/StoryDocs.vue +18 -11
  106. package/src/client/app/components/story/StoryEvent.vue +53 -0
  107. package/src/client/app/components/story/StoryEvents.vue +45 -0
  108. package/src/client/app/components/story/StoryResponsivePreview.vue +41 -8
  109. package/src/client/app/components/story/StorySidePanel.vue +28 -3
  110. package/src/client/app/components/story/StorySourceCode.vue +24 -14
  111. package/src/client/app/components/story/StoryView.vue +16 -2
  112. package/src/client/app/components/tree/StoryGroup.vue +75 -0
  113. package/src/client/app/components/{story → tree}/StoryList.vue +8 -2
  114. package/{dist/client/app/components/story → src/client/app/components/tree}/StoryListFolder.vue +10 -8
  115. package/{dist/client/app/components/story → src/client/app/components/tree}/StoryListItem.vue +7 -4
  116. package/src/client/app/router.ts +4 -1
  117. package/src/client/app/sandbox.ts +12 -2
  118. package/src/client/app/stores/events.ts +36 -0
  119. package/src/client/app/stores/folder.ts +59 -0
  120. package/src/client/app/stores/story.ts +20 -35
  121. package/src/client/app/style/floating-vue.pcss +3 -1
  122. package/src/client/app/style/main.pcss +5 -0
  123. package/src/client/app/style/sandbox.css +2 -0
  124. package/src/client/app/types.ts +10 -1
  125. package/src/client/app/util/const.ts +1 -0
  126. package/src/client/app/util/events.ts +30 -0
  127. package/src/client/app/util/mapping.ts +2 -2
  128. package/src/client/index.ts +4 -3
  129. package/src/client/server/index.ts +14 -27
  130. package/{dist/client/server/Story.server.vue → src/client/server/vue3/Story.vue} +21 -4
  131. package/src/client/server/{Variant.server.vue → vue3/Variant.vue} +0 -0
  132. package/{dist/client/server/index.ts → src/client/server/vue3/run.ts} +10 -4
  133. package/src/node/alias.ts +4 -2
  134. package/src/node/build.ts +86 -21
  135. package/src/node/builtin-plugins/tailwind-tokens.ts +521 -0
  136. package/src/node/collect/index.ts +6 -4
  137. package/src/node/collect/worker.ts +7 -2
  138. package/src/node/commands/preview.ts +4 -33
  139. package/src/node/config.ts +62 -29
  140. package/src/node/context.ts +3 -3
  141. package/src/node/index.ts +1 -0
  142. package/src/node/load.ts +63 -0
  143. package/src/node/plugin.ts +75 -252
  144. package/src/node/preview.ts +56 -0
  145. package/src/node/search.ts +75 -0
  146. package/src/node/server.ts +49 -23
  147. package/src/node/stories.ts +9 -4
  148. package/src/node/tree.spec.ts +35 -17
  149. package/src/node/tree.ts +64 -10
  150. package/src/node/types.ts +12 -0
  151. package/src/node/util/find-up.ts +24 -0
  152. package/src/node/vite.ts +296 -0
  153. package/tailwind.config.cjs +1 -0
  154. package/dist/client/app/codegen/serialize-js.ts +0 -119
  155. package/dist/client/app/codegen/util.ts +0 -79
  156. package/dist/client/app/codegen/vue3.ts +0 -276
  157. package/dist/client/app/components/sandbox/lib.ts +0 -8
  158. package/dist/client/app/global-components.ts +0 -13
  159. package/dist/client/app/index.ts +0 -28
  160. package/dist/client/app/router.ts +0 -17
  161. package/dist/client/app/sandbox.ts +0 -94
  162. package/dist/client/app/stores/preview-settings.ts +0 -17
  163. package/dist/client/app/stores/story.ts +0 -62
  164. package/dist/client/app/types.ts +0 -70
  165. package/dist/client/app/util/config.ts +0 -6
  166. package/dist/client/app/util/const.ts +0 -3
  167. package/dist/client/app/util/dark.ts +0 -4
  168. package/dist/client/app/util/env.ts +0 -1
  169. package/dist/client/app/util/keyboard.ts +0 -99
  170. package/dist/client/app/util/mapping.ts +0 -48
  171. package/dist/client/app/util/preview-settings.ts +0 -8
  172. package/dist/client/app/util/reactivity.ts +0 -22
  173. package/dist/client/app/util/responsive.ts +0 -3
  174. package/dist/client/app/util/scroll.ts +0 -31
  175. package/dist/client/app/util/tooltip.ts +0 -13
  176. package/dist/client/app/util/variant.ts +0 -20
  177. package/dist/client/index.ts +0 -12
  178. package/dist/client/shim.d.ts +0 -5
@@ -1,27 +1,9 @@
1
- import { createApp, h } from 'vue';
2
- import { registerVueComponents } from '@histoire/controls';
3
- import Story from './Story.server.vue';
4
- import Variant from './Variant.server.vue';
5
- export async function run(file, storyData, el) {
6
- const { default: Comp } = await import(file.moduleId);
7
- const app = createApp({
8
- provide: {
9
- addStory(data) {
10
- storyData.push(data);
11
- },
12
- },
13
- render() {
14
- return h(Comp, {
15
- ref: 'comp',
16
- data: file,
17
- });
18
- },
19
- });
20
- // eslint-disable-next-line vue/multi-word-component-names
21
- app.component('Story', Story);
22
- // eslint-disable-next-line vue/multi-word-component-names
23
- app.component('Variant', Variant);
24
- registerVueComponents(app);
25
- app.mount(el);
26
- app.unmount();
1
+ export async function run(payload) {
2
+ let result;
3
+ // @TODO if (vue3)
4
+ {
5
+ const { run } = await import('./vue3/run.js');
6
+ result = await run(payload);
7
+ }
8
+ return result;
27
9
  }
@@ -8,7 +8,17 @@ export default defineComponent({
8
8
  props: {
9
9
  title: {
10
10
  type: String,
11
- required: true,
11
+ default: null,
12
+ },
13
+
14
+ id: {
15
+ type: String,
16
+ default: null,
17
+ },
18
+
19
+ group: {
20
+ type: String,
21
+ default: null,
12
22
  },
13
23
 
14
24
  layout: {
@@ -25,6 +35,11 @@ export default defineComponent({
25
35
  type: String,
26
36
  default: null,
27
37
  },
38
+
39
+ docsOnly: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
28
43
  },
29
44
 
30
45
  setup (props) {
@@ -35,11 +50,13 @@ export default defineComponent({
35
50
  // Story
36
51
 
37
52
  const story: Story = {
38
- id: attrs.data.id,
39
- title: props.title,
53
+ id: props.id ?? attrs.data.id,
54
+ title: props.title ?? attrs.data.fileName,
55
+ group: props.group,
40
56
  layout: props.layout,
41
57
  icon: props.icon,
42
58
  iconColor: props.iconColor,
59
+ docsOnly: props.docsOnly,
43
60
  variants: [],
44
61
  }
45
62
  const addStory = inject('addStory', null)
@@ -70,7 +87,7 @@ export default defineComponent({
70
87
  render () {
71
88
  let suppressError = false
72
89
  try {
73
- return this.$slots.default({
90
+ return this.$slots.default?.({
74
91
  get state () {
75
92
  // No variant tags
76
93
  suppressError = true
@@ -0,0 +1,2 @@
1
+ import type { ServerRunPayload } from '../index.js';
2
+ export declare function run({ file, storyData, el }: ServerRunPayload): Promise<void>;
@@ -0,0 +1,32 @@
1
+ import { createApp, h } from 'vue';
2
+ import { registerVueComponents } from '@histoire/controls';
3
+ import Story from './Story.vue';
4
+ import Variant from './Variant.vue';
5
+ // @ts-expect-error virtual module id
6
+ import * as setup from '$histoire-setup';
7
+ export async function run({ file, storyData, el }) {
8
+ const { default: Comp } = await import(file.moduleId);
9
+ const app = createApp({
10
+ provide: {
11
+ addStory(data) {
12
+ storyData.push(data);
13
+ },
14
+ },
15
+ render() {
16
+ return h(Comp, {
17
+ ref: 'comp',
18
+ data: file,
19
+ });
20
+ },
21
+ });
22
+ if (typeof setup?.setupVue3 === 'function') {
23
+ await setup.setupVue3({ app });
24
+ }
25
+ // eslint-disable-next-line vue/multi-word-component-names
26
+ app.component('Story', Story);
27
+ // eslint-disable-next-line vue/multi-word-component-names
28
+ app.component('Variant', Variant);
29
+ registerVueComponents(app);
30
+ app.mount(el);
31
+ app.unmount();
32
+ }
@@ -1,2 +1,3 @@
1
- export declare const DIST_CLIENT_PATH: string;
1
+ export declare const DIST_PATH: string;
2
2
  export declare const APP_PATH: string;
3
+ export declare const TEMP_PATH: string;
@@ -1,5 +1,6 @@
1
1
  import { dirname, join } from 'pathe';
2
2
  import { fileURLToPath } from 'url';
3
3
  const __dirname = dirname(fileURLToPath(import.meta.url));
4
- export const DIST_CLIENT_PATH = join(__dirname, '../client');
5
- export const APP_PATH = join(DIST_CLIENT_PATH, 'app');
4
+ export const DIST_PATH = join(__dirname, '../');
5
+ export const APP_PATH = join(DIST_PATH, 'client', 'app');
6
+ export const TEMP_PATH = join(process.cwd(), 'node_modules', '.histoire');
@@ -1,13 +1,16 @@
1
1
  import { join } from 'pathe';
2
- import { build as viteBuild, createServer as createViteServer } from 'vite';
2
+ import { build as viteBuild, createServer as createViteServer, resolveConfig as resolveViteConfig } from 'vite';
3
3
  import fs from 'fs-extra';
4
4
  import { lookup as lookupMime } from 'mrmime';
5
5
  import pc from 'picocolors';
6
6
  import { performance } from 'perf_hooks';
7
7
  import { APP_PATH } from './alias.js';
8
- import { createVitePlugins } from './plugin.js';
8
+ import { createVitePlugins } from './vite.js';
9
9
  import { findAllStories } from './stories.js';
10
10
  import { useCollectStories } from './collect/index.js';
11
+ import { BuildPluginApi } from './plugin.js';
12
+ import { useModuleLoader } from './load.js';
13
+ import { startPreview } from './preview.js';
11
14
  const PRELOAD_MODULES = [
12
15
  'vendor',
13
16
  ];
@@ -19,11 +22,25 @@ const PREFETCHED_MODULES = [
19
22
  export async function build(ctx) {
20
23
  const startTime = performance.now();
21
24
  await findAllStories(ctx);
22
- // Collect story data
23
25
  const server = await createViteServer({
24
26
  plugins: await createVitePlugins(ctx),
25
27
  });
26
28
  await server.pluginContainer.buildStart({});
29
+ const moduleLoader = useModuleLoader({
30
+ server,
31
+ throws: true,
32
+ });
33
+ const buildEndCallbacks = [];
34
+ const previewStoryCallbacks = [];
35
+ for (const plugin of ctx.config.plugins) {
36
+ if (plugin.onBuild) {
37
+ const api = new BuildPluginApi(ctx, plugin, moduleLoader);
38
+ await plugin.onBuild(api);
39
+ buildEndCallbacks.push(...api.buildEndCallbacks);
40
+ previewStoryCallbacks.push(...api.previewStoryCallbacks);
41
+ }
42
+ }
43
+ // Collect story data
27
44
  const { executeStoryFile, destroy: destroyCollectStories } = useCollectStories({
28
45
  server,
29
46
  throws: true,
@@ -31,7 +48,6 @@ export async function build(ctx) {
31
48
  for (const storyFile of ctx.storyFiles) {
32
49
  await executeStoryFile(storyFile);
33
50
  }
34
- await server.close();
35
51
  await destroyCollectStories();
36
52
  const storyCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ? 1 : 0), 0);
37
53
  const variantCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ?? 0), 0);
@@ -41,8 +57,8 @@ export async function build(ctx) {
41
57
  build: {
42
58
  rollupOptions: {
43
59
  input: [
44
- join(APP_PATH, 'index.ts'),
45
- join(APP_PATH, 'sandbox.ts'),
60
+ join(APP_PATH, 'index.js'),
61
+ join(APP_PATH, 'sandbox.js'),
46
62
  ],
47
63
  output: {
48
64
  manualChunks(id) {
@@ -55,49 +71,86 @@ export async function build(ctx) {
55
71
  outDir: ctx.config.outDir,
56
72
  emptyOutDir: true,
57
73
  cssCodeSplit: false,
74
+ minify: false,
58
75
  },
59
76
  });
60
77
  const result = Array.isArray(results) ? results[0] : results;
78
+ const resolvedViteConfig = await resolveViteConfig({
79
+ plugins: await createVitePlugins(ctx),
80
+ }, 'build');
61
81
  const styleOutput = result.output.find(o => o.name === 'style.css' && o.type === 'asset');
62
82
  // Preload
63
83
  const preloadOutputs = result.output.filter(o => PRELOAD_MODULES.includes(o.name) && o.type === 'chunk');
64
- const preloadHtml = generateScriptLinks(preloadOutputs.map(o => o.fileName), 'preload');
84
+ const preloadHtml = generateScriptLinks(preloadOutputs.map(o => o.fileName), 'preload', ctx, resolvedViteConfig);
65
85
  // Prefetch
66
86
  const prefetchOutputs = result.output.filter(o => PREFETCHED_MODULES.includes(o.name) && o.type === 'chunk');
67
- const prefetchHtml = generateScriptLinks(prefetchOutputs.map(o => o.fileName), 'prefetch');
87
+ const prefetchHtml = generateScriptLinks(prefetchOutputs.map(o => o.fileName), 'prefetch', ctx, resolvedViteConfig);
68
88
  // Index
69
89
  const indexOutput = result.output.find(o => o.name === 'index' && o.type === 'chunk');
70
- await writeHtml(indexOutput.fileName, styleOutput.fileName, 'index.html', {
90
+ const indexHtml = generateEntryHtml(indexOutput.fileName, styleOutput.fileName, {
71
91
  HEAD: `${preloadHtml}${prefetchHtml}`,
72
- }, ctx);
92
+ }, ctx, resolvedViteConfig);
93
+ await writeFile('index.html', indexHtml, ctx);
73
94
  // Sandbox
74
95
  const sandboxOutput = result.output.find(o => o.name === 'sandbox' && o.type === 'chunk');
75
- await writeHtml(sandboxOutput.fileName, styleOutput.fileName, '__sandbox.html', {}, ctx);
96
+ const sandboxHtml = generateEntryHtml(sandboxOutput.fileName, styleOutput.fileName, {}, ctx, resolvedViteConfig);
97
+ await writeFile('__sandbox.html', sandboxHtml, ctx);
76
98
  const duration = performance.now() - startTime;
77
99
  if (emptyStoryCount) {
78
100
  console.warn(pc.yellow(`⚠️ ${emptyStoryCount} empty story file`));
79
101
  }
80
102
  console.log(pc.green(`✅ Built ${storyCount} stories (${variantCount} variants) in ${Math.round(duration / 1000 * 100) / 100}s`));
103
+ // Render
104
+ if (previewStoryCallbacks.length) {
105
+ const { baseUrl, close } = await startPreview(resolvedViteConfig, null, ctx);
106
+ for (const storyFile of ctx.storyFiles) {
107
+ const story = storyFile.story;
108
+ for (const variant of story.variants) {
109
+ const query = new URLSearchParams();
110
+ query.append('storyId', story.id);
111
+ query.append('variantId', variant.id);
112
+ const url = `${baseUrl}__sandbox?${query.toString()}`;
113
+ for (const fn of previewStoryCallbacks) {
114
+ await fn({
115
+ file: storyFile.path,
116
+ story,
117
+ variant,
118
+ url,
119
+ });
120
+ }
121
+ }
122
+ }
123
+ await close();
124
+ }
125
+ await server.close();
126
+ for (const fn of buildEndCallbacks) {
127
+ await fn();
128
+ }
81
129
  }
82
- async function writeHtml(jsEntryFile, cssEntryFile, htmlFileName, variables, ctx) {
83
- const code = `<!DOCTYPE html>
130
+ function generateBaseHtml(head, body, ctx) {
131
+ return `<!DOCTYPE html>
84
132
  <html>
85
133
  <head>
86
134
  <title>${ctx.config.theme.title}</title>
87
135
  <meta charset="utf-8">
88
136
  <meta name="viewport" content="width=device-width,initial-scale=1">
89
137
  <meta name="description" content="">
90
- <link rel="stylesheet" href="/${cssEntryFile}">
91
- ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.config.theme.favicon}"/>` : ''}
92
- ${variables.HEAD ?? ''}
138
+ ${head}
93
139
  </head>
94
140
  <body>
95
- <div id="app"></div>
96
- <script type="module" src="/${jsEntryFile}"></script>
141
+ ${body}
97
142
  </body>
98
143
  </html>`;
99
- await fs.writeFile(join(ctx.config.outDir, htmlFileName), code, 'utf8');
100
144
  }
101
- function generateScriptLinks(prefetchScripts, rel) {
102
- return prefetchScripts.map(s => `<link rel="${rel}" href="${s}" as="script" crossOrigin="anonymous">`).join('');
145
+ function generateEntryHtml(jsEntryFile, cssEntryFile, variables, ctx, resolvedViteConfig) {
146
+ return generateBaseHtml(`<link rel="stylesheet" href="${resolvedViteConfig.base}${cssEntryFile}">
147
+ ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.config.theme.favicon}"/>` : ''}
148
+ ${variables.HEAD ?? ''}`, `<div id="app"></div>
149
+ <script type="module" src="${resolvedViteConfig.base}${jsEntryFile}"></script>`, ctx);
150
+ }
151
+ async function writeFile(fileName, content, ctx) {
152
+ await fs.writeFile(join(ctx.config.outDir, fileName), content, 'utf8');
153
+ }
154
+ function generateScriptLinks(prefetchScripts, rel, ctx, resolvedViteConfig) {
155
+ return prefetchScripts.map(s => `<link rel="${rel}" href="${resolvedViteConfig.base}${s}" as="script" crossOrigin="anonymous">`).join('');
103
156
  }
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '../plugin.js';
2
+ export interface TailwindTokensOptions {
3
+ configFile?: string;
4
+ }
5
+ export declare function tailwindTokens(options?: TailwindTokensOptions): Plugin;