npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@samijaber/lib-test

v0.0.2

Published

Use Qwik SDK to connect your Qwik application to Builder.io.

Downloads

4

Readme

Builder.io SDK for Qwik

Use Qwik SDK to connect your Qwik application to Builder.io.

Installation

Installing the Qwik SDK is done in two steps:

  1. Set up Qwik-city project.
  2. Install the Qwik SDK into your Qwik-city project.

Fetch

This Package uses fetch. See these docs for more information.

Set up Qwik-city project

  1. Follow the instructions on Qwik-city
npm init qwik@latest

Follow instructions for setting up Qwik-city project.

Install the Qwik SDK into your Qwik-city project

Add @builder.io/sdk-qwik to your package.json file:

npm add --save @builder.io/sdk-qwik

Add Qwik SDK code to a particular route (such as src/routes/index.tsx)

import { component$ } from "@builder.io/qwik";
import { loader$ } from "@builder.io/qwik-city";
import {
  getBuilderSearchParams,
  getContent,
  RenderContent,
} from "@builder.io/sdk-qwik";

export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE"; // ggignore
export const MODEL = 'page';

export const builderContentLoader = loader$(({ url }) => {
  return getContent({
    model: MODEL,
    apiKey: BUILDER_PUBLIC_API_KEY,
    options: {
      ...getBuilderSearchParams(url.searchParams),
      cachebust: true,
    },
    userAttributes: {
      urlPath: url.pathname || "/",
    },
  });
});

export default component$(() => {
  const builderContent = builderContentLoader.use();
  return (
    <div>
      <RenderContent
        model={MODEL}
        content={builderContent.value}
        apiKey={BUILDER_PUBLIC_API_KEY}
        // Optional: pass in a custom component registry
        // customComponents={CUSTOM_COMPONENTS}
      />
    </div>
  );
});

// OPTIONAL: need to add custom components to your Qwik app

export const MyFunComponent = component$((props: { text: string }) => {
  const state = useStore({
    count: 0,
  });

  return (
    <div>
      <h3>{props.text.toUpperCase()}</h3>
      <p>{state.count}</p>
      <button onClick$={() => state.count++}>Click me</button>
    </div>
  );
});

export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
  {
    component: MyFunComponent,
    name: 'MyFunComponent',

    inputs: [
      {
        name: 'text',
        type: 'string',
        defaultValue: 'Hello world',
      },
    ],
  },
];

[Beta] Guide to use API Version v3 to query for content

For using API Version v3, you need to add apiVersion: 'v3' to the getContent function and in the RenderContent tag. For example:

import { component$ } from "@builder.io/qwik";
import { loader$ } from "@builder.io/qwik-city";
import {
  getBuilderSearchParams,
  getContent,
  RenderContent,
} from "@builder.io/sdk-qwik";

export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE";
export const MODEL = "page";

export const builderContentLoader = loader$(({ url }) => {
  return getContent({
    model: MODEL,
    apiKey: BUILDER_PUBLIC_API_KEY,
    apiVersion: "v3",
    options: {
      ...getBuilderSearchParams(url.searchParams),
      cachebust: true,
    },
    userAttributes: {
      urlPath: url.pathname || "/",
    },
  });
});

export default component$(() => {
  const builderContent = builderContentLoader.use();
  return (
    <div>
      <RenderContent
        model={MODEL}
        content={builderContent.value}
        apiKey={BUILDER_PUBLIC_API_KEY}
        apiVersion="v3"
      />
    </div>
  );
});

Reasons to switch to API Version v3

  • Better, more scalable infra: Query v3 is built on global scale infrastructure to ensure fast response times and high availability
  • Ability to ship more features, faster: Query V3 will allow us to keep shipping the latest features to our customers without breaking fundamental flows. These will be shipped only to Query V3 and not to the older versions of the query API

Coming soon...

  • Better support for localization: Some of the newer features of localization and querying based on it will be better supported in Query V3
  • Support multi-level nested references: Query V3 will allow you to query, resolve, and return content that has nested references of other contents and symbols.

Mitosis

This SDK is generated by Mitosis. To see the Mitosis source-code, go here.