nitropack-nightly 2.11.7-20250309-110549.0fedd3a3 → 2.11.7-20250317-120939.729315be

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.
@@ -1,3 +1,3 @@
1
- const version = "2.11.7-20250309-110549.0fedd3a3";
1
+ const version = "2.11.7-20250317-120939.729315be";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.7-20250309-110549.0fedd3a3";
1
+ const version = "2.11.7-20250317-120939.729315be";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.7-20250309-110549.0fedd3a3";
1
+ const version = "2.11.7-20250317-120939.729315be";
2
2
 
3
3
  export { version };
@@ -13,14 +13,14 @@ import {
13
13
  fetchNodeRequestHandler,
14
14
  callNodeRequestHandler
15
15
  } from "node-mock-http";
16
- import errorHandler from "#nitro-internal-virtual/error-handler";
17
- import { plugins } from "#nitro-internal-virtual/plugins";
18
- import { handlers } from "#nitro-internal-virtual/server-handlers";
19
16
  import { cachedEventHandler } from "./cache.mjs";
20
17
  import { useRuntimeConfig } from "./config.mjs";
21
18
  import { nitroAsyncContext } from "./context.mjs";
22
19
  import { createRouteRulesHandler, getRouteRulesForPath } from "./route-rules.mjs";
23
20
  import { normalizeFetchResponse } from "./utils.mjs";
