New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@astrojs/solid-js

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/solid-js - npm Package Compare versions

Comparing version 0.0.0-cloudcannon-fix-20230306211609 to 0.0.0-dupicate-content-entry-improved-message-20231220220040

36

dist/client.js

@@ -1,2 +0,1 @@

import { sharedConfig } from "solid-js";
import { createComponent, hydrate, render } from "solid-js/web";

@@ -9,21 +8,31 @@ var client_default = (element) => (Component, props, slotted, { client }) => {

return;
const fn = client === "only" ? render : hydrate;
const boostrap = client === "only" ? render : hydrate;
let slot;
let _slots = {};
if (Object.keys(slotted).length > 0) {
if (sharedConfig.context) {
element.querySelectorAll("astro-slot").forEach((slot) => {
_slots[slot.getAttribute("name") || "default"] = slot.cloneNode(true);
if (client !== "only") {
const iterator = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, (node) => {
if (node === element)
return NodeFilter.FILTER_SKIP;
if (node.nodeName === "ASTRO-SLOT")
return NodeFilter.FILTER_ACCEPT;
if (node.nodeName === "ASTRO-ISLAND")
return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_SKIP;
});
} else {
for (const [key, value] of Object.entries(slotted)) {
_slots[key] = document.createElement("astro-slot");
if (key !== "default")
_slots[key].setAttribute("name", key);
_slots[key].innerHTML = value;
}
while (slot = iterator.nextNode())
_slots[slot.getAttribute("name") || "default"] = slot;
}
for (const [key, value] of Object.entries(slotted)) {
if (_slots[key])
continue;
_slots[key] = document.createElement("astro-slot");
if (key !== "default")
_slots[key].setAttribute("name", key);
_slots[key].innerHTML = value;
}
}
const { default: children, ...slots } = _slots;
const renderId = element.dataset.solidRenderId;
fn(
const dispose = boostrap(
() => createComponent(Component, {

@@ -39,2 +48,3 @@ ...props,

);
element.addEventListener("astro:unmount", () => dispose(), { once: true });
};

@@ -41,0 +51,0 @@ export {

@@ -1,3 +0,3 @@

import type { RendererContext } from './types';
declare type Context = {
import type { RendererContext } from './types.js';
type Context = {
id: string;

@@ -4,0 +4,0 @@ c: number;

import type { AstroIntegration } from 'astro';
export default function (): AstroIntegration;
import { type Options as ViteSolidPluginOptions } from 'vite-plugin-solid';
export type Options = Pick<ViteSolidPluginOptions, 'include' | 'exclude'>;
export default function (opts?: Options): AstroIntegration;

@@ -1,24 +0,5 @@

import { getSolidPkgsConfig } from "./dependencies.js";
function getRenderer() {
return {
name: "@astrojs/solid-js",
clientEntrypoint: "@astrojs/solid-js/client.js",
serverEntrypoint: "@astrojs/solid-js/server.js",
jsxImportSource: "solid-js",
jsxTransformOptions: async ({ ssr }) => {
const [{ default: solid }] = await Promise.all([import("babel-preset-solid")]);
const options = {
presets: [solid({}, { generate: ssr ? "ssr" : "dom", hydratable: true })],
plugins: [],
inputSourceMap: false
};
return options;
}
};
}
async function getViteConfiguration(isDev, astroConfig) {
import solid, {} from "vite-plugin-solid";
async function getViteConfiguration(isDev, { include, exclude } = {}) {
const nestedDeps = ["solid-js", "solid-js/web", "solid-js/store", "solid-js/html", "solid-js/h"];
const solidPkgsConfig = await getSolidPkgsConfig(!isDev, astroConfig);
return {
esbuild: { include: /\.ts$/ },
resolve: {

@@ -30,19 +11,42 @@ conditions: ["solid", ...isDev ? ["development"] : []],

optimizeDeps: {
include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],
exclude: ["@astrojs/solid-js/server.js", ...solidPkgsConfig.optimizeDeps.exclude]
include: [...nestedDeps],
exclude: ["@astrojs/solid-js/server.js"]
},
plugins: [
solid({ include, exclude, dev: isDev, ssr: true }),
{
name: "@astrojs/solid:config-overrides",
enforce: "post",
config() {
return {
esbuild: {
// To support using alongside other JSX frameworks, still let
// esbuild compile stuff. Solid goes first anyways.
include: /\.(m?ts|[jt]sx)$/
}
};
}
}
],
ssr: {
target: "node",
external: ["babel-preset-solid", ...solidPkgsConfig.ssr.external],
noExternal: ["solid-js", ...solidPkgsConfig.ssr.noExternal]
external: ["babel-preset-solid"]
}
};
}
function src_default() {
function getRenderer() {
return {
name: "@astrojs/solid-js",
clientEntrypoint: "@astrojs/solid-js/client.js",
serverEntrypoint: "@astrojs/solid-js/server.js"
};
}
function src_default(opts = {}) {
return {
name: "@astrojs/solid-js",
hooks: {
"astro:config:setup": async ({ command, addRenderer, updateConfig, config }) => {
"astro:config:setup": async ({ command, addRenderer, updateConfig }) => {
addRenderer(getRenderer());
updateConfig({ vite: await getViteConfiguration(command === "dev", config) });
updateConfig({
vite: await getViteConfiguration(command === "dev", opts)
});
}

@@ -49,0 +53,0 @@ }

@@ -1,2 +0,2 @@

import type { RendererContext } from './types';
import type { RendererContext } from './types.js';
declare function check(this: RendererContext, Component: any, props: Record<string, any>, children: any): boolean;

@@ -12,3 +12,4 @@ declare function renderToStaticMarkup(this: RendererContext, Component: any, props: Record<string, any>, { default: children, ...slotted }: any, metadata?: undefined | Record<string, any>): {

renderToStaticMarkup: typeof renderToStaticMarkup;
supportsAstroStaticSlot: boolean;
};
export default _default;

@@ -7,2 +7,4 @@ import { createComponent, renderToString, ssr } from "solid-js/web";

return false;
if (Component.name === "QwikComponent")
return false;
const { html } = renderToStaticMarkup.call(this, Component, props, children);

@@ -12,3 +14,5 @@ return typeof html === "string";

function renderToStaticMarkup(Component, props, { default: children, ...slotted }, metadata) {
const renderId = (metadata == null ? void 0 : metadata.hydrate) ? incrementId(getContext(this.result)) : "";
const renderId = metadata?.hydrate ? incrementId(getContext(this.result)) : "";
const needsHydrate = metadata?.astroStaticSlot ? !!metadata.hydrate : true;
const tagName = needsHydrate ? "astro-slot" : "astro-static-slot";
const html = renderToString(

@@ -19,3 +23,3 @@ () => {

const name = slotName(key);
slots[name] = ssr(`<astro-slot name="${name}">${value}</astro-slot>`);
slots[name] = ssr(`<${tagName} name="${name}">${value}</${tagName}>`);
}

@@ -25,3 +29,4 @@ const newProps = {

...slots,
children: children != null ? ssr(`<astro-slot>${children}</astro-slot>`) : children
// In Solid SSR mode, `ssr` creates the expected structure for `children`.
children: children != null ? ssr(`<${tagName}>${children}</${tagName}>`) : children
};

@@ -43,3 +48,4 @@ return createComponent(Component, newProps);

check,
renderToStaticMarkup
renderToStaticMarkup,
supportsAstroStaticSlot: true
};

@@ -46,0 +52,0 @@ export {

import type { SSRResult } from 'astro';
export declare type RendererContext = {
export type RendererContext = {
result: SSRResult;
};
{
"name": "@astrojs/solid-js",
"version": "0.0.0-cloudcannon-fix-20230306211609",
"version": "0.0.0-dupicate-content-entry-improved-message-20231220220040",
"description": "Use Solid components within Astro",

@@ -29,10 +29,12 @@ "type": "module",

},
"files": [
"dist"
],
"dependencies": {
"babel-preset-solid": "^1.4.2",
"vitefu": "^0.2.4"
"vite-plugin-solid": "^2.7.0"
},
"devDependencies": {
"astro": "0.0.0-cloudcannon-fix-20230306211609",
"astro-scripts": "0.0.0-cloudcannon-fix-20230306211609",
"solid-js": "^1.5.1"
"solid-js": "^1.8.5",
"astro": "0.0.0-dupicate-content-entry-improved-message-20231220220040",
"astro-scripts": "0.0.14"
},

@@ -43,4 +45,7 @@ "peerDependencies": {

"engines": {
"node": ">=16.12.0"
"node": ">=18.14.1"
},
"publishConfig": {
"provenance": true
},
"scripts": {

@@ -47,0 +52,0 @@ "build": "astro-scripts build \"src/**/*.ts\" && tsc",

@@ -12,2 +12,3 @@ # @astrojs/solid-js 💙

Astro includes a CLI tool for adding first party integrations: `astro add`. This command will:
1. (Optionally) Install all necessary dependencies and peer dependencies

@@ -45,12 +46,12 @@ 2. (Also optionally) Update your `astro.config.*` file to apply this integration

__`astro.config.mjs`__
```diff lang="js" "solid()"
// astro.config.mjs
import { defineConfig } from 'astro/config';
+ import solid from '@astrojs/solid-js';
```js ins={2} "solid()"
import { defineConfig } from 'astro/config';
import solid from '@astrojs/solid-js';
export default defineConfig({
// ...
integrations: [solid()],
});
export default defineConfig({
// ...
integrations: [solid()],
// ^^^^^^^
});
```

@@ -61,2 +62,3 @@

To use your first SolidJS component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore:
- 📦 how framework components are loaded,

@@ -66,2 +68,38 @@ - 💧 client-side hydration options, and

## Options
### Combining multiple JSX frameworks
When you are using multiple JSX frameworks (React, Preact, Solid) in the same project, Astro needs to determine which JSX framework-specific transformations should be used for each of your components. If you have only added one JSX framework integration to your project, no extra configuration is needed.
Use the `include` (required) and `exclude` (optional) configuration options to specify which files belong to which framework. Provide an array of files and/or folders to `include` for each framework you are using. Wildcards may be used to include multiple file paths.
We recommend placing common framework components in the same folder (e.g. `/components/react/` and `/components/solid/`) to make specifying your includes easier, but this is not required:
```js
// astro.config.mjs
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact';
import react from '@astrojs/react';
import svelte from '@astrojs/svelte';
import vue from '@astrojs/vue';
import solid from '@astrojs/solid-js';
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
// No `include` is needed if you are only using a single JSX framework!
integrations: [
preact({
include: ['**/preact/*'],
}),
react({
include: ['**/react/*'],
}),
solid({
include: ['**/solid/*'],
}),
],
});
```
## Troubleshooting

@@ -68,0 +106,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc