@jkwd/inbase 0.1.17 → 0.1.18
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/apps/explorer/vite.config.ts +6 -12
- package/bin/project.mjs +9 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineConfig, type Plugin } from 'vite'
|
|
2
2
|
import react from '@vitejs/plugin-react'
|
|
3
|
-
import { createRequire } from 'node:module'
|
|
4
3
|
import { spawnSync } from 'node:child_process'
|
|
5
4
|
import fs from 'node:fs'
|
|
6
5
|
import path from 'node:path'
|
|
@@ -8,7 +7,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
8
7
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
9
8
|
import { emptyIntent } from './scripts/patch-lib.mjs'
|
|
10
9
|
import { readBranchChanges } from './scripts/branch-changes.mjs'
|
|
11
|
-
import { writeRunningInstance, isolatedViteConfig,
|
|
10
|
+
import { writeRunningInstance, isolatedViteConfig, packageDirFromPackage } from '../../bin/project.mjs'
|
|
12
11
|
import { dataDir, targetRoot } from './scripts/target-config.mjs'
|
|
13
12
|
import { editorFileUri, openInEditor } from './scripts/open-editor.mjs'
|
|
14
13
|
import {
|
|
@@ -36,12 +35,7 @@ import {
|
|
|
36
35
|
} from './scripts/session-store.mjs'
|
|
37
36
|
|
|
38
37
|
const here = path.dirname(fileURLToPath(import.meta.url))
|
|
39
|
-
const requireFromPackage = createRequire(path.join(packageRoot, 'package.json'))
|
|
40
38
|
const isolation = isolatedViteConfig(dataDir)
|
|
41
|
-
|
|
42
|
-
function pkgDir(name: string) {
|
|
43
|
-
return path.dirname(requireFromPackage.resolve(`${name}/package.json`))
|
|
44
|
-
}
|
|
45
39
|
const userContextFile = path.join(dataDir, 'user-context.json')
|
|
46
40
|
const codebaseFile = path.join(dataDir, 'codebase.json')
|
|
47
41
|
const scanScript = path.resolve(here, 'scripts/scan-target.mjs')
|
|
@@ -489,11 +483,11 @@ export default defineConfig({
|
|
|
489
483
|
plugins: [react(), jsonFilePlugin()],
|
|
490
484
|
resolve: {
|
|
491
485
|
alias: {
|
|
492
|
-
react:
|
|
493
|
-
'react-dom':
|
|
494
|
-
three:
|
|
495
|
-
'@react-three/fiber':
|
|
496
|
-
'@react-three/drei':
|
|
486
|
+
react: packageDirFromPackage('react'),
|
|
487
|
+
'react-dom': packageDirFromPackage('react-dom'),
|
|
488
|
+
three: packageDirFromPackage('three'),
|
|
489
|
+
'@react-three/fiber': packageDirFromPackage('@react-three/fiber'),
|
|
490
|
+
'@react-three/drei': packageDirFromPackage('@react-three/drei'),
|
|
497
491
|
},
|
|
498
492
|
dedupe: ['react', 'react-dom', 'three', '@react-three/fiber', '@react-three/drei'],
|
|
499
493
|
},
|
package/bin/project.mjs
CHANGED
|
@@ -15,6 +15,15 @@ export function resolveFromPackage(specifier) {
|
|
|
15
15
|
return requireFromPackage.resolve(specifier)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export function packageDirFromPackage(name) {
|
|
19
|
+
let dir = path.dirname(resolveFromPackage(name))
|
|
20
|
+
while (dir !== path.dirname(dir)) {
|
|
21
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) return dir
|
|
22
|
+
dir = path.dirname(dir)
|
|
23
|
+
}
|
|
24
|
+
return dir
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
/** Vite config that never uses the host project's cache, deps, or browser targets. */
|
|
19
28
|
export function isolatedViteConfig(dataDir) {
|
|
20
29
|
return {
|