poveste 0.17.2 → 0.18.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/dist/node/context.js +11 -3
- package/dist/node/vite.d.ts +7 -1
- package/dist/node/vite.js +22 -18
- package/package.json +8 -6
package/dist/node/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { resolveConfig as resolveViteConfig } from 'vite';
|
|
1
|
+
import { loadConfigFromFile as loadViteConfigFromFile, resolveConfig as resolveViteConfig } from 'vite';
|
|
2
2
|
import { processConfig, resolveConfig } from './config.js';
|
|
3
3
|
import { viteCommand, viteMode } from './util/vite-mode.js';
|
|
4
|
-
import { mergePovesteViteConfig } from './vite.js';
|
|
4
|
+
import { mergePovesteViteConfig, withoutIgnoredPlugins } from './vite.js';
|
|
5
5
|
export async function createContext(options) {
|
|
6
6
|
const config = await resolveConfig(process.cwd(), options.mode, options.configFile);
|
|
7
7
|
const command = viteCommand(options.mode);
|
|
@@ -9,7 +9,15 @@ export async function createContext(options) {
|
|
|
9
9
|
// `'development'` whatever the command, and `base` from this resolution is
|
|
10
10
|
// what the hand-written index.html uses while the bundle uses the build's.
|
|
11
11
|
// A user config setting `base` by mode would otherwise disagree with itself.
|
|
12
|
-
|
|
12
|
+
// Through `viteIgnorePlugins`, as the dev server and the build are: an ignored
|
|
13
|
+
// plugin's `config` hook still runs in a resolution that skips it, and SvelteKit's
|
|
14
|
+
// sets a relative `base` here, which index.html then carries (#1200).
|
|
15
|
+
const userViteConfig = await loadViteConfigFromFile({ command, mode: viteMode(options.mode) });
|
|
16
|
+
const viteConfig = await resolveViteConfig({
|
|
17
|
+
...userViteConfig?.config,
|
|
18
|
+
configFile: false,
|
|
19
|
+
plugins: await withoutIgnoredPlugins(userViteConfig?.config.plugins, config.viteIgnorePlugins),
|
|
20
|
+
}, command, viteMode(options.mode));
|
|
13
21
|
const supportPlugins = config.plugins.flatMap(p => p.supportPlugin ? [p.supportPlugin] : []);
|
|
14
22
|
const partial = {
|
|
15
23
|
root: viteConfig.root,
|
package/dist/node/vite.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PovesteConfig } from '@poveste/shared';
|
|
2
|
+
import type { InlineConfig, PluginOption } from 'vite';
|
|
2
3
|
import type { Context } from './context.js';
|
|
4
|
+
/**
|
|
5
|
+
* The user's plugins, flattened one level as Vite's own options are, without the
|
|
6
|
+
* ones `viteIgnorePlugins` names.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withoutIgnoredPlugins(plugins: PluginOption[] | undefined, ignored: PovesteConfig['viteIgnorePlugins']): Promise<PluginOption[]>;
|
|
3
9
|
export declare function mergePovesteViteConfig(viteConfig: InlineConfig, ctx: Pick<Context, 'config' | 'mode'>): Promise<InlineConfig>;
|
|
4
10
|
export interface ViteConfigWithPlugins {
|
|
5
11
|
viteConfig: InlineConfig;
|
package/dist/node/vite.js
CHANGED
|
@@ -13,6 +13,23 @@ import { viteCommand, viteMode } from './util/vite-mode.js';
|
|
|
13
13
|
import { collapseVendoredVue } from './vendors.js';
|
|
14
14
|
import { createVirtualFilesPlugin } from './virtual/vite-plugin.js';
|
|
15
15
|
const require = createRequire(import.meta.url);
|
|
16
|
+
/**
|
|
17
|
+
* The user's plugins, flattened one level as Vite's own options are, without the
|
|
18
|
+
* ones `viteIgnorePlugins` names.
|
|
19
|
+
*/
|
|
20
|
+
export async function withoutIgnoredPlugins(plugins, ignored) {
|
|
21
|
+
const flat = [];
|
|
22
|
+
for (const pluginOption of plugins ?? []) {
|
|
23
|
+
const resolvedPluginOption = await pluginOption;
|
|
24
|
+
if (Array.isArray(resolvedPluginOption)) {
|
|
25
|
+
flat.push(...await Promise.all(resolvedPluginOption));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
flat.push(resolvedPluginOption);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return flat.filter(plugin => plugin && !('name' in plugin && ignored?.includes(plugin.name)));
|
|
32
|
+
}
|
|
16
33
|
export async function mergePovesteViteConfig(viteConfig, ctx) {
|
|
17
34
|
if (ctx.config.vite) {
|
|
18
35
|
const command = viteCommand(ctx.mode);
|
|
@@ -26,24 +43,7 @@ export async function mergePovesteViteConfig(viteConfig, ctx) {
|
|
|
26
43
|
viteConfig = mergeViteConfig(viteConfig, overrides);
|
|
27
44
|
}
|
|
28
45
|
}
|
|
29
|
-
|
|
30
|
-
if (viteConfig.plugins) {
|
|
31
|
-
for (const pluginOption of viteConfig.plugins) {
|
|
32
|
-
const resolvedPluginOption = await pluginOption;
|
|
33
|
-
if (Array.isArray(resolvedPluginOption)) {
|
|
34
|
-
flatPlugins.push(...await Promise.all(resolvedPluginOption));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
flatPlugins.push(resolvedPluginOption);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
flatPlugins = flatPlugins.filter(Boolean);
|
|
41
|
-
}
|
|
42
|
-
const ignoredPlugins = ctx.config.viteIgnorePlugins;
|
|
43
|
-
if (ignoredPlugins) {
|
|
44
|
-
flatPlugins = flatPlugins.filter(plugin => !(plugin && 'name' in plugin && ignoredPlugins.includes(plugin.name)));
|
|
45
|
-
}
|
|
46
|
-
viteConfig.plugins = flatPlugins;
|
|
46
|
+
viteConfig.plugins = await withoutIgnoredPlugins(viteConfig.plugins, ctx.config.viteIgnorePlugins);
|
|
47
47
|
return viteConfig;
|
|
48
48
|
}
|
|
49
49
|
export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
@@ -148,6 +148,10 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
|
|
|
148
148
|
config(_, { command }) {
|
|
149
149
|
const collapsedVue = isServer || process.env['POVESTE_DEV'] ? {} : collapseVendoredVue({ root: ctx.root });
|
|
150
150
|
return {
|
|
151
|
+
// The book is a single-page app whatever the project's framework says: a
|
|
152
|
+
// framework serving its own app sets `custom`, which turns off the fallback
|
|
153
|
+
// that serves `/story/...` (#1200).
|
|
154
|
+
appType: 'spa',
|
|
151
155
|
resolve: {
|
|
152
156
|
dedupe: [
|
|
153
157
|
'vue',
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poveste",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "Interactive component playgrounds for Vue, Nuxt, Svelte, SvelteKit and Quasar — a drop-in fork of histoire, with Quasar support histoire does not ship.",
|
|
4
|
+
"version": "0.18.0",
|
|
5
|
+
"description": "Interactive component playgrounds for Vue, Nuxt, Svelte, SvelteKit and Quasar, plus Solid (renderer only) — a drop-in fork of histoire, with Quasar support histoire does not ship.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan",
|
|
8
8
|
"url": "https://x.com/50rayn"
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"svelte",
|
|
30
30
|
"nuxt",
|
|
31
31
|
"sveltekit",
|
|
32
|
+
"solid",
|
|
33
|
+
"solidjs",
|
|
32
34
|
"cli"
|
|
33
35
|
],
|
|
34
36
|
"publishConfig": {
|
|
@@ -75,10 +77,10 @@
|
|
|
75
77
|
},
|
|
76
78
|
"dependencies": {
|
|
77
79
|
"@11ty/gray-matter": "^3.0.0",
|
|
78
|
-
"@poveste/app": "^0.
|
|
79
|
-
"@poveste/controls": "^0.
|
|
80
|
-
"@poveste/shared": "^0.
|
|
81
|
-
"@poveste/vendors": "^0.
|
|
80
|
+
"@poveste/app": "^0.18.0",
|
|
81
|
+
"@poveste/controls": "^0.18.0",
|
|
82
|
+
"@poveste/shared": "^0.18.0",
|
|
83
|
+
"@poveste/vendors": "^0.18.0",
|
|
82
84
|
"change-case": "^5.4.4",
|
|
83
85
|
"chokidar": "^5.0.0",
|
|
84
86
|
"defu": "^6.1.4",
|