-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
104 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/solid-js': minor | ||
--- | ||
|
||
Auto ssr.noExternal solidjs dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Support strict dependency install for libraries with JSX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/astro/test/fixtures/solid-component/src/pages/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
--- | ||
import Hello from '../components/Hello.jsx'; | ||
import WithNewlines from '../components/WithNewlines.jsx'; | ||
import { Router } from "@solidjs/router"; | ||
--- | ||
<html> | ||
<head><title>Solid</title></head> | ||
<body> | ||
<div> | ||
<Hello client:load /> | ||
<WithNewlines client:load /> | ||
<Router /> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// This file is a fork of vite-plugin-solid. | ||
// Original: https://github.com/solidjs/vite-plugin-solid/blob/03130c8a0a2ceaab9a07e16f1e1df832b996e1b8/src/index.ts#L251-L297 | ||
// License: MIT (https://github.com/solidjs/vite-plugin-solid/blob/03130c8a0a2ceaab9a07e16f1e1df832b996e1b8/package.json#L38) | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { createRequire } from 'module'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
function containsSolidField(fields: Record<string, any>) { | ||
const keys = Object.keys(fields); | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
if (key === 'solid') return true; | ||
if (typeof fields[key] === 'object' && containsSolidField(fields[key])) return true; | ||
} | ||
return false; | ||
} | ||
|
||
export function getSolidDeps(root: URL) { | ||
const pkgPath = path.join(fileURLToPath(root), 'package.json'); | ||
if (!fs.existsSync(pkgPath)) { | ||
// eslint-disable-next-line no-console | ||
console.log('No package.json found at project root'); | ||
return []; | ||
} | ||
const require = createRequire(pkgPath); | ||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')); | ||
const deps = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})]; | ||
const pkgs = deps.map((dep) => { | ||
try { | ||
return require(`${dep}/package.json`); | ||
} catch { | ||
try { | ||
let dir = path.dirname(require.resolve(dep)); | ||
while (dir) { | ||
const subPkgPath = path.join(dir, 'package.json'); | ||
if (fs.existsSync(subPkgPath)) { | ||
const subPkg = JSON.parse(fs.readFileSync(subPkgPath, 'utf-8')); | ||
if (subPkg && subPkg.name === dep) return subPkg; | ||
} | ||
const parent = path.dirname(dir); | ||
if (parent === dir) { | ||
break; | ||
} | ||
dir = parent; | ||
} | ||
} catch (e) { | ||
console.warn("Couldn't find package.json for", dep, e); | ||
} | ||
} | ||
}); | ||
return deps.reduce<string[]>((acc, dep, i) => { | ||
if (pkgs[i] && pkgs[i].exports && containsSolidField(pkgs[i].exports)) acc.push(dep); | ||
return acc; | ||
}, []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.