@spirobel/mininext 0.2.25 → 0.2.27

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/dist/html.js CHANGED
@@ -59,7 +59,9 @@ export function html(strings, ...values) {
59
59
  if (Array.isArray(value) &&
60
60
  value.every((val) => val instanceof HtmlString)) {
61
61
  // If the value is an array of HtmlString objects, add the whole array as a single value
62
- values[index] = value;
62
+ const notResolved = new HtmlString(...value);
63
+ notResolved.resolved = false;
64
+ values[index] = notResolved;
63
65
  htmlStringArray.resolved = false; // we could bother with .find here
64
66
  }
65
67
  else if (typeof value === "function") {
@@ -108,7 +110,9 @@ function JsonTemplateProcessor(danger = false) {
108
110
  if (Array.isArray(value) &&
109
111
  value.every((val) => val instanceof HtmlString)) {
110
112
  // If the value is an array of HtmlString objects, add the whole array as a single value
111
- values[index] = value;
113
+ const notResolved = new HtmlString(...value);
114
+ notResolved.resolved = false;
115
+ values[index] = notResolved;
112
116
  jsonStringArray.resolved = false; // we could bother with .find here
113
117
  }
114
118
  else if (typeof value === "function") {
package/dist/mininext.js CHANGED
@@ -48,7 +48,7 @@ async function buildBackend(backendPath = "backend/backend.ts") {
48
48
  outdir: path.resolve(projectRoot(), "dist"),
49
49
  naming: "backend.js",
50
50
  minify: Bun.argv[2] === "dev" ? false : true, //production
51
- target: "node",
51
+ target: "bun",
52
52
  define: {
53
53
  FrontendScripts: JSON.stringify(FrontendScripts),
54
54
  FrontendScriptUrls: JSON.stringify(FrontendScriptUrls),
package/dist/url.d.ts CHANGED
@@ -146,7 +146,7 @@ export declare class url {
146
146
  * @param handler - normal html handler with mini as the argument
147
147
  * @returns a wrapped html handler that will only be called when the request is post
148
148
  */
149
- static post(handler: HtmlHandler): (mini: Mini) => LazyHandlerReturnType;
149
+ static post<Y = unknown>(handler: HtmlHandler<Y>): (mini: Mini<Y>) => LazyHandlerReturnType;
150
150
  /**
151
151
  * wrap your handlers in this if you mutate something to prevent CSRF issues.
152
152
  * @param handler - normal html handler with mini as the argument
package/mininext/html.ts CHANGED
@@ -82,7 +82,9 @@ export function html<X = unknown>(
82
82
  value.every((val) => val instanceof HtmlString)
83
83
  ) {
84
84
  // If the value is an array of HtmlString objects, add the whole array as a single value
85
- values[index] = value;
85
+ const notResolved = new HtmlString(...(value as any[]));
86
+ notResolved.resolved = false;
87
+ values[index] = notResolved;
86
88
  htmlStringArray.resolved = false; // we could bother with .find here
87
89
  } else if (typeof value === "function") {
88
90
  htmlStringArray.resolved = false;
@@ -145,7 +147,9 @@ function JsonTemplateProcessor(danger: boolean = false) {
145
147
  value.every((val) => val instanceof HtmlString)
146
148
  ) {
147
149
  // If the value is an array of HtmlString objects, add the whole array as a single value
148
- values[index] = value;
150
+ const notResolved = new HtmlString(...(value as any[]));
151
+ notResolved.resolved = false;
152
+ values[index] = notResolved;
149
153
  jsonStringArray.resolved = false; // we could bother with .find here
150
154
  } else if (typeof value === "function") {
151
155
  jsonStringArray.resolved = false;
@@ -59,7 +59,7 @@ async function buildBackend(backendPath: string = "backend/backend.ts") {
59
59
  outdir: path.resolve(projectRoot(), "dist"),
60
60
  naming: "backend.js",
61
61
  minify: Bun.argv[2] === "dev" ? false : true, //production
62
- target: "node",
62
+ target: "bun",
63
63
  define: {
64
64
  FrontendScripts: JSON.stringify(FrontendScripts),
65
65
  FrontendScriptUrls: JSON.stringify(FrontendScriptUrls),
package/mininext/url.ts CHANGED
@@ -272,8 +272,8 @@ export class url {
272
272
  * @param handler - normal html handler with mini as the argument
273
273
  * @returns a wrapped html handler that will only be called when the request is post
274
274
  */
275
- static post(handler: HtmlHandler) {
276
- return (mini: Mini) => {
275
+ static post<Y = unknown>(handler: HtmlHandler<Y>) {
276
+ return (mini: Mini<Y>) => {
277
277
  if (mini.form.post) {
278
278
  return handler(mini);
279
279
  } else {
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  },
14
14
  "files": ["dist", "mininext"],
15
- "version": "0.2.25",
15
+ "version": "0.2.27",
16
16
  "devDependencies": {
17
17
  "@types/bun": "latest"
18
18
  },