histoire 0.10.1 → 0.10.2

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.
@@ -1,4 +1,4 @@
1
- import { getInjectedImport } from '../util/deps.js';
1
+ import { getInjectedImport } from '../util/vendors.js';
2
2
  import { findUp } from '../util/find-up.js';
3
3
  export function tailwindTokens(options = {}) {
4
4
  const tailwindConfigFile = options.configFile ?? findUp(process.cwd(), [
File without changes
@@ -0,0 +1,12 @@
1
+ // https://github.com/vitejs/vite/issues/9661
2
+ const alias = {
3
+ '@histoire/vendors/vue': 'histoire/dist/node/vendors/vue.js',
4
+ '@histoire/controls': 'histoire/dist/node/vendors/controls.js',
5
+ };
6
+ export function getInjectedImport(request) {
7
+ let id = request;
8
+ if (alias[id]) {
9
+ id = alias[id];
10
+ }
11
+ return JSON.stringify(id);
12
+ }
@@ -0,0 +1 @@
1
+ export * from '@histoire/controls';
@@ -0,0 +1 @@
1
+ export * from '@histoire/controls';
@@ -0,0 +1 @@
1
+ export * from '@histoire/vendors/vue';
@@ -0,0 +1 @@
1
+ export * from '@histoire/vendors/vue';
package/dist/node/vite.js CHANGED
@@ -8,7 +8,7 @@ import { makeTree } from './tree.js';
8
8
  import { parseColor } from './colors.js';
9
9
  import { createMarkdownPlugins } from './markdown.js';
10
10
  import { getSearchDataJS, generateDocSearchData, generateTitleSearchData } from './search.js';
11
- import { getInjectedImport } from './util/deps.js';
11
+ import { getInjectedImport } from './util/vendors.js';
12
12
  const require = createRequire(import.meta.url);
13
13
  export const STORIES_ID = '$histoire-stories';
14
14
  export const RESOLVED_STORIES_ID = `/${STORIES_ID}-resolved`;
@@ -119,6 +119,7 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
119
119
  // Disable warnings
120
120
  'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'),
121
121
  },
122
+ cacheDir: isServer ? 'node_modules/.hst-vite-server' : 'node_modules/.hst-vite',
122
123
  };
123
124
  },
124
125
  async resolveId(id, importer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "A fast story book powered by Vite",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -29,10 +29,10 @@
29
29
  "histoire": "./bin.mjs"
30
30
  },
31
31
  "dependencies": {
32
- "@histoire/app": "^0.10.1",
33
- "@histoire/controls": "^0.10.1",
34
- "@histoire/shared": "^0.10.1",
35
- "@histoire/vendors": "^0.10.1",
32
+ "@histoire/app": "^0.10.2",
33
+ "@histoire/controls": "^0.10.2",
34
+ "@histoire/shared": "^0.10.2",
35
+ "@histoire/vendors": "^0.10.2",
36
36
  "@types/flexsearch": "^0.7.3",
37
37
  "@types/markdown-it": "^12.2.3",
38
38
  "birpc": "^0.1.1",
@@ -1,5 +1,5 @@
1
1
  import { BasePluginApi, Plugin } from '../plugin.js'
2
- import { getInjectedImport } from '../util/deps.js'
2
+ import { getInjectedImport } from '../util/vendors.js'
3
3
  import { findUp } from '../util/find-up.js'
4
4
 
5
5
  export interface TailwindTokensOptions {
@@ -0,0 +1,15 @@
1
+ // https://github.com/vitejs/vite/issues/9661
2
+ const alias = {
3
+ '@histoire/vendors/vue': 'histoire/dist/node/vendors/vue.js',
4
+ '@histoire/controls': 'histoire/dist/node/vendors/controls.js',
5
+ }
6
+
7
+ export function getInjectedImport (request: string) {
8
+ let id: string = request
9
+
10
+ if (alias[id]) {
11
+ id = alias[id]
12
+ }
13
+
14
+ return JSON.stringify(id)
15
+ }
@@ -0,0 +1 @@
1
+ export * from '@histoire/controls'
@@ -0,0 +1 @@
1
+ export * from '@histoire/vendors/vue'
package/src/node/vite.ts CHANGED
@@ -17,7 +17,7 @@ import { makeTree } from './tree.js'
17
17
  import { parseColor } from './colors.js'
18
18
  import { createMarkdownPlugins } from './markdown.js'
19
19
  import { getSearchDataJS, generateDocSearchData, generateTitleSearchData } from './search.js'
20
- import { getInjectedImport } from './util/deps.js'
20
+ import { getInjectedImport } from './util/vendors.js'
21
21
 
22
22
  const require = createRequire(import.meta.url)
23
23
 
@@ -137,6 +137,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
137
137
  // Disable warnings
138
138
  'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'),
139
139
  },
140
+ cacheDir: isServer ? 'node_modules/.hst-vite-server' : 'node_modules/.hst-vite',
140
141
  }
141
142
  },
142
143
 
@@ -1,9 +0,0 @@
1
- import { dirname, join } from 'pathe';
2
- import { fileURLToPath } from 'url';
3
- import { createRequire } from 'module';
4
- const __dirname = dirname(fileURLToPath(import.meta.url));
5
- const require = createRequire(import.meta.url);
6
- const isInHistoireMonorepo = __dirname.includes(join('packages', 'histoire', 'dist'));
7
- export function getInjectedImport(request) {
8
- return JSON.stringify(isInHistoireMonorepo ? require.resolve(request) : request);
9
- }
@@ -1,12 +0,0 @@
1
- import { dirname, join } from 'pathe'
2
- import { fileURLToPath } from 'url'
3
- import { createRequire } from 'module'
4
-
5
- const __dirname = dirname(fileURLToPath(import.meta.url))
6
- const require = createRequire(import.meta.url)
7
-
8
- const isInHistoireMonorepo = __dirname.includes(join('packages', 'histoire', 'dist'))
9
-
10
- export function getInjectedImport (request: string) {
11
- return JSON.stringify(isInHistoireMonorepo ? require.resolve(request) : request)
12
- }