react-cosmos 7.4.1-canary.5d13b43.0 → 7.4.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { sendFile } from '../shared/sendFile.js';
|
|
2
3
|
import { resolveSilent } from '../utils/resolveSilent.js';
|
|
3
4
|
export const pluginEndpointPlugin = {
|
|
4
5
|
name: 'pluginEndpoint',
|
|
@@ -16,7 +17,7 @@ export const pluginEndpointPlugin = {
|
|
|
16
17
|
res.sendStatus(404);
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
sendFile(res, resolvedPath);
|
|
20
21
|
});
|
|
21
22
|
},
|
|
22
23
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { getDevPlaygroundHtml } from '../shared/playgroundHtml.js';
|
|
3
|
+
import { sendFile } from '../shared/sendFile.js';
|
|
3
4
|
import { getStaticPath } from '../shared/staticPath.js';
|
|
4
5
|
import { resolve } from '../utils/resolve.js';
|
|
5
6
|
export async function createExpressApp(platform, config, pluginConfigs) {
|
|
@@ -8,13 +9,13 @@ export async function createExpressApp(platform, config, pluginConfigs) {
|
|
|
8
9
|
res.send(await getDevPlaygroundHtml(platform, config, pluginConfigs));
|
|
9
10
|
});
|
|
10
11
|
app.get('/playground.bundle.js', (_, res) => {
|
|
11
|
-
|
|
12
|
+
sendFile(res, resolve('react-cosmos-ui/dist/playground.bundle.js'));
|
|
12
13
|
});
|
|
13
14
|
app.get('/playground.bundle.js.map', (_, res) => {
|
|
14
|
-
|
|
15
|
+
sendFile(res, resolve('react-cosmos-ui/dist/playground.bundle.js.map'));
|
|
15
16
|
});
|
|
16
17
|
app.get('/_cosmos.ico', (_, res) => {
|
|
17
|
-
|
|
18
|
+
sendFile(res, getStaticPath('favicon.ico'));
|
|
18
19
|
});
|
|
19
20
|
return app;
|
|
20
21
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
// Express 5 (send >= 1) responds with 404 when any segment of the served path
|
|
3
|
+
// is a dotfile, and package managers like pnpm resolve modules inside a .pnpm
|
|
4
|
+
// directory. Sending the file name relative to its own directory keeps the
|
|
5
|
+
// dotfile check scoped to the file itself, which is what we serve anyway.
|
|
6
|
+
export function sendFile(res, filePath) {
|
|
7
|
+
res.sendFile(path.basename(filePath), { root: path.dirname(filePath) });
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos",
|
|
3
|
-
"version": "7.4.1
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Sandbox for developing and testing UI components in isolation",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"micromatch": "4.0.8",
|
|
16
16
|
"open": "11.0.0",
|
|
17
17
|
"pem": "1.14.8",
|
|
18
|
-
"react-cosmos-core": "7.4.
|
|
19
|
-
"react-cosmos-renderer": "7.4.
|
|
20
|
-
"react-cosmos-ui": "7.4.
|
|
18
|
+
"react-cosmos-core": "^7.4.0",
|
|
19
|
+
"react-cosmos-renderer": "^7.4.0",
|
|
20
|
+
"react-cosmos-ui": "^7.4.0",
|
|
21
21
|
"ws": "8.21.3",
|
|
22
22
|
"yargs": "18.1.0"
|
|
23
23
|
},
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"cosmos-export": "./bin/cosmos-export.js",
|
|
31
31
|
"cosmos-native": "./bin/cosmos-native.js"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "aa2d7824289241837bd1eabf981f29db2e675b74"
|
|
34
34
|
}
|