react-cosmos-plugin-vite 6.0.0-alpha.0 → 6.0.0-alpha.11
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/cosmos.plugin.json +1 -2
- package/dist/createViteCosmosConfig.d.ts +6 -0
- package/dist/createViteCosmosConfig.js +6 -0
- package/dist/reactCosmosViteRollupPlugin.d.ts +1 -1
- package/dist/reactCosmosViteRollupPlugin.js +1 -1
- package/dist/viteConfigPlugin.d.ts +2 -0
- package/dist/viteConfigPlugin.js +18 -0
- package/dist/viteDevServerPlugin.d.ts +2 -2
- package/dist/viteDevServerPlugin.js +2 -2
- package/dist/viteExportPlugin.d.ts +2 -2
- package/dist/viteExportPlugin.js +2 -2
- package/dist/viteServerPlugin.d.ts +3 -0
- package/dist/viteServerPlugin.js +10 -0
- package/package.json +5 -5
package/cosmos.plugin.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { generateUserDepsModule, getPlaygroundUrl, } from 'react-cosmos
|
|
2
|
+
import { generateUserDepsModule, getPlaygroundUrl, } from 'react-cosmos';
|
|
3
3
|
import { createViteRendererIndex } from './createViteRendererIndex.js';
|
|
4
4
|
export const userDepsVirtualModuleId = 'virtual:cosmos-userdeps';
|
|
5
5
|
export const userDepsResolvedModuleId = '\0' + userDepsVirtualModuleId;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { findNextAvailablePort, } from 'react-cosmos';
|
|
2
|
+
import { createViteCosmosConfig } from './createViteCosmosConfig.js';
|
|
3
|
+
export async function viteConfigPlugin({ cosmosConfig, }) {
|
|
4
|
+
const { rendererUrl } = cosmosConfig;
|
|
5
|
+
if (rendererUrl) {
|
|
6
|
+
return cosmosConfig;
|
|
7
|
+
}
|
|
8
|
+
const viteCosmosConfig = createViteCosmosConfig(cosmosConfig);
|
|
9
|
+
const port = await findNextAvailablePort(viteCosmosConfig.port, cosmosConfig.portRetries);
|
|
10
|
+
return {
|
|
11
|
+
...cosmosConfig,
|
|
12
|
+
rendererUrl: `http://localhost:${port}`,
|
|
13
|
+
vite: {
|
|
14
|
+
...viteCosmosConfig,
|
|
15
|
+
port: port,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevServerPluginArgs } from 'react-cosmos
|
|
2
|
-
export
|
|
1
|
+
import { DevServerPluginArgs } from 'react-cosmos';
|
|
2
|
+
export declare function viteDevServerPlugin({ platformType, cosmosConfig, }: DevServerPluginArgs): Promise<(() => void) | undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { startFixtureWatcher
|
|
1
|
+
import { startFixtureWatcher } from 'react-cosmos';
|
|
2
2
|
import { createServer } from 'vite';
|
|
3
3
|
import { reactCosmosViteRollupPlugin, userDepsResolvedModuleId, } from './reactCosmosViteRollupPlugin.js';
|
|
4
|
-
export
|
|
4
|
+
export async function viteDevServerPlugin({ platformType, cosmosConfig, }) {
|
|
5
5
|
if (platformType !== 'web')
|
|
6
6
|
return;
|
|
7
7
|
const { rendererUrl } = cosmosConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ExportPluginArgs } from 'react-cosmos
|
|
2
|
-
export
|
|
1
|
+
import { ExportPluginArgs } from 'react-cosmos';
|
|
2
|
+
export declare function viteExportPlugin({ cosmosConfig }: ExportPluginArgs): Promise<void>;
|
package/dist/viteExportPlugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { rename } from 'node:fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { RENDERER_FILENAME } from 'react-cosmos';
|
|
3
4
|
import { removeLeadingSlash } from 'react-cosmos-core';
|
|
4
|
-
import { RENDERER_FILENAME } from 'react-cosmos/server.js';
|
|
5
5
|
import { build } from 'vite';
|
|
6
6
|
import { reactCosmosViteRollupPlugin } from './reactCosmosViteRollupPlugin.js';
|
|
7
|
-
export
|
|
7
|
+
export async function viteExportPlugin({ cosmosConfig }) {
|
|
8
8
|
const { exportPath, publicUrl } = cosmosConfig;
|
|
9
9
|
await build({
|
|
10
10
|
configFile: false,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { viteConfigPlugin } from './viteConfigPlugin.js';
|
|
2
|
+
import { viteDevServerPlugin } from './viteDevServerPlugin.js';
|
|
3
|
+
import { viteExportPlugin } from './viteExportPlugin.js';
|
|
4
|
+
const viteServerPlugin = {
|
|
5
|
+
name: 'vite',
|
|
6
|
+
config: viteConfigPlugin,
|
|
7
|
+
devServer: viteDevServerPlugin,
|
|
8
|
+
export: viteExportPlugin,
|
|
9
|
+
};
|
|
10
|
+
export default viteServerPlugin;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos-plugin-vite",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.11",
|
|
4
4
|
"description": "Vite plugin for React Cosmos",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-plugin-vite",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "cosmos.plugin.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"react-cosmos-core": "^6.0.0-alpha.
|
|
11
|
-
"react-cosmos-dom": "^6.0.0-alpha.
|
|
10
|
+
"react-cosmos-core": "^6.0.0-alpha.11",
|
|
11
|
+
"react-cosmos-dom": "^6.0.0-alpha.11"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"
|
|
14
|
+
"vite": "*"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "8e9d1e52749388f471f6ec848a8c904ec8b89f67"
|
|
17
17
|
}
|