nitro-nightly 3.1.0-20251028-110430-e607b753 → 3.1.0-20251028-131831-fe9fd554

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.
Files changed (157) hide show
  1. package/dist/_build/build.mjs +379 -14
  2. package/dist/_build/{rollup.mjs → build2.mjs} +218 -68
  3. package/dist/_build/info.mjs +963 -7
  4. package/dist/_build/prepare.mjs +1491 -2
  5. package/dist/_build/snapshot.mjs +155 -31
  6. package/dist/_build/vite.mjs +43 -2307
  7. package/dist/_build/vite2.mjs +149 -0
  8. package/dist/{_deps → _chunks/_deps}/c12.mjs +1 -1
  9. package/dist/{_deps → _chunks/_deps}/giget.mjs +1 -1
  10. package/dist/_chunks/_deps/klona.mjs +137 -0
  11. package/dist/{_deps → _chunks/_deps}/knitwork.mjs +1 -1
  12. package/dist/{_deps → _chunks/_deps}/local-pkg.mjs +1 -1
  13. package/dist/{_deps → _chunks/_deps}/mlly.mjs +1 -1
  14. package/dist/{_deps → _chunks/_deps}/nypm.mjs +1 -1
  15. package/dist/{_deps → _chunks/_deps}/pathe.mjs +1 -1
  16. package/dist/{_deps → _chunks/_deps}/pkg-types.mjs +2 -2
  17. package/dist/{_deps → _chunks/_deps}/rou3.mjs +1 -1
  18. package/dist/_chunks/_deps/std-env.mjs +3 -0
  19. package/dist/{_deps → _chunks/_deps}/unimport.mjs +2 -2
  20. package/dist/{_deps → _chunks/_deps}/unplugin-utils.mjs +1 -1
  21. package/dist/{_deps → _chunks/_deps}/untyped.mjs +1 -1
  22. package/dist/{_deps → _chunks/_deps}/unwasm.mjs +2 -2
  23. package/dist/{_presets → _chunks/_presets}/_resolve.mjs +2 -2
  24. package/dist/{_presets → _chunks/_presets}/_utils.mjs +1 -1
  25. package/dist/{_presets → _chunks/_presets}/azure.mjs +1 -1
  26. package/dist/{_presets → _chunks/_presets}/cloudflare.mjs +4 -4
  27. package/dist/{_presets → _chunks/_presets}/deno.mjs +1 -1
  28. package/dist/{_presets → _chunks/_presets}/firebase.mjs +1 -1
  29. package/dist/{_presets → _chunks/_presets}/iis.mjs +1 -1
  30. package/dist/{_presets → _chunks/_presets}/index.mjs +1 -1
  31. package/dist/{_presets → _chunks/_presets}/vercel.mjs +3 -3
  32. package/dist/{_presets → _chunks/_presets}/zeabur.mjs +1 -1
  33. package/dist/_chunks/app.mjs +600 -0
  34. package/dist/_chunks/index.mjs +648 -0
  35. package/dist/_chunks/server.mjs +256 -0
  36. package/dist/_cli/build.mjs +2 -2
  37. package/dist/_cli/dev.mjs +46 -130
  38. package/dist/_cli/index.mjs +1 -1
  39. package/dist/_cli/list.mjs +2 -2
  40. package/dist/_cli/prepare.mjs +2 -2
  41. package/dist/_cli/run.mjs +2 -2
  42. package/dist/cli/index.mjs +1 -1
  43. package/dist/index.mjs +94 -120
  44. package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
  45. package/dist/node_modules/cookie-es/package.json +37 -0
  46. package/dist/node_modules/rendu/dist/index.mjs +380 -0
  47. package/dist/node_modules/rendu/package.json +47 -0
  48. package/dist/runtime/internal/task.mjs +1 -2
  49. package/dist/types/index.d.mts +2 -1
  50. package/dist/vite.mjs +103 -114
  51. package/lib/runtime/meta.mjs +18 -25
  52. package/package.json +9 -10
  53. package/dist/_build/assets.mjs +0 -235
  54. package/dist/_build/config.mjs +0 -124
  55. package/dist/_build/plugins.mjs +0 -1041
  56. package/dist/_build/rolldown.mjs +0 -494
  57. package/dist/_build/types.mjs +0 -268
  58. package/dist/node_modules/klona/dist/index.mjs +0 -81
  59. package/dist/node_modules/klona/full/index.mjs +0 -53
  60. package/dist/node_modules/klona/package.json +0 -74
  61. package/dist/node_modules/std-env/dist/index.mjs +0 -1
  62. package/dist/node_modules/std-env/package.json +0 -46
  63. /package/dist/{_deps → _chunks/_deps}/@jridgewell/gen-mapping.mjs +0 -0
  64. /package/dist/{_deps → _chunks/_deps}/@jridgewell/remapping.mjs +0 -0
  65. /package/dist/{_deps → _chunks/_deps}/@jridgewell/resolve-uri.mjs +0 -0
  66. /package/dist/{_deps → _chunks/_deps}/@jridgewell/sourcemap-codec.mjs +0 -0
  67. /package/dist/{_deps → _chunks/_deps}/@jridgewell/trace-mapping.mjs +0 -0
  68. /package/dist/{_deps → _chunks/_deps}/@pi0/vite-plugin-fullstack.mjs +0 -0
  69. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-alias.mjs +0 -0
  70. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-commonjs.mjs +0 -0
  71. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-inject.mjs +0 -0
  72. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-json.mjs +0 -0
  73. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-node-resolve.mjs +0 -0
  74. /package/dist/{_deps → _chunks/_deps}/@rollup/plugin-replace.mjs +0 -0
  75. /package/dist/{_deps → _chunks/_deps}/@rollup/pluginutils.mjs +0 -0
  76. /package/dist/{_deps → _chunks/_deps}/acorn.mjs +0 -0
  77. /package/dist/{_deps → _chunks/_deps}/chokidar.mjs +0 -0
  78. /package/dist/{_deps → _chunks/_deps}/citty.mjs +0 -0
  79. /package/dist/{_deps → _chunks/_deps}/commondir.mjs +0 -0
  80. /package/dist/{_deps → _chunks/_deps}/compatx.mjs +0 -0
  81. /package/dist/{_deps → _chunks/_deps}/confbox.mjs +0 -0
  82. /package/dist/{_deps → _chunks/_deps}/debug.mjs +0 -0
  83. /package/dist/{_deps → _chunks/_deps}/deepmerge.mjs +0 -0
  84. /package/dist/{_deps → _chunks/_deps}/depd.mjs +0 -0
  85. /package/dist/{_deps → _chunks/_deps}/dot-prop.mjs +0 -0
  86. /package/dist/{_deps → _chunks/_deps}/dotenv.mjs +0 -0
  87. /package/dist/{_deps → _chunks/_deps}/duplexer.mjs +0 -0
  88. /package/dist/{_deps → _chunks/_deps}/ee-first.mjs +0 -0
  89. /package/dist/{_deps → _chunks/_deps}/encodeurl.mjs +0 -0
  90. /package/dist/{_deps → _chunks/_deps}/escape-html.mjs +0 -0
  91. /package/dist/{_deps → _chunks/_deps}/escape-string-regexp.mjs +0 -0
  92. /package/dist/{_deps → _chunks/_deps}/estree-walker.mjs +0 -0
  93. /package/dist/{_deps → _chunks/_deps}/etag.mjs +0 -0
  94. /package/dist/{_deps → _chunks/_deps}/exsolve.mjs +0 -0
  95. /package/dist/{_deps → _chunks/_deps}/fdir.mjs +0 -0
  96. /package/dist/{_deps → _chunks/_deps}/fresh.mjs +0 -0
  97. /package/dist/{_deps → _chunks/_deps}/function-bind.mjs +0 -0
  98. /package/dist/{_deps → _chunks/_deps}/gzip-size.mjs +0 -0
  99. /package/dist/{_deps → _chunks/_deps}/hasown.mjs +0 -0
  100. /package/dist/{_deps → _chunks/_deps}/http-errors.mjs +0 -0
  101. /package/dist/{_deps → _chunks/_deps}/httpxy.mjs +0 -0
  102. /package/dist/{_deps → _chunks/_deps}/inherits.mjs +0 -0
  103. /package/dist/{_deps → _chunks/_deps}/is-core-module.mjs +0 -0
  104. /package/dist/{_deps → _chunks/_deps}/is-module.mjs +0 -0
  105. /package/dist/{_deps → _chunks/_deps}/is-reference.mjs +0 -0
  106. /package/dist/{_deps → _chunks/_deps}/js-tokens.mjs +0 -0
  107. /package/dist/{_deps → _chunks/_deps}/magic-string.mjs +0 -0
  108. /package/dist/{_deps → _chunks/_deps}/mime-db.mjs +0 -0
  109. /package/dist/{_deps → _chunks/_deps}/mime-types.mjs +0 -0
  110. /package/dist/{_deps → _chunks/_deps}/mime.mjs +0 -0
  111. /package/dist/{_deps → _chunks/_deps}/ms.mjs +0 -0
  112. /package/dist/{_deps → _chunks/_deps}/node-fetch-native.mjs +0 -0
  113. /package/dist/{_deps → _chunks/_deps}/on-finished.mjs +0 -0
  114. /package/dist/{_deps → _chunks/_deps}/parseurl.mjs +0 -0
  115. /package/dist/{_deps → _chunks/_deps}/path-parse.mjs +0 -0
  116. /package/dist/{_deps → _chunks/_deps}/perfect-debounce.mjs +0 -0
  117. /package/dist/{_deps → _chunks/_deps}/picomatch.mjs +0 -0
  118. /package/dist/{_deps → _chunks/_deps}/pretty-bytes.mjs +0 -0
  119. /package/dist/{_deps → _chunks/_deps}/quansync.mjs +0 -0
  120. /package/dist/{_deps → _chunks/_deps}/range-parser.mjs +0 -0
  121. /package/dist/{_deps → _chunks/_deps}/rc9.mjs +0 -0
  122. /package/dist/{_deps → _chunks/_deps}/readdirp.mjs +0 -0
  123. /package/dist/{_deps → _chunks/_deps}/resolve.mjs +0 -0
  124. /package/dist/{_deps → _chunks/_deps}/send.mjs +0 -0
  125. /package/dist/{_deps → _chunks/_deps}/serve-static.mjs +0 -0
  126. /package/dist/{_deps → _chunks/_deps}/setprototypeof.mjs +0 -0
  127. /package/dist/{_deps → _chunks/_deps}/statuses.mjs +0 -0
  128. /package/dist/{_deps → _chunks/_deps}/strip-literal.mjs +0 -0
  129. /package/dist/{_deps → _chunks/_deps}/supports-color.mjs +0 -0
  130. /package/dist/{_deps → _chunks/_deps}/tinyexec.mjs +0 -0
  131. /package/dist/{_deps → _chunks/_deps}/tinyglobby.mjs +0 -0
  132. /package/dist/{_deps → _chunks/_deps}/toidentifier.mjs +0 -0
  133. /package/dist/{_deps → _chunks/_deps}/ultrahtml.mjs +0 -0
  134. /package/dist/{_deps → _chunks/_deps}/unplugin.mjs +0 -0
  135. /package/dist/{_deps → _chunks/_deps}/webpack-virtual-modules.mjs +0 -0
  136. /package/dist/{_presets → _chunks/_presets}/_all.mjs +0 -0
  137. /package/dist/{_presets → _chunks/_presets}/_nitro.mjs +0 -0
  138. /package/dist/{_presets → _chunks/_presets}/_static.mjs +0 -0
  139. /package/dist/{_presets → _chunks/_presets}/_types.mjs +0 -0
  140. /package/dist/{_presets → _chunks/_presets}/alwaysdata.mjs +0 -0
  141. /package/dist/{_presets → _chunks/_presets}/aws-amplify.mjs +0 -0
  142. /package/dist/{_presets → _chunks/_presets}/aws-lambda.mjs +0 -0
  143. /package/dist/{_presets → _chunks/_presets}/bun.mjs +0 -0
  144. /package/dist/{_presets → _chunks/_presets}/cleavr.mjs +0 -0
  145. /package/dist/{_presets → _chunks/_presets}/digitalocean.mjs +0 -0
  146. /package/dist/{_presets → _chunks/_presets}/flightcontrol.mjs +0 -0
  147. /package/dist/{_presets → _chunks/_presets}/genezio.mjs +0 -0
  148. /package/dist/{_presets → _chunks/_presets}/heroku.mjs +0 -0
  149. /package/dist/{_presets → _chunks/_presets}/koyeb.mjs +0 -0
  150. /package/dist/{_presets → _chunks/_presets}/netlify.mjs +0 -0
  151. /package/dist/{_presets → _chunks/_presets}/node.mjs +0 -0
  152. /package/dist/{_presets → _chunks/_presets}/platform.mjs +0 -0
  153. /package/dist/{_presets → _chunks/_presets}/render.mjs +0 -0
  154. /package/dist/{_presets → _chunks/_presets}/standard.mjs +0 -0
  155. /package/dist/{_presets → _chunks/_presets}/stormkit.mjs +0 -0
  156. /package/dist/{_presets → _chunks/_presets}/winterjs.mjs +0 -0
  157. /package/dist/{_presets → _chunks/_presets}/zerops.mjs +0 -0