21
+ import errorHandler from "#nitro-internal-virtual/error-handler";
22
+ import { plugins } from "#nitro-internal-virtual/plugins";
23
+ import { handlers } from "#nitro-internal-virtual/server-handlers";
24
24
  function createNitroApp() {
25
25
  const config = useRuntimeConfig();
26
26
  const hooks = createHooks();
@@ -1,6 +1,2 @@
1
- export declare function hash(value: any): any;
2
- /**
3
- Source: https://github.com/unjs/ohash/blob/v1/src/object-hash.ts
4
- Based on https://github.com/puleos/object-hash v3.0.0 (MIT)
5
- */
6
1
  export declare function serialize(object: any): string;
2
+ export declare function hash(value: any): any;
@@ -1,179 +1,183 @@
1
1
  import { digest } from "ohash";
2
- export function hash(value) {
3
- return digest(typeof value === "string" ? value : serialize(value)).replace(/[-_]/g, "").slice(0, 10);
4
- }
5
- export function serialize(object) {
6
- const hasher = new Hasher();
7
- hasher.dispatch(object);
8
- return hasher.buff;
9
- }
10
- class Hasher {
11
- buff = "";
12
- #context = /* @__PURE__ */ new Map();
13
- write(str) {
14
- this.buff += str;
15
- }
16
- dispatch(value) {
17
- const type = value === null ? "null" : typeof value;
18
- return this[type](value);
19
- }
20
- object(object) {
21
- if (object && typeof object.toJSON === "function") {
22
- return this.object(object.toJSON());
23
- }
24
- const objString = Object.prototype.toString.call(object);
25
- let objType = "";
26
- const objectLength = objString.length;
27
- objType = objectLength < 10 ? "unknown:[" + objString + "]" : objString.slice(8, objectLength - 1);
28
- objType = objType.toLowerCase();
29
- let objectNumber = null;
30
- if ((objectNumber = this.#context.get(object)) === void 0) {
31
- this.#context.set(object, this.#context.size);
32
- } else {
33
- return this.dispatch("[CIRCULAR:" + objectNumber + "]");
34
- }
35
- if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
36
- this.write("buffer:");
37
- return this.write(object.toString("utf8"));
38
- }
39
- if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
40
- if (this[objType]) {
41
- this[objType](object);
2
+ const Hasher = /* @__PURE__ */ (() => {
3
+ class Hasher2 {
4
+ buff = "";
5
+ #context = /* @__PURE__ */ new Map();
6
+ write(str) {
7
+ this.buff += str;
8
+ }
9
+ dispatch(value) {
10
+ const type = value === null ? "null" : typeof value;
11
+ return this[type](value);
12
+ }
13
+ object(object) {
14
+ if (object && typeof object.toJSON === "function") {
15
+ return this.object(object.toJSON());
16
+ }
17
+ const objString = Object.prototype.toString.call(object);
18
+ let objType = "";
19
+ const objectLength = objString.length;
20
+ objType = objectLength < 10 ? "unknown:[" + objString + "]" : objString.slice(8, objectLength - 1);
21
+ objType = objType.toLowerCase();
22
+ let objectNumber = null;
23
+ if ((objectNumber = this.#context.get(object)) === void 0) {
24
+ this.#context.set(object, this.#context.size);
42
25
  } else {
43
- this.unknown(object, objType);
26
+ return this.dispatch("[CIRCULAR:" + objectNumber + "]");
44
27
  }
45
- } else {
46
- const keys = Object.keys(object).sort();
47
- const extraKeys = [];
48
- this.write("object:" + (keys.length + extraKeys.length) + ":");
49
- const dispatchForKey = (key) => {
50
- this.dispatch(key);
51
- this.write(":");
52
- this.dispatch(object[key]);
53
- this.write(",");
54
- };
55
- for (const key of keys) {
56
- dispatchForKey(key);
28
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
29
+ this.write("buffer:");
30
+ return this.write(object.toString("utf8"));
57
31
  }
58
- for (const key of extraKeys) {
59
- dispatchForKey(key);
32
+ if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
33
+ if (this[objType]) {
34
+ this[objType](object);
35
+ } else {
36
+ this.unknown(object, objType);
37
+ }
38
+ } else {
39
+ const keys = Object.keys(object).sort();
40
+ const extraKeys = [];
41
+ this.write("object:" + (keys.length + extraKeys.length) + ":");
42
+ const dispatchForKey = (key) => {
43
+ this.dispatch(key);
44
+ this.write(":");
45
+ this.dispatch(object[key]);
46
+ this.write(",");
47
+ };
48
+ for (const key of keys) {
49
+ dispatchForKey(key);
50
+ }
51
+ for (const key of extraKeys) {
52
+ dispatchForKey(key);
53
+ }
60
54
  }
61
55
  }
62
- }
63
- array(arr, unordered) {
64
- unordered = unordered === void 0 ? false : unordered;
65
- this.write("array:" + arr.length + ":");
66
- if (!unordered || arr.length <= 1) {
67
- for (const entry of arr) {
68
- this.dispatch(entry);
56
+ array(arr, unordered) {
57
+ unordered = unordered === void 0 ? false : unordered;
58
+ this.write("array:" + arr.length + ":");
59
+ if (!unordered || arr.length <= 1) {
60
+ for (const entry of arr) {
61
+ this.dispatch(entry);
62
+ }
63
+ return;
69
64
  }
70
- return;
71
- }
72
- const contextAdditions = /* @__PURE__ */ new Map();
73
- const entries = arr.map((entry) => {
74
- const hasher = new Hasher();
75
- hasher.dispatch(entry);
76
- for (const [key, value] of hasher.#context) {
77
- contextAdditions.set(key, value);
65
+ const contextAdditions = /* @__PURE__ */ new Map();
66
+ const entries = arr.map((entry) => {
67
+ const hasher = new Hasher2();
68
+ hasher.dispatch(entry);
69
+ for (const [key, value] of hasher.#context) {
70
+ contextAdditions.set(key, value);
71
+ }
72
+ return hasher.toString();
73
+ });
74
+ this.#context = contextAdditions;
75
+ entries.sort();
76
+ return this.array(entries, false);
77
+ }
78
+ date(date) {
79
+ return this.write("date:" + date.toJSON());
80
+ }
81
+ symbol(sym) {
82
+ return this.write("symbol:" + sym.toString());
83
+ }
84
+ unknown(value, type) {
85
+ this.write(type);
86
+ if (!value) {
87
+ return;
88
+ }
89
+ this.write(":");
90
+ if (value && typeof value.entries === "function") {
91
+ return this.array(
92
+ [...value.entries()],
93
+ true
94
+ /* ordered */
95
+ );
78
96
  }
79
- return hasher.toString();
80
- });
81
- this.#context = contextAdditions;
82
- entries.sort();
83
- return this.array(entries, false);
84
- }
85
- date(date) {
86
- return this.write("date:" + date.toJSON());
87
- }
88
- symbol(sym) {
89
- return this.write("symbol:" + sym.toString());
90
- }
91
- unknown(value, type) {
92
- this.write(type);
93
- if (!value) {
94
- return;
95
- }
96
- this.write(":");
97
- if (value && typeof value.entries === "function") {
98
- return this.array(
99
- [...value.entries()],
100
- true
101
- /* ordered */
102
- );
103
97
  }
104
- }
105
- error(err) {
106
- return this.write("error:" + err.toString());
107
- }
108
- boolean(bool) {
109
- return this.write("bool:" + bool);
110
- }
111
- string(string) {
112
- this.write("string:" + string.length + ":");
113
- this.write(string);
114
- }
115
- function(fn) {
116
- this.write("fn:");
117
- if (isNativeFunction(fn)) {
118
- this.dispatch("[native]");
119
- } else {
120
- this.dispatch(fn.toString());
98
+ error(err) {
99
+ return this.write("error:" + err.toString());
100
+ }
101
+ boolean(bool) {
102
+ return this.write("bool:" + bool);
103
+ }
104
+ string(string) {
105
+ this.write("string:" + string.length + ":");
106
+ this.write(string);
107
+ }
108
+ function(fn) {
109
+ this.write("fn:");
110
+ if (isNativeFunction(fn)) {
111
+ this.dispatch("[native]");
112
+ } else {
113
+ this.dispatch(fn.toString());
114
+ }
115
+ }
116
+ number(number) {
117
+ return this.write("number:" + number);
118
+ }
119
+ null() {
120
+ return this.write("Null");
121
+ }
122
+ undefined() {
123
+ return this.write("Undefined");
124
+ }
125
+ regexp(regex) {
126
+ return this.write("regex:" + regex.toString());
127
+ }
128
+ arraybuffer(arr) {
129
+ this.write("arraybuffer:");
130
+ return this.dispatch(new Uint8Array(arr));
131
+ }
132
+ url(url) {
133
+ return this.write("url:" + url.toString());
134
+ }
135
+ map(map) {
136
+ this.write("map:");
137
+ const arr = [...map];
138
+ return this.array(arr, false);
139
+ }
140
+ set(set) {
141
+ this.write("set:");
142
+ const arr = [...set];
143
+ return this.array(arr, false);
144
+ }
145
+ bigint(number) {
146
+ return this.write("bigint:" + number.toString());
121
147
  }
122
148
  }
123
- number(number) {
124
- return this.write("number:" + number);
125
- }
126
- null() {
127
- return this.write("Null");
128
- }
129
- undefined() {
130
- return this.write("Undefined");
131
- }
132
- regexp(regex) {
133
- return this.write("regex:" + regex.toString());
134
- }
135
- arraybuffer(arr) {
136
- this.write("arraybuffer:");
137
- return this.dispatch(new Uint8Array(arr));
138
- }
139
- url(url) {
140
- return this.write("url:" + url.toString());
141
- }
142
- map(map) {
143
- this.write("map:");
144
- const arr = [...map];
145
- return this.array(arr, false);
146
- }
147
- set(set) {
148
- this.write("set:");
149
- const arr = [...set];
150
- return this.array(arr, false);
151
- }
152
- bigint(number) {
153
- return this.write("bigint:" + number.toString());
149
+ for (const type of [
150
+ "uint8array",
151
+ "uint8clampedarray",
152
+ "unt8array",
153
+ "uint16array",
154
+ "unt16array",
155
+ "uint32array",
156
+ "unt32array",
157
+ "float32array",
158
+ "float64array"
159
+ ]) {
160
+ Hasher2.prototype[type] = function(arr) {
161
+ this.write(type + ":");
162
+ return this.array([...arr], false);
163
+ };
164
+ }
165
+ function isNativeFunction(f) {
166
+ if (typeof f !== "function") {
167
+ return false;
168
+ }
169
+ return Function.prototype.toString.call(f).slice(
170
+ -15
171
+ /* "[native code] }".length */
172
+ ) === "[native code] }";
154
173
  }
174
+ return Hasher2;
175
+ })();
176
+ export function serialize(object) {
177
+ const hasher = new Hasher();
178
+ hasher.dispatch(object);
179
+ return hasher.buff;
155
180
  }
156
- for (const type of [
157
- "uint8array",
158
- "uint8clampedarray",
159
- "unt8array",
160
- "uint16array",
161
- "unt16array",
162
- "uint32array",
163
- "unt32array",
164
- "float32array",
165
- "float64array"
166
- ]) {
167
- Hasher.prototype[type] = function(arr) {
168
- this.write(type + ":");
169
- return this.array([...arr], false);
170
- };
171
- }
172
- const nativeFunc = "[native code] }";
173
- const nativeFuncLength = nativeFunc.length;
174
- function isNativeFunction(f) {
175
- if (typeof f !== "function") {
176
- return false;
177
- }
178
- return Function.prototype.toString.call(f).slice(-nativeFuncLength) === nativeFunc;
181
+ export function hash(value) {
182
+ return digest(typeof value === "string" ? value : serialize(value)).replace(/[-_]/g, "").slice(0, 10);
179
183
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.11.7-20250309-110549.0fedd3a3",
3
+ "version": "2.11.7-20250317-120939.729315be",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",