@lerret/cli 0.1.1 → 0.1.3
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-studio/.bundle-stamp +1 -1
- package/package.json +3 -1
- package/src/dev.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lerret/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "The `lerret` design canvas CLI — a folder of plain React component files renders as a visual canvas. Includes the Vite dev server, headless export, and the bundled studio.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"@vitejs/plugin-react": "^6.0.2",
|
|
39
39
|
"chokidar": "^5.0.0",
|
|
40
40
|
"playwright-core": "^1.60.0",
|
|
41
|
+
"react": "^19.2.0",
|
|
42
|
+
"react-dom": "^19.2.0",
|
|
41
43
|
"vite": "^8.0.0",
|
|
42
44
|
"@lerret/core": "^0.1.1"
|
|
43
45
|
},
|
package/src/dev.js
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
import { parseArgs } from 'node:util';
|
|
32
32
|
import { dirname, resolve } from 'node:path';
|
|
33
33
|
import { fileURLToPath } from 'node:url';
|
|
34
|
+
import { createRequire } from 'node:module';
|
|
34
35
|
|
|
35
36
|
import { realpathOrSelf, pathExists } from './fs/node-backend.js';
|
|
36
37
|
import { resolveProject } from './resolve-project.js';
|
|
@@ -293,12 +294,26 @@ export async function runDev(argv) {
|
|
|
293
294
|
|
|
294
295
|
const workspaceRoot = searchForWorkspaceRoot(studioRoot);
|
|
295
296
|
|
|
297
|
+
// The user's `.jsx` assets get transformed by Vite/esbuild into imports
|
|
298
|
+
// of `react/jsx-dev-runtime`. The user's project has no `node_modules`,
|
|
299
|
+
// so those imports must resolve against the CLI's own React. Alias the
|
|
300
|
+
// bare specifiers to the CLI-bundled copy.
|
|
301
|
+
const cliRequire = createRequire(import.meta.url);
|
|
302
|
+
const reactAliases = [
|
|
303
|
+
{ find: 'react/jsx-dev-runtime', replacement: cliRequire.resolve('react/jsx-dev-runtime') },
|
|
304
|
+
{ find: 'react/jsx-runtime', replacement: cliRequire.resolve('react/jsx-runtime') },
|
|
305
|
+
{ find: 'react-dom/client', replacement: cliRequire.resolve('react-dom/client') },
|
|
306
|
+
{ find: /^react-dom$/, replacement: cliRequire.resolve('react-dom') },
|
|
307
|
+
{ find: /^react$/, replacement: cliRequire.resolve('react') },
|
|
308
|
+
];
|
|
309
|
+
|
|
296
310
|
const server = await createServer({
|
|
297
311
|
// Don't pick up the studio's own `vite.config.js` (it has a fixture
|
|
298
312
|
// alias the CLI doesn't want); we hand Vite a clean inline config.
|
|
299
313
|
configFile: false,
|
|
300
314
|
root: studioRoot,
|
|
301
315
|
plugins,
|
|
316
|
+
resolve: { alias: reactAliases },
|
|
302
317
|
server: {
|
|
303
318
|
port: flags.port,
|
|
304
319
|
open: flags.open,
|