@@ -1,268 +0,0 @@
1
- import { existsSync, promises } from 'node:fs';
2
- import { defu } from 'defu';
3
- import { p as parseNodeModulePath, l as lookupNodeModuleSubpath } from '../_deps/mlly.mjs';
4
- import { r as resolveModulePath } from '../_deps/exsolve.mjs';
5
- import { r as resolveNitroPath, i as isDirectory, w as writeFile } from './assets.mjs';
6
- import { runtimeDir } from 'nitro/runtime/meta';
7
- import { a as resolve, r as relative, b as resolveAlias, i as isAbsolute, j as join, d as dirname } from '../_deps/pathe.mjs';
8
- import { g as generateTypes, r as resolveSchema } from '../_deps/untyped.mjs';
9
- import { t as toExports } from '../_deps/unimport.mjs';
10
-
11
- async function writeTypes(nitro) {
12
- const types = {
13
- routes: {}
14
- };
15
- const typesDir = resolve(nitro.options.buildDir, "types");
16
- const middleware = [...nitro.scannedHandlers, ...nitro.options.handlers];
17
- for (const mw of middleware) {
18
- if (typeof mw.handler !== "string" || !mw.route) {
19
- continue;
20
- }
21
- const relativePath = relative(
22
- typesDir,
23
- resolveNitroPath(mw.handler, nitro.options)
24
- ).replace(/\.(js|mjs|cjs|ts|mts|cts|tsx|jsx)$/, "");
25
- const method = mw.method || "default";
26
- types.routes[mw.route] ??= {};
27
- types.routes[mw.route][method] ??= [];
28
- types.routes[mw.route][method].push(
29
- `Simplify<Serialize<Awaited<ReturnType<typeof import('${relativePath}').default>>>>`
30
- );
31
- }
32
- let autoImportedTypes = [];
33
- let autoImportExports = "";
34
- if (nitro.unimport) {
35
- await nitro.unimport.init();
36
- const allImports = await nitro.unimport.getImports();
37
- autoImportExports = toExports(allImports).replace(
38
- /#internal\/nitro/g,
39
- relative(typesDir, runtimeDir)
40
- );
41
- const resolvedImportPathMap = /* @__PURE__ */ new Map();
42
- for (const i of allImports) {
43
- const from = i.typeFrom || i.from;
44
- if (resolvedImportPathMap.has(from)) {
45
- continue;
46
- }
47
- let path = resolveAlias(from, nitro.options.alias);
48
- if (!isAbsolute(path)) {
49
- const resolvedPath = resolveModulePath(from, {
50
- try: true,
51
- from: nitro.options.nodeModulesDirs,
52
- conditions: ["type", "node", "import"],
53
- suffixes: ["", "/index"],
54
- extensions: [".mjs", ".cjs", ".js", ".mts", ".cts", ".ts"]
55
- });
56
- if (resolvedPath) {
57
- const { dir, name } = parseNodeModulePath(resolvedPath);
58
- if (!dir || !name) {
59
- path = resolvedPath;
60
- } else {
61
- const subpath = await lookupNodeModuleSubpath(resolvedPath);
62
- path = join(dir, name, subpath || "");
63
- }
64
- }
65
- }
66
- if (existsSync(path) && !await isDirectory(path)) {
67
- path = path.replace(/\.[a-z]+$/, "");
68
- }
69
- if (isAbsolute(path)) {
70
- path = relative(typesDir, path);
71
- }
72
- resolvedImportPathMap.set(from, path);
73
- }
74
- autoImportedTypes = [
75
- nitro.options.imports && nitro.options.imports.autoImport !== false ? (await nitro.unimport.generateTypeDeclarations({
76
- exportHelper: false,
77
- resolvePath: (i) => {
78
- const from = i.typeFrom || i.from;
79
- return resolvedImportPathMap.get(from) ?? from;
80
- }
81
- })).trim() : ""
82
- ];
83
- }
84
- const generateRoutes = () => [
85
- "// Generated by nitro",
86
- 'import type { Serialize, Simplify } from "nitro/types";',
87
- 'declare module "nitro/types" {',
88
- " type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T",
89
- " interface InternalApi {",
90
- ...Object.entries(types.routes).map(
91
- ([path, methods]) => [
92
- ` '${path}': {`,
93
- ...Object.entries(methods).map(
94
- ([method, types2]) => ` '${method}': ${types2.join(" | ")}`
95
- ),
96
- " }"
97
- ].join("\n")
98
- ),
99
- " }",
100
- "}",
101
- // Makes this a module for augmentation purposes
102
- "export {}"
103
- ];
104
- const config = [
105
- "// Generated by nitro",
106
- /* ts */
107
- `declare module "nitro/types" {`,
108
- nitro.options.typescript.generateRuntimeConfigTypes ? generateTypes(
109
- await resolveSchema(
110
- Object.fromEntries(
111
- Object.entries(nitro.options.runtimeConfig).filter(
112
- ([key]) => !["app", "nitro"].includes(key)
113
- )
114
- )
115
- ),
116
- {
117
- interfaceName: "NitroRuntimeConfig",
118
- addExport: false,
119
- addDefaults: false,
120
- allowExtraKeys: false,
121
- indentation: 2
122
- }
123
- ) : "",
124
- `}`,
125
- // Makes this a module for augmentation purposes
126
- "export {}"
127
- ];
128
- const declarations = [
129
- // local nitropack augmentations
130
- '/// <reference path="./nitro-routes.d.ts" />',
131
- '/// <reference path="./nitro-config.d.ts" />',
132
- // global server auto-imports
133
- '/// <reference path="./nitro-imports.d.ts" />'
134
- ];
135
- const buildFiles = [];
136
- buildFiles.push({
137
- path: join(typesDir, "nitro-routes.d.ts"),
138
- contents: () => generateRoutes().join("\n")
139
- });
140
- buildFiles.push({
141
- path: join(typesDir, "nitro-config.d.ts"),
142
- contents: config.join("\n")
143
- });
144
- buildFiles.push({
145
- path: join(typesDir, "nitro-imports.d.ts"),
146
- contents: [...autoImportedTypes, autoImportExports || "export {}"].join(
147
- "\n"
148
- )
149
- });
150
- buildFiles.push({
151
- path: join(typesDir, "nitro.d.ts"),
152
- contents: declarations.join("\n")
153
- });
154
- if (nitro.options.typescript.generateTsConfig) {
155
- const tsConfigPath = resolve(
156
- nitro.options.buildDir,
157
- nitro.options.typescript.tsconfigPath
158
- );
159
- const tsconfigDir = dirname(tsConfigPath);
160
- const tsConfig = defu(nitro.options.typescript.tsConfig, {
161
- compilerOptions: {
162
- /* Base options: */
163
- esModuleInterop: true,
164
- allowSyntheticDefaultImports: true,
165
- skipLibCheck: true,
166
- target: "ESNext",
167
- allowJs: true,
168
- resolveJsonModule: true,
169
- moduleDetection: "force",
170
- isolatedModules: true,
171
- verbatimModuleSyntax: true,
172
- allowImportingTsExtensions: true,
173
- /* Strictness */
174
- strict: nitro.options.typescript.strict,
175
- noUncheckedIndexedAccess: true,
176
- noImplicitOverride: true,
177
- forceConsistentCasingInFileNames: true,
178
- /* If NOT transpiling with TypeScript: */
179
- module: "Preserve",
180
- jsx: "preserve",
181
- jsxFactory: "h",
182
- jsxFragmentFactory: "Fragment",
183
- paths: {
184
- "#imports": [
185
- relativeWithDot(tsconfigDir, join(typesDir, "nitro-imports"))
186
- ],
187
- ...nitro.options.typescript.internalPaths ? {
188
- "nitro/runtime": [
189
- relativeWithDot(tsconfigDir, join(runtimeDir, "index"))
190
- ],
191
- "#internal/nitro": [
192
- relativeWithDot(tsconfigDir, join(runtimeDir, "index"))
193
- ],
194
- "nitro/runtime/*": [
195
- relativeWithDot(tsconfigDir, join(runtimeDir, "*"))
196
- ],
197
- "#internal/nitro/*": [
198
- relativeWithDot(tsconfigDir, join(runtimeDir, "*"))
199
- ]
200
- } : {}
201
- }
202
- },
203
- include: [
204
- relativeWithDot(tsconfigDir, join(typesDir, "nitro.d.ts")).replace(
205
- /^(?=[^.])/,
206
- "./"
207
- ),
208
- join(relativeWithDot(tsconfigDir, nitro.options.rootDir), "**/*"),
209
- ...nitro.options.srcDir === nitro.options.rootDir ? [] : [join(relativeWithDot(tsconfigDir, nitro.options.srcDir), "**/*")]
210
- ]
211
- });
212
- for (const alias in tsConfig.compilerOptions.paths) {
213
- const paths = await Promise.all(
214
- tsConfig.compilerOptions.paths[alias].map(async (path) => {
215
- if (!isAbsolute(path)) {
216
- return path;
217
- }
218
- const stats = await promises.stat(path).catch(
219
- () => null
220
- /* file does not exist */
221
- );
222
- return relativeWithDot(
223
- tsconfigDir,
224
- stats?.isFile() ? path.replace(/(?<=\w)\.\w+$/g, "") : path
225
- );
226
- })
227
- );
228
- tsConfig.compilerOptions.paths[alias] = [...new Set(paths)];
229
- }
230
- tsConfig.include = [
231
- ...new Set(
232
- tsConfig.include.map(
233
- (p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p
234
- )
235
- )
236
- ];
237
- if (tsConfig.exclude) {
238
- tsConfig.exclude = [
239
- ...new Set(
240
- tsConfig.exclude.map(
241
- (p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p
242
- )
243
- )
244
- ];
245
- }
246
- types.tsConfig = tsConfig;
247
- buildFiles.push({
248
- path: tsConfigPath,
249
- contents: () => JSON.stringify(tsConfig, null, 2)
250
- });
251
- }
252
- await nitro.hooks.callHook("types:extend", types);
253
- await Promise.all(
254
- buildFiles.map(async (file) => {
255
- await writeFile(
256
- resolve(nitro.options.buildDir, file.path),
257
- typeof file.contents === "string" ? file.contents : file.contents()
258
- );
259
- })
260
- );
261
- }
262
- const RELATIVE_RE = /^\.{1,2}\//;
263
- function relativeWithDot(from, to) {
264
- const rel = relative(from, to);
265
- return RELATIVE_RE.test(rel) ? rel : "./" + rel;
266
- }
267
-
268
- export { writeTypes as w };
@@ -1,81 +0,0 @@
1
- export function klona(x) {
2
- if (typeof x !== 'object') return x;
3
-
4
- var k, tmp, str=Object.prototype.toString.call(x);
5
-
6
- if (str === '[object Object]') {
7
- if (x.constructor !== Object && typeof x.constructor === 'function') {
8
- tmp = new x.constructor();
9
- for (k in x) {
10
- if (x.hasOwnProperty(k) && tmp[k] !== x[k]) {
11
- tmp[k] = klona(x[k]);
12
- }
13
- }
14
- } else {
15
- tmp = {}; // null
16
- for (k in x) {
17
- if (k === '__proto__') {
18
- Object.defineProperty(tmp, k, {
19
- value: klona(x[k]),
20
- configurable: true,
21
- enumerable: true,
22
- writable: true,
23
- });
24
- } else {
25
- tmp[k] = klona(x[k]);
26
- }
27
- }
28
- }
29
- return tmp;
30
- }
31
-
32
- if (str === '[object Array]') {
33
- k = x.length;
34
- for (tmp=Array(k); k--;) {
35
- tmp[k] = klona(x[k]);
36
- }
37
- return tmp;
38
- }
39
-
40
- if (str === '[object Set]') {
41
- tmp = new Set;
42
- x.forEach(function (val) {
43
- tmp.add(klona(val));
44
- });
45
- return tmp;
46
- }
47
-
48
- if (str === '[object Map]') {
49
- tmp = new Map;
50
- x.forEach(function (val, key) {
51
- tmp.set(klona(key), klona(val));
52
- });
53
- return tmp;
54
- }
55
-
56
- if (str === '[object Date]') {
57
- return new Date(+x);
58
- }
59
-
60
- if (str === '[object RegExp]') {
61
- tmp = new RegExp(x.source, x.flags);
62
- tmp.lastIndex = x.lastIndex;
63
- return tmp;
64
- }
65
-
66
- if (str === '[object DataView]') {
67
- return new x.constructor( klona(x.buffer) );
68
- }
69
-
70
- if (str === '[object ArrayBuffer]') {
71
- return x.slice(0);
72
- }
73
-
74
- // ArrayBuffer.isView(x)
75
- // ~> `new` bcuz `Buffer.slice` => ref
76
- if (str.slice(-6) === 'Array]') {
77
- return new x.constructor(x);
78
- }
79
-
80
- return x;
81
- }
@@ -1,53 +0,0 @@
1
- function set(obj, key, val) {
2
- if (typeof val.value === 'object') val.value = klona(val.value);
3
- if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
4
- Object.defineProperty(obj, key, val);
5
- } else obj[key] = val.value;
6
- }
7
-
8
- export function klona(x) {
9
- if (typeof x !== 'object') return x;
10
-
11
- var i=0, k, list, tmp, str=Object.prototype.toString.call(x);
12
-
13
- if (str === '[object Object]') {
14
- tmp = Object.create(x.__proto__ || null);
15
- } else if (str === '[object Array]') {
16
- tmp = Array(x.length);
17
- } else if (str === '[object Set]') {
18
- tmp = new Set;
19
- x.forEach(function (val) {
20
- tmp.add(klona(val));
21
- });
22
- } else if (str === '[object Map]') {
23
- tmp = new Map;
24
- x.forEach(function (val, key) {
25
- tmp.set(klona(key), klona(val));
26
- });
27
- } else if (str === '[object Date]') {
28
- tmp = new Date(+x);
29
- } else if (str === '[object RegExp]') {
30
- tmp = new RegExp(x.source, x.flags);
31
- } else if (str === '[object DataView]') {
32
- tmp = new x.constructor( klona(x.buffer) );
33
- } else if (str === '[object ArrayBuffer]') {
34
- tmp = x.slice(0);
35
- } else if (str.slice(-6) === 'Array]') {
36
- // ArrayBuffer.isView(x)
37
- // ~> `new` bcuz `Buffer.slice` => ref
38
- tmp = new x.constructor(x);
39
- }
40
-
41
- if (tmp) {
42
- for (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {
43
- set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
44
- }
45
-
46
- for (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {
47
- if (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;
48
- set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
49
- }
50
- }
51
-
52
- return tmp || x;
53
- }
@@ -1,74 +0,0 @@
1
- {
2
- "name": "klona",
3
- "version": "2.0.6",
4
- "repository": "lukeed/klona",
5
- "description": "A tiny (240B to 501B) and fast utility to \"deep clone\" Objects, Arrays, Dates, RegExps, and more!",
6
- "module": "dist/index.mjs",
7
- "unpkg": "dist/index.min.js",
8
- "main": "dist/index.js",
9
- "types": "index.d.ts",
10
- "license": "MIT",
11
- "author": {
12
- "name": "Luke Edwards",
13
- "email": "luke.edwards05@gmail.com",
14
- "url": "https://lukeed.com"
15
- },
16
- "files": [
17
- "*.d.ts",
18
- "dist",
19
- "full",
20
- "json",
21
- "lite"
22
- ],
23
- "exports": {
24
- ".": {
25
- "types": "./index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.js"
28
- },
29
- "./json": {
30
- "types": "./index.d.ts",
31
- "import": "./json/index.mjs",
32
- "require": "./json/index.js"
33
- },
34
- "./lite": {
35
- "types": "./index.d.ts",
36
- "import": "./lite/index.mjs",
37
- "require": "./lite/index.js"
38
- },
39
- "./full": {
40
- "types": "./index.d.ts",
41
- "import": "./full/index.mjs",
42
- "require": "./full/index.js"
43
- },
44
- "./package.json": "./package.json"
45
- },
46
- "modes": {
47
- "json": "src/json.js",
48
- "lite": "src/lite.js",
49
- "default": "src/index.js",
50
- "full": "src/full.js"
51
- },
52
- "engines": {
53
- "node": ">= 8"
54
- },
55
- "scripts": {
56
- "build": "bundt",
57
- "pretest": "npm run build",
58
- "postbuild": "echo \"lite full json\" | xargs -n1 cp -v index.d.ts",
59
- "test": "uvu -r esm test -i suites"
60
- },
61
- "keywords": [
62
- "clone",
63
- "copy",
64
- "deep",
65
- "extend",
66
- "recursive",
67
- "object"
68
- ],
69
- "devDependencies": {
70
- "bundt": "1.0.2",
71
- "esm": "3.2.25",
72
- "uvu": "0.5.2"
73
- }
74
- }
@@ -1 +0,0 @@
1
- const r=Object.create(null),i=e=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?r:globalThis),o=new Proxy(r,{get(e,s){return i()[s]??r[s]},has(e,s){const E=i();return s in E||s in r},set(e,s,E){const B=i(!0);return B[s]=E,!0},deleteProperty(e,s){if(!s)return!1;const E=i(!0);return delete E[s],!0},ownKeys(){const e=i(!0);return Object.keys(e)}}),t=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",f=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CLOUDFLARE_WORKERS","WORKERS_CI",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["CODESANDBOX","CODESANDBOX_HOST",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function b(){if(globalThis.process?.env)for(const e of f){const s=e[1]||e[0];if(globalThis.process?.env[s])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}const l=b(),p=l.name;function n(e){return e?e!=="false":!1}const I=globalThis.process?.platform||"",T=n(o.CI)||l.ci!==!1,R=n(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),U=typeof window<"u",d=n(o.DEBUG),a=t==="test"||n(o.TEST),g=t==="production",h=t==="dev"||t==="development",v=n(o.MINIMAL)||T||a||!R,A=/^win/i.test(I),M=/^linux/i.test(I),m=/^darwin/i.test(I),Y=!n(o.NO_COLOR)&&(n(o.FORCE_COLOR)||(R||A)&&o.TERM!=="dumb"||T),C=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null,V=Number(C?.split(".")[0])||null,W=globalThis.process||Object.create(null),_={versions:{}},y=new Proxy(W,{get(e,s){if(s==="env")return o;if(s in e)return e[s];if(s in _)return _[s]}}),O=globalThis.process?.release?.name==="node",c=!!globalThis.Bun||!!globalThis.process?.versions?.bun,D=!!globalThis.Deno,L=!!globalThis.fastly,S=!!globalThis.Netlify,u=!!globalThis.EdgeRuntime,N=globalThis.navigator?.userAgent==="Cloudflare-Workers",F=[[S,"netlify"],[u,"edge-light"],[N,"workerd"],[L,"fastly"],[D,"deno"],[c,"bun"],[O,"node"]];function G(){const e=F.find(s=>s[0]);if(e)return{name:e[1]}}const P=G(),K=P?.name||"";export{o as env,R as hasTTY,U as hasWindow,c as isBun,T as isCI,Y as isColorSupported,d as isDebug,D as isDeno,h as isDevelopment,u as isEdgeLight,L as isFastly,M as isLinux,m as isMacOS,v as isMinimal,S as isNetlify,O as isNode,g as isProduction,a as isTest,A as isWindows,N as isWorkerd,t as nodeENV,V as nodeMajorVersion,C as nodeVersion,I as platform,y as process,p as provider,l as providerInfo,K as runtime,P as runtimeInfo};
@@ -1,46 +0,0 @@
1
- {
2
- "name": "std-env",
3
- "version": "3.10.0",
4
- "description": "Runtime agnostic JS utils",
5
- "repository": "unjs/std-env",
6
- "license": "MIT",
7
- "sideEffects": false,
8
- "type": "module",
9
- "exports": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.cjs"
13
- },
14
- "main": "./dist/index.cjs",
15
- "types": "./dist/index.d.ts",
16
- "files": [
17
- "dist"
18
- ],
19
- "scripts": {
20
- "build": "unbuild",
21
- "dev": "vitest",
22
- "lint": "eslint . && prettier -c src test",
23
- "lint:fix": "eslint --fix . && prettier -w src test",
24
- "prepack": "unbuild",
25
- "play:bun": "bun playground/bun.ts",
26
- "play:deno": "pnpm build && deno run -A playground/deno.ts",
27
- "play:node": "pnpm build && node playground/node.mjs",
28
- "release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
29
- "test": "pnpm lint && pnpm typecheck && vitest run --coverage",
30
- "typecheck": "tsc --noEmit"
31
- },
32
- "devDependencies": {
33
- "@types/node": "^24.7.2",
34
- "@vitest/coverage-v8": "^3.2.4",
35
- "changelogen": "^0.6.2",
36
- "esbuild": "^0.25.10",
37
- "eslint": "^9.37.0",
38
- "eslint-config-unjs": "^0.5.0",
39
- "prettier": "^3.6.2",
40
- "rollup": "^4.52.4",
41
- "typescript": "^5.9.3",
42
- "unbuild": "^3.6.1",
43
- "vitest": "^3.2.4"
44
- },
45
- "packageManager": "pnpm@10.18.2"
46
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes