nitropack-nightly 2.11.0-20250211-203640.d86b672b → 2.11.0-20250218-113619.4a57c822
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/cli/list.mjs +1 -1
- package/dist/cli/run.mjs +2 -2
- package/dist/core/index.mjs +26 -24
- package/dist/kit/index.d.mts +1 -1
- package/dist/kit/index.d.ts +1 -1
- package/dist/kit/index.mjs +1 -1
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.mjs +1 -1
- package/dist/presets/cloudflare/unenv/preset.mjs +19 -5
- package/dist/presets/cloudflare/unenv/runtime/async_hooks.d.mts +2 -2
- package/dist/presets/cloudflare/unenv/runtime/async_hooks.mjs +3 -2
- package/dist/presets/cloudflare/unenv/runtime/console.d.mts +26 -0
- package/dist/presets/cloudflare/unenv/runtime/console.mjs +71 -0
- package/dist/presets/cloudflare/unenv/runtime/crypto.d.mts +1 -1
- package/dist/presets/cloudflare/unenv/runtime/crypto.mjs +2 -2
- package/dist/presets/cloudflare/unenv/runtime/module.d.mts +34 -0
- package/dist/presets/cloudflare/unenv/runtime/module.mjs +110 -0
- package/dist/presets/cloudflare/unenv/runtime/perf_hooks.d.mts +15 -0
- package/dist/presets/cloudflare/unenv/runtime/perf_hooks.mjs +76 -0
- package/dist/presets/cloudflare/unenv/runtime/process.d.mts +107 -0
- package/dist/presets/cloudflare/unenv/runtime/process.mjs +128 -0
- package/dist/presets/cloudflare/unenv/runtime/util.d.mts +2 -0
- package/dist/presets/cloudflare/unenv/runtime/util.mjs +3 -4
- package/dist/rollup/index.mjs +46 -31
- package/dist/shared/{nitro.B0qse3Zw.d.mts → nitro.BYXEt1mT.d.mts} +5 -5
- package/dist/shared/{nitro.B0qse3Zw.d.ts → nitro.BYXEt1mT.d.ts} +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +26 -16
package/dist/cli/list.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const list = defineCommand({
|
|
|
16
16
|
},
|
|
17
17
|
async run({ args }) {
|
|
18
18
|
const cwd = resolve(args.dir || args.cwd || ".");
|
|
19
|
-
const options = await loadOptions({ rootDir: cwd }).catch(() =>
|
|
19
|
+
const options = await loadOptions({ rootDir: cwd }).catch(() => void 0);
|
|
20
20
|
const tasks = await listTasks({
|
|
21
21
|
cwd,
|
|
22
22
|
buildDir: options?.buildDir || ".nitro"
|
package/dist/cli/run.mjs
CHANGED
|
@@ -26,14 +26,14 @@ const run = defineCommand({
|
|
|
26
26
|
},
|
|
27
27
|
async run({ args }) {
|
|
28
28
|
const cwd = resolve(args.dir || args.cwd || ".");
|
|
29
|
-
const options = await loadOptions({ rootDir: cwd }).catch(() =>
|
|
29
|
+
const options = await loadOptions({ rootDir: cwd }).catch(() => void 0);
|
|
30
30
|
consola.info(`Running task \`${args.name}\`...`);
|
|
31
31
|
let payload = destr(args.payload || "{}");
|
|
32
32
|
if (typeof payload !== "object") {
|
|
33
33
|
consola.error(
|
|
34
34
|
`Invalid payload: \`${args.payload}\` (it should be a valid JSON object)`
|
|
35
35
|
);
|
|
36
|
-
payload =
|
|
36
|
+
payload = void 0;
|
|
37
37
|
}
|
|
38
38
|
try {
|
|
39
39
|
const { result } = await runTask(
|
package/dist/core/index.mjs
CHANGED
|
@@ -40,7 +40,7 @@ import prettyBytes from 'pretty-bytes';
|
|
|
40
40
|
import zlib from 'node:zlib';
|
|
41
41
|
import { walk, parse } from 'ultrahtml';
|
|
42
42
|
import { Worker } from 'node:worker_threads';
|
|
43
|
-
import { setResponseHeaders, getRequestURL, setResponseStatus, getResponseHeader, setResponseHeader,
|
|
43
|
+
import { setResponseHeaders, getRequestURL, setResponseStatus, getResponseHeader, setResponseHeader, send, getRequestHeader, getRequestHeaders, eventHandler, createError, createApp, fromNodeMiddleware, toNodeListener } from 'h3';
|
|
44
44
|
import { createProxyServer } from 'httpxy';
|
|
45
45
|
import { listen } from 'listhen';
|
|
46
46
|
import { servePlaceholder } from 'serve-placeholder';
|
|
@@ -100,7 +100,7 @@ const NitroDefaults = {
|
|
|
100
100
|
baseURL: process.env.NITRO_APP_BASE_URL || "/",
|
|
101
101
|
handlers: [],
|
|
102
102
|
devHandlers: [],
|
|
103
|
-
errorHandler:
|
|
103
|
+
errorHandler: void 0,
|
|
104
104
|
routeRules: {},
|
|
105
105
|
prerender: {
|
|
106
106
|
autoSubfolderIndex: true,
|
|
@@ -335,7 +335,7 @@ function _resolveExportConditions(conditions, opts) {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
async function resolveFetchOptions(options) {
|
|
338
|
-
if (options.experimental.nodeFetchCompat ===
|
|
338
|
+
if (options.experimental.nodeFetchCompat === void 0) {
|
|
339
339
|
options.experimental.nodeFetchCompat = (nodeMajorVersion || 0) < 18;
|
|
340
340
|
if (options.experimental.nodeFetchCompat && provider !== "stackblitz") {
|
|
341
341
|
consola.warn(
|
|
@@ -564,8 +564,8 @@ function normalizeRouteRules(config) {
|
|
|
564
564
|
path = withLeadingSlash(path);
|
|
565
565
|
const routeRules = {
|
|
566
566
|
...routeConfig,
|
|
567
|
-
redirect:
|
|
568
|
-
proxy:
|
|
567
|
+
redirect: void 0,
|
|
568
|
+
proxy: void 0
|
|
569
569
|
};
|
|
570
570
|
if (routeConfig.redirect) {
|
|
571
571
|
routeRules.redirect = {
|
|
@@ -631,7 +631,7 @@ function normalizeRuntimeConfig(config) {
|
|
|
631
631
|
}
|
|
632
632
|
function provideFallbackValues(obj) {
|
|
633
633
|
for (const key in obj) {
|
|
634
|
-
if (obj[key] ===
|
|
634
|
+
if (obj[key] === void 0 || obj[key] === null) {
|
|
635
635
|
obj[key] = "";
|
|
636
636
|
} else if (typeof obj[key] === "object") {
|
|
637
637
|
provideFallbackValues(obj[key]);
|
|
@@ -644,7 +644,7 @@ function checkSerializableRuntimeConfig(obj, path = []) {
|
|
|
644
644
|
}
|
|
645
645
|
for (const key in obj) {
|
|
646
646
|
const value = obj[key];
|
|
647
|
-
if (value === null || value ===
|
|
647
|
+
if (value === null || value === void 0 || isPrimitiveValue(value)) {
|
|
648
648
|
continue;
|
|
649
649
|
}
|
|
650
650
|
if (Array.isArray(value)) {
|
|
@@ -677,12 +677,12 @@ async function resolveStorageOptions(options) {
|
|
|
677
677
|
base: fsMounts[p]
|
|
678
678
|
};
|
|
679
679
|
}
|
|
680
|
-
if (options.dev && options.storage.data ===
|
|
680
|
+
if (options.dev && options.storage.data === void 0 && options.devStorage.data === void 0) {
|
|
681
681
|
options.devStorage.data = {
|
|
682
682
|
driver: "fs",
|
|
683
683
|
base: resolve(options.rootDir, ".data/kv")
|
|
684
684
|
};
|
|
685
|
-
} else if (options.node && options.storage.data ===
|
|
685
|
+
} else if (options.node && options.storage.data === void 0) {
|
|
686
686
|
options.storage.data = {
|
|
687
687
|
driver: "fsLite",
|
|
688
688
|
base: "./.data/kv"
|
|
@@ -696,11 +696,13 @@ async function resolveURLOptions(options) {
|
|
|
696
696
|
|
|
697
697
|
async function resolveErrorOptions(options) {
|
|
698
698
|
if (!options.errorHandler) {
|
|
699
|
-
options.errorHandler =
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
);
|
|
699
|
+
options.errorHandler = [];
|
|
700
|
+
} else if (!Array.isArray(options.errorHandler)) {
|
|
701
|
+
options.errorHandler = [options.errorHandler];
|
|
703
702
|
}
|
|
703
|
+
options.errorHandler.push(
|
|
704
|
+
join(runtimeDir, `internal/error/${options.dev ? "dev" : "prod"}`)
|
|
705
|
+
);
|
|
704
706
|
}
|
|
705
707
|
|
|
706
708
|
const configResolvers = [
|
|
@@ -1092,7 +1094,7 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
1092
1094
|
logger: consola$1.withTag("nitro"),
|
|
1093
1095
|
scannedHandlers: [],
|
|
1094
1096
|
close: () => nitro.hooks.callHook("close"),
|
|
1095
|
-
storage:
|
|
1097
|
+
storage: void 0,
|
|
1096
1098
|
async updateConfig(config2) {
|
|
1097
1099
|
updateNitroConfig(nitro, config2);
|
|
1098
1100
|
}
|
|
@@ -1109,7 +1111,7 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
1109
1111
|
if (nitro.options.timing) {
|
|
1110
1112
|
nitro.options.plugins.push(join(runtimeDir, "internal/timing"));
|
|
1111
1113
|
}
|
|
1112
|
-
if (nitro.options.logLevel !==
|
|
1114
|
+
if (nitro.options.logLevel !== void 0) {
|
|
1113
1115
|
nitro.logger.level = nitro.options.logLevel;
|
|
1114
1116
|
}
|
|
1115
1117
|
nitro.hooks.addHooks(nitro.options.hooks);
|
|
@@ -1986,7 +1988,7 @@ async function prerender(nitro) {
|
|
|
1986
1988
|
let dataBuff = Buffer.from(await res.arrayBuffer());
|
|
1987
1989
|
Object.defineProperty(_route, "contents", {
|
|
1988
1990
|
get: () => {
|
|
1989
|
-
return dataBuff ? dataBuff.toString("utf8") :
|
|
1991
|
+
return dataBuff ? dataBuff.toString("utf8") : void 0;
|
|
1990
1992
|
},
|
|
1991
1993
|
set(value) {
|
|
1992
1994
|
if (dataBuff) {
|
|
@@ -1996,7 +1998,7 @@ async function prerender(nitro) {
|
|
|
1996
1998
|
});
|
|
1997
1999
|
Object.defineProperty(_route, "data", {
|
|
1998
2000
|
get: () => {
|
|
1999
|
-
return dataBuff ? dataBuff.buffer :
|
|
2001
|
+
return dataBuff ? dataBuff.buffer : void 0;
|
|
2000
2002
|
},
|
|
2001
2003
|
set(value) {
|
|
2002
2004
|
if (dataBuff) {
|
|
@@ -2032,7 +2034,7 @@ async function prerender(nitro) {
|
|
|
2032
2034
|
if (_route.skip || _route.error) {
|
|
2033
2035
|
await nitro.hooks.callHook("prerender:route", _route);
|
|
2034
2036
|
nitro.logger.log(formatPrerenderRoute(_route));
|
|
2035
|
-
dataBuff =
|
|
2037
|
+
dataBuff = void 0;
|
|
2036
2038
|
return _route;
|
|
2037
2039
|
}
|
|
2038
2040
|
if (canWriteToDisk(_route)) {
|
|
@@ -2057,7 +2059,7 @@ async function prerender(nitro) {
|
|
|
2057
2059
|
}
|
|
2058
2060
|
await nitro.hooks.callHook("prerender:route", _route);
|
|
2059
2061
|
nitro.logger.log(formatPrerenderRoute(_route));
|
|
2060
|
-
dataBuff =
|
|
2062
|
+
dataBuff = void 0;
|
|
2061
2063
|
return _route;
|
|
2062
2064
|
};
|
|
2063
2065
|
nitro.logger.info(
|
|
@@ -2201,7 +2203,7 @@ async function sourceLoader(frame) {
|
|
|
2201
2203
|
}
|
|
2202
2204
|
const contents = await readFile(frame.fileName, "utf8").catch(() => {
|
|
2203
2205
|
});
|
|
2204
|
-
return contents ? { contents } :
|
|
2206
|
+
return contents ? { contents } : void 0;
|
|
2205
2207
|
}
|
|
2206
2208
|
function fmtFrame(frame) {
|
|
2207
2209
|
if (frame.type === "native") {
|
|
@@ -2223,7 +2225,7 @@ function createVFSHandler(nitro) {
|
|
|
2223
2225
|
if (id && !(id in vfsEntries)) {
|
|
2224
2226
|
throw createError({ message: "File not found", statusCode: 404 });
|
|
2225
2227
|
}
|
|
2226
|
-
let content = id ? vfsEntries[id] :
|
|
2228
|
+
let content = id ? vfsEntries[id] : void 0;
|
|
2227
2229
|
if (typeof content === "function") {
|
|
2228
2230
|
content = await content();
|
|
2229
2231
|
}
|
|
@@ -2362,7 +2364,7 @@ function createDevServer(nitro) {
|
|
|
2362
2364
|
let currentWorker;
|
|
2363
2365
|
const reloadWorker = async () => {
|
|
2364
2366
|
const oldWorker = currentWorker;
|
|
2365
|
-
currentWorker =
|
|
2367
|
+
currentWorker = void 0;
|
|
2366
2368
|
await killWorker(oldWorker, nitro);
|
|
2367
2369
|
currentWorker = await initWorker(workerDir);
|
|
2368
2370
|
if (!currentWorker) {
|
|
@@ -2385,14 +2387,14 @@ function createDevServer(nitro) {
|
|
|
2385
2387
|
};
|
|
2386
2388
|
const reloadWorkerDebounced = debounce(() => {
|
|
2387
2389
|
reloadPromise = reloadWorker().then(() => {
|
|
2388
|
-
lastError =
|
|
2390
|
+
lastError = void 0;
|
|
2389
2391
|
}).catch(async (error) => {
|
|
2390
2392
|
await loadStackTrace(error).catch(() => {
|
|
2391
2393
|
});
|
|
2392
2394
|
consola.error(error);
|
|
2393
2395
|
lastError = error;
|
|
2394
2396
|
}).finally(() => {
|
|
2395
|
-
reloadPromise =
|
|
2397
|
+
reloadPromise = void 0;
|
|
2396
2398
|
});
|
|
2397
2399
|
return reloadPromise;
|
|
2398
2400
|
});
|
package/dist/kit/index.d.mts
CHANGED
package/dist/kit/index.d.ts
CHANGED
package/dist/kit/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ async function writeFile(file, contents, log = false) {
|
|
|
54
54
|
await fsp.writeFile(
|
|
55
55
|
file,
|
|
56
56
|
contents,
|
|
57
|
-
typeof contents === "string" ? "utf8" :
|
|
57
|
+
typeof contents === "string" ? "utf8" : void 0
|
|
58
58
|
);
|
|
59
59
|
if (log) {
|
|
60
60
|
consola$1.info("Generated", prettyPath(file));
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/meta/index.mjs
CHANGED
|
@@ -29,7 +29,15 @@ export const nodeCompatModules = [
|
|
|
29
29
|
"util/types",
|
|
30
30
|
"zlib"
|
|
31
31
|
];
|
|
32
|
-
export const hybridNodeCompatModules = [
|
|
32
|
+
export const hybridNodeCompatModules = [
|
|
33
|
+
"async_hooks",
|
|
34
|
+
"console",
|
|
35
|
+
"crypto",
|
|
36
|
+
"module",
|
|
37
|
+
"perf_hooks",
|
|
38
|
+
"process",
|
|
39
|
+
"util"
|
|
40
|
+
];
|
|
33
41
|
const presetRuntimeDir = fileURLToPath(new URL("runtime/", import.meta.url));
|
|
34
42
|
const resolvePresetRuntime = (m) => join(presetRuntimeDir, `${m}.mjs`);
|
|
35
43
|
export const unenvCfPreset = {
|
|
@@ -58,8 +66,7 @@ export const unenvCfPreset = {
|
|
|
58
66
|
"node-mock-http/_polyfill/buffer": "node:buffer"
|
|
59
67
|
},
|
|
60
68
|
inject: {
|
|
61
|
-
|
|
62
|
-
// console: "TODO",
|
|
69
|
+
process: resolvePresetRuntime("process"),
|
|
63
70
|
Buffer: ["node:buffer", "Buffer"],
|
|
64
71
|
"global.Buffer": ["node:buffer", "Buffer"],
|
|
65
72
|
"globalThis.Buffer": ["node:buffer", "Buffer"]
|
|
@@ -69,10 +76,17 @@ export const hybridNodePlugin = {
|
|
|
69
76
|
name: "nitro:cloudflare:hybrid-node-compat",
|
|
70
77
|
resolveId(id) {
|
|
71
78
|
if (id.startsWith("cloudflare:")) {
|
|
72
|
-
return { id, external: true };
|
|
79
|
+
return { id, external: true, moduleSideEffects: false };
|
|
73
80
|
}
|
|
74
81
|
if (id.startsWith("#workerd/node:")) {
|
|
75
|
-
return {
|
|
82
|
+
return {
|
|
83
|
+
id: id.slice("#workerd/".length),
|
|
84
|
+
external: true,
|
|
85
|
+
moduleSideEffects: false
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (id.startsWith(presetRuntimeDir)) {
|
|
89
|
+
return { id, moduleSideEffects: false };
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const AsyncLocalStorage: any;
|
|
2
2
|
export const AsyncResource: any;
|
|
3
3
|
declare namespace _default {
|
|
4
|
+
export { AsyncLocalStorage };
|
|
5
|
+
export { AsyncResource };
|
|
4
6
|
export { asyncWrapProviders };
|
|
5
7
|
export { createHook };
|
|
6
8
|
export { executionAsyncId };
|
|
7
9
|
export { executionAsyncResource };
|
|
8
10
|
export { triggerAsyncId };
|
|
9
|
-
export { AsyncLocalStorage };
|
|
10
|
-
export { AsyncResource };
|
|
11
11
|
}
|
|
12
12
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// https://github.com/cloudflare/workerd/blob/main/src/node/async_hooks.ts
|
|
1
2
|
// https://github.com/cloudflare/workers-sdk/blob/main/packages/unenv-preset/src/runtime/node/async_hooks/index.ts
|
|
2
3
|
|
|
3
4
|
import workerdAsyncHooks from "#workerd/node:async_hooks";
|
|
@@ -21,11 +22,11 @@ export {
|
|
|
21
22
|
export const { AsyncLocalStorage, AsyncResource } = workerdAsyncHooks;
|
|
22
23
|
|
|
23
24
|
export default {
|
|
25
|
+
AsyncLocalStorage,
|
|
26
|
+
AsyncResource,
|
|
24
27
|
asyncWrapProviders,
|
|
25
28
|
createHook,
|
|
26
29
|
executionAsyncId,
|
|
27
30
|
executionAsyncResource,
|
|
28
31
|
triggerAsyncId,
|
|
29
|
-
AsyncLocalStorage,
|
|
30
|
-
AsyncResource,
|
|
31
32
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const assert: any;
|
|
2
|
+
export const clear: any;
|
|
3
|
+
export const context: any;
|
|
4
|
+
export const count: any;
|
|
5
|
+
export const countReset: any;
|
|
6
|
+
export const createTask: any;
|
|
7
|
+
export const debug: any;
|
|
8
|
+
export const dir: any;
|
|
9
|
+
export const dirxml: any;
|
|
10
|
+
export const error: any;
|
|
11
|
+
export const group: any;
|
|
12
|
+
export const groupCollapsed: any;
|
|
13
|
+
export const groupEnd: any;
|
|
14
|
+
export const info: any;
|
|
15
|
+
export const log: any;
|
|
16
|
+
export const profile: any;
|
|
17
|
+
export const profileEnd: any;
|
|
18
|
+
export const table: any;
|
|
19
|
+
export const time: any;
|
|
20
|
+
export const timeEnd: any;
|
|
21
|
+
export const timeLog: any;
|
|
22
|
+
export const timeStamp: any;
|
|
23
|
+
export const trace: any;
|
|
24
|
+
export const warn: any;
|
|
25
|
+
export default consoleModule;
|
|
26
|
+
declare const consoleModule: any;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// https://github.com/cloudflare/workers-sdk/blob/main/packages/unenv-preset/src/runtime/node/console/index.ts
|
|
2
|
+
|
|
3
|
+
import workerdConsole from "#workerd/node:console";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Console,
|
|
7
|
+
_ignoreErrors,
|
|
8
|
+
_stderr,
|
|
9
|
+
_stderrErrorHandler,
|
|
10
|
+
_stdout,
|
|
11
|
+
_stdoutErrorHandler,
|
|
12
|
+
_times,
|
|
13
|
+
} from "unenv/node/console";
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
Console,
|
|
17
|
+
_ignoreErrors,
|
|
18
|
+
_stderr,
|
|
19
|
+
_stderrErrorHandler,
|
|
20
|
+
_stdout,
|
|
21
|
+
_stdoutErrorHandler,
|
|
22
|
+
_times,
|
|
23
|
+
} from "unenv/node/console";
|
|
24
|
+
|
|
25
|
+
export const {
|
|
26
|
+
assert,
|
|
27
|
+
clear,
|
|
28
|
+
context,
|
|
29
|
+
count,
|
|
30
|
+
countReset,
|
|
31
|
+
createTask,
|
|
32
|
+
debug,
|
|
33
|
+
dir,
|
|
34
|
+
dirxml,
|
|
35
|
+
error,
|
|
36
|
+
group,
|
|
37
|
+
groupCollapsed,
|
|
38
|
+
groupEnd,
|
|
39
|
+
info,
|
|
40
|
+
log,
|
|
41
|
+
profile,
|
|
42
|
+
profileEnd,
|
|
43
|
+
table,
|
|
44
|
+
time,
|
|
45
|
+
timeEnd,
|
|
46
|
+
timeLog,
|
|
47
|
+
timeStamp,
|
|
48
|
+
trace,
|
|
49
|
+
warn,
|
|
50
|
+
} = workerdConsole;
|
|
51
|
+
|
|
52
|
+
const consolePolyfill = {
|
|
53
|
+
Console,
|
|
54
|
+
_ignoreErrors,
|
|
55
|
+
_stderr,
|
|
56
|
+
_stderrErrorHandler,
|
|
57
|
+
_stdout,
|
|
58
|
+
_stdoutErrorHandler,
|
|
59
|
+
_times,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const consoleModule = /*@__PURE__*/ new Proxy(workerdConsole, {
|
|
63
|
+
get(target, prop) {
|
|
64
|
+
if (Reflect.has(target, prop)) {
|
|
65
|
+
return Reflect.get(target, prop);
|
|
66
|
+
}
|
|
67
|
+
return Reflect.get(consolePolyfill, prop);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export default consoleModule;
|
|
@@ -41,6 +41,7 @@ export const setEngine: any;
|
|
|
41
41
|
export const setFips: any;
|
|
42
42
|
export const subtle: any;
|
|
43
43
|
export const timingSafeEqual: any;
|
|
44
|
+
export const fips: any;
|
|
44
45
|
export const getRandomValues: any;
|
|
45
46
|
export namespace webcrypto {
|
|
46
47
|
export let CryptoKey: any;
|
|
@@ -122,4 +123,3 @@ declare namespace _default {
|
|
|
122
123
|
export { webcrypto };
|
|
123
124
|
}
|
|
124
125
|
export default _default;
|
|
125
|
-
declare const fips: any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// https://github.com/cloudflare/workerd/blob/main/src/node/crypto.ts
|
|
1
2
|
// https://github.com/cloudflare/workers-sdk/blob/main/packages/unenv-preset/src/runtime/node/crypto/index.ts
|
|
2
3
|
|
|
3
4
|
import workerdCrypto from "#workerd/node:crypto";
|
|
@@ -100,6 +101,7 @@ export const {
|
|
|
100
101
|
setFips,
|
|
101
102
|
subtle,
|
|
102
103
|
timingSafeEqual,
|
|
104
|
+
fips,
|
|
103
105
|
} = workerdCrypto;
|
|
104
106
|
|
|
105
107
|
export const getRandomValues = workerdCrypto.getRandomValues.bind(
|
|
@@ -113,8 +115,6 @@ export const webcrypto = {
|
|
|
113
115
|
subtle,
|
|
114
116
|
};
|
|
115
117
|
|
|
116
|
-
const fips = workerdCrypto.fips;
|
|
117
|
-
|
|
118
118
|
export default {
|
|
119
119
|
Certificate,
|
|
120
120
|
Cipher,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const builtinModules: any;
|
|
2
|
+
export const isBuiltin: any;
|
|
3
|
+
export function createRequire(file: any): any;
|
|
4
|
+
declare namespace _default {
|
|
5
|
+
export { Module };
|
|
6
|
+
export { SourceMap };
|
|
7
|
+
export { builtinModules };
|
|
8
|
+
export { enableCompileCache };
|
|
9
|
+
export { constants };
|
|
10
|
+
export { createRequire };
|
|
11
|
+
export { findSourceMap };
|
|
12
|
+
export { getCompileCacheDir };
|
|
13
|
+
export { globalPaths };
|
|
14
|
+
export { isBuiltin };
|
|
15
|
+
export { register };
|
|
16
|
+
export { runMain };
|
|
17
|
+
export { syncBuiltinESMExports };
|
|
18
|
+
export { wrap };
|
|
19
|
+
export { flushCompileCache };
|
|
20
|
+
export { stripTypeScriptTypes };
|
|
21
|
+
export { wrapper };
|
|
22
|
+
export { _cache };
|
|
23
|
+
export { _extensions };
|
|
24
|
+
export { _debug };
|
|
25
|
+
export { _pathCache };
|
|
26
|
+
export { _findPath };
|
|
27
|
+
export { _initPaths };
|
|
28
|
+
export { _load };
|
|
29
|
+
export { _nodeModulePaths };
|
|
30
|
+
export { _preloadModules };
|
|
31
|
+
export { _resolveFilename };
|
|
32
|
+
export { _resolveLookupPaths };
|
|
33
|
+
}
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// https://github.com/cloudflare/workerd/blob/main/src/node/module.ts
|
|
2
|
+
// https://github.com/cloudflare/workers-sdk/blob/main/packages/unenv-preset/src/runtime/node/module/index.ts
|
|
3
|
+
|
|
4
|
+
import workerdModule from "#workerd/node:module";
|
|
5
|
+
|
|
6
|
+
import { notImplemented } from "unenv/_internal/utils";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
constants,
|
|
10
|
+
enableCompileCache,
|
|
11
|
+
findSourceMap,
|
|
12
|
+
getCompileCacheDir,
|
|
13
|
+
globalPaths,
|
|
14
|
+
Module,
|
|
15
|
+
register,
|
|
16
|
+
runMain,
|
|
17
|
+
SourceMap,
|
|
18
|
+
syncBuiltinESMExports,
|
|
19
|
+
wrap,
|
|
20
|
+
flushCompileCache,
|
|
21
|
+
stripTypeScriptTypes,
|
|
22
|
+
wrapper,
|
|
23
|
+
_readPackage,
|
|
24
|
+
_stat,
|
|
25
|
+
_cache,
|
|
26
|
+
_debug,
|
|
27
|
+
_extensions,
|
|
28
|
+
_findPath,
|
|
29
|
+
_initPaths,
|
|
30
|
+
_load,
|
|
31
|
+
_nodeModulePaths,
|
|
32
|
+
_pathCache,
|
|
33
|
+
_preloadModules,
|
|
34
|
+
_resolveFilename,
|
|
35
|
+
_resolveLookupPaths,
|
|
36
|
+
} from "unenv/node/module";
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
Module,
|
|
40
|
+
SourceMap,
|
|
41
|
+
constants,
|
|
42
|
+
enableCompileCache,
|
|
43
|
+
findSourceMap,
|
|
44
|
+
getCompileCacheDir,
|
|
45
|
+
globalPaths,
|
|
46
|
+
register,
|
|
47
|
+
runMain,
|
|
48
|
+
syncBuiltinESMExports,
|
|
49
|
+
wrap,
|
|
50
|
+
flushCompileCache,
|
|
51
|
+
stripTypeScriptTypes,
|
|
52
|
+
wrapper,
|
|
53
|
+
_cache,
|
|
54
|
+
_extensions,
|
|
55
|
+
_debug,
|
|
56
|
+
_pathCache,
|
|
57
|
+
_findPath,
|
|
58
|
+
_initPaths,
|
|
59
|
+
_load,
|
|
60
|
+
_nodeModulePaths,
|
|
61
|
+
_preloadModules,
|
|
62
|
+
_resolveFilename,
|
|
63
|
+
_resolveLookupPaths,
|
|
64
|
+
_readPackage,
|
|
65
|
+
_stat,
|
|
66
|
+
} from "unenv/node/module";
|
|
67
|
+
|
|
68
|
+
export const { builtinModules, isBuiltin } = workerdModule;
|
|
69
|
+
|
|
70
|
+
export const createRequire = (file) => {
|
|
71
|
+
return Object.assign(workerdModule.createRequire(file), {
|
|
72
|
+
resolve: Object.assign(notImplemented("module.require.resolve"), {
|
|
73
|
+
paths: notImplemented("module.require.resolve.paths"),
|
|
74
|
+
}),
|
|
75
|
+
cache: Object.create(null),
|
|
76
|
+
extensions: _extensions,
|
|
77
|
+
main: undefined,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
Module,
|
|
83
|
+
SourceMap,
|
|
84
|
+
builtinModules,
|
|
85
|
+
enableCompileCache,
|
|
86
|
+
constants,
|
|
87
|
+
createRequire,
|
|
88
|
+
findSourceMap,
|
|
89
|
+
getCompileCacheDir,
|
|
90
|
+
globalPaths,
|
|
91
|
+
isBuiltin,
|
|
92
|
+
register,
|
|
93
|
+
runMain,
|
|
94
|
+
syncBuiltinESMExports,
|
|
95
|
+
wrap,
|
|
96
|
+
flushCompileCache,
|
|
97
|
+
stripTypeScriptTypes,
|
|
98
|
+
wrapper,
|
|
99
|
+
_cache,
|
|
100
|
+
_extensions,
|
|
101
|
+
_debug,
|
|
102
|
+
_pathCache,
|
|
103
|
+
_findPath,
|
|
104
|
+
_initPaths,
|
|
105
|
+
_load,
|
|
106
|
+
_nodeModulePaths,
|
|
107
|
+
_preloadModules,
|
|
108
|
+
_resolveFilename,
|
|
109
|
+
_resolveLookupPaths,
|
|
110
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const performance: any;
|
|
2
|
+
declare namespace _default {
|
|
3
|
+
export { Performance };
|
|
4
|
+
export { PerformanceEntry };
|
|
5
|
+
export { PerformanceMark };
|
|
6
|
+
export { PerformanceMeasure };
|
|
7
|
+
export { PerformanceObserverEntryList };
|
|
8
|
+
export { PerformanceObserver };
|
|
9
|
+
export { PerformanceResourceTiming };
|
|
10
|
+
export { constants };
|
|
11
|
+
export { createHistogram };
|
|
12
|
+
export { monitorEventLoopDelay };
|
|
13
|
+
export { performance };
|
|
14
|
+
}
|
|
15
|
+
export default _default;
|