solidstep 0.3.3 → 0.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solidstep",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Next Step SolidJS Framework for building web applications.",
5
5
  "type": "module",
6
6
  "author": "HamzaKV <hamzakv333@gmail.com>",
@@ -13,6 +13,7 @@
13
13
  ".": "./index.js",
14
14
  "./hooks/action-state": "./utils/hooks/action-state.js",
15
15
  "./utils/cache": "./utils/cache.js",
16
+ "./utils/client-only": "./utils/client-only.js",
16
17
  "./utils/cookies": "./utils/cookies.js",
17
18
  "./utils/cors": "./utils/cors.js",
18
19
  "./utils/csp": "./utils/csp.js",
@@ -23,6 +24,7 @@
23
24
  "./utils/loader": "./utils/loader.js",
24
25
  "./utils/logger": "./utils/logger.js",
25
26
  "./utils/meta": "./utils/meta.js",
27
+ "./utils/options": "./utils/options.js",
26
28
  "./utils/redirect": "./utils/redirect.js",
27
29
  "./utils/server-only": "./utils/server-only.js"
28
30
  },
package/server.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAkfA,QAAA,MAAM,OAAO,2FA0XX,CAAC;AAEH,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAkfA,QAAA,MAAM,OAAO,2FAqYX,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/server.js CHANGED
@@ -369,6 +369,10 @@ onStart();
369
369
  const handler = eventHandler(async (event) => {
370
370
  const req = toWebRequest(event);
371
371
  try {
372
+ if (req.url.includes('/.well-known/appspecific/com.chrome.devtools.json')) {
373
+ setResponseStatus(204);
374
+ return;
375
+ }
372
376
  if (req.url?.includes('_server')) {
373
377
  return handleServerFunction(event);
374
378
  }
@@ -683,6 +687,10 @@ const handler = eventHandler(async (event) => {
683
687
  return stream;
684
688
  }
685
689
  catch (e) {
690
+ if (e instanceof RedirectError ||
691
+ e.name === 'RedirectError') {
692
+ return new Response('', { status: 302, headers: { Location: e.message } });
693
+ }
686
694
  console.error(e);
687
695
  return new Response('Internal Server Error', { status: 500 });
688
696
  }
@@ -0,0 +1,6 @@
1
+ import type { Component, ComponentProps, JSX } from 'solid-js';
2
+ declare const clientOnly: <T extends Component<any>>(component: T, options?: {
3
+ fallback?: JSX.Element;
4
+ }) => (props: ComponentProps<T>) => JSX.Element;
5
+ export default clientOnly;
6
+ //# sourceMappingURL=client-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-only.d.ts","sourceRoot":"","sources":["../../utils/client-only.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAU,MAAM,UAAU,CAAC;AAavE,QAAA,MAAM,UAAU,GAAI,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,EACxC,WAAW,CAAC,EACZ,UAAU;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CAAE,aAMtB,cAAc,CAAC,CAAC,CAAC,gBAanC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { createMemo, createSignal, onMount, sharedConfig, untrack } from 'solid-js';
2
+ import { isServer } from 'solid-js/web';
3
+ const load = (fn, setComp) => {
4
+ fn().then(m => setComp(() => m.default));
5
+ };
6
+ const clientOnly = (component, options) => {
7
+ if (isServer)
8
+ return () => (options?.fallback) ?? null;
9
+ const [comp, setComp] = createSignal();
10
+ load(async () => ({ default: component }), setComp);
11
+ return (props) => {
12
+ let Comp;
13
+ let m;
14
+ if ((Comp = comp()) && !sharedConfig.context)
15
+ return Comp(props);
16
+ const [mounted, setMounted] = createSignal(!sharedConfig.context);
17
+ onMount(() => setMounted(true));
18
+ return createMemo(() => (
19
+ // biome-ignore lint/style/noCommaOperator: <explanation>
20
+ (Comp = comp()), (m = mounted()), untrack(() => (Comp && m ? Comp(props) : options?.fallback))));
21
+ };
22
+ };
23
+ export default clientOnly;
@@ -0,0 +1,15 @@
1
+ export type Options = {
2
+ cache?: {
3
+ ttl?: number;
4
+ };
5
+ responseHeaders?: {
6
+ [key: string]: string;
7
+ };
8
+ hydration?: {
9
+ disable?: boolean;
10
+ blockRender?: boolean;
11
+ fetchPriority?: 'high' | 'low' | 'auto';
12
+ };
13
+ };
14
+ export declare const options: (options: Options) => Options;
15
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../utils/options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,KAAK,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,eAAe,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC;IACF,SAAS,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;KAC3C,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,SAAS,OAAO,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export const options = (options) => options;