@kubb/agent 5.0.0-beta.3 → 5.0.0-beta.31
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1965 -1827
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/index.mjs +1 -1
- package/.output/server/node_modules/ajv/dist/2019.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2019.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/2020.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2020.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/index.d.ts +2 -1
- package/.output/server/node_modules/ajv/dist/compile/index.js +10 -3
- package/.output/server/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/names.d.ts +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js +18 -4
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/core.d.ts +4 -0
- package/.output/server/node_modules/ajv/dist/core.js +15 -1
- package/.output/server/node_modules/ajv/dist/core.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/draft4.d.ts +19 -0
- package/.output/server/node_modules/ajv/dist/draft4.js +57 -0
- package/.output/server/node_modules/ajv/dist/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/dist/types/index.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js +10 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +12 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +56 -21
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js +29 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +10 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +22 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.d.ts +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +4 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +8 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/lib/2019.ts +1 -0
- package/.output/server/node_modules/ajv/lib/2020.ts +1 -0
- package/.output/server/node_modules/ajv/lib/ajv.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/index.ts +16 -3
- package/.output/server/node_modules/ajv/lib/compile/jtd/parse.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/jtd/serialize.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/names.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/validate/index.ts +21 -4
- package/.output/server/node_modules/ajv/lib/core.ts +20 -1
- package/.output/server/node_modules/ajv/lib/draft4.ts +79 -0
- package/.output/server/node_modules/ajv/lib/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/lib/types/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +2 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +1 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/properties.ts +4 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/code.ts +10 -3
- package/.output/server/node_modules/ajv/lib/vocabularies/core/ref.ts +21 -5
- package/.output/server/node_modules/ajv/lib/vocabularies/discriminator/index.ts +69 -19
- package/.output/server/node_modules/ajv/lib/vocabularies/draft4.ts +32 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/metadata.ts +10 -2
- package/.output/server/node_modules/ajv/lib/vocabularies/oasContext.ts +27 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +29 -7
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumber.ts +75 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumberExclusive.ts +26 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/readOnly.ts +23 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/required.ts +7 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/writeOnly.ts +22 -0
- package/.output/server/node_modules/ajv/package.json +9 -6
- package/.output/server/node_modules/fflate/esm/index.mjs +87 -56
- package/.output/server/node_modules/fflate/package.json +12 -11
- package/.output/server/node_modules/jiti/LICENSE +21 -0
- package/.output/server/node_modules/jiti/README.md +258 -0
- package/.output/server/node_modules/jiti/dist/babel.cjs +257 -0
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/.output/server/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/.output/server/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/.output/server/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/.output/server/node_modules/jiti/lib/jiti.cjs +30 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
- package/.output/server/node_modules/jiti/lib/types.d.ts +420 -0
- package/.output/server/node_modules/jiti/package.json +146 -0
- package/.output/server/node_modules/remeda/dist/hasProp.js +2 -0
- package/.output/server/node_modules/remeda/dist/index.js +1 -1
- package/.output/server/node_modules/remeda/package.json +12 -12
- package/.output/server/node_modules/ws/lib/receiver.js +54 -0
- package/.output/server/node_modules/ws/lib/sender.js +6 -1
- package/.output/server/node_modules/ws/lib/websocket-server.js +8 -0
- package/.output/server/node_modules/ws/lib/websocket.js +14 -0
- package/.output/server/node_modules/ws/package.json +1 -1
- package/.output/server/package.json +5 -8
- package/README.md +62 -27
- package/package.json +15 -14
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/package.json +0 -40
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node +0 -0
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +0 -256
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +0 -75
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/index.js +0 -3
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +0 -70
- package/.output/server/node_modules/@rolldown/pluginutils/dist/index.js +0 -1
- package/.output/server/node_modules/@rolldown/pluginutils/dist/utils.js +0 -17
- package/.output/server/node_modules/@rolldown/pluginutils/package.json +0 -37
- package/.output/server/node_modules/rolldown/dist/index.mjs +0 -50
- package/.output/server/node_modules/rolldown/dist/parse-ast-index.mjs +0 -60
- package/.output/server/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +0 -582
- package/.output/server/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +0 -2211
- package/.output/server/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +0 -6
- package/.output/server/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +0 -85
- package/.output/server/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +0 -180
- package/.output/server/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +0 -21
- package/.output/server/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +0 -66
- package/.output/server/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +0 -74
- package/.output/server/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +0 -847
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +0 -40
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +0 -3325
- package/.output/server/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +0 -374
- package/.output/server/node_modules/rolldown/package.json +0 -153
- package/.output/server/node_modules/unrun/dist/index.mjs +0 -2
- package/.output/server/node_modules/unrun/dist/src-GU5PtktT.mjs +0 -887
- package/.output/server/node_modules/unrun/package.json +0 -125
|
@@ -9,11 +9,13 @@ var require = createRequire('/');
|
|
|
9
9
|
// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.
|
|
10
10
|
// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint
|
|
11
11
|
// is better for memory in most engines (I *think*).
|
|
12
|
+
var _a;
|
|
12
13
|
// Mediocre shim
|
|
13
14
|
var Worker;
|
|
15
|
+
var isMarkedAsUntransferable;
|
|
14
16
|
var workerAdd = ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";
|
|
15
17
|
try {
|
|
16
|
-
|
|
18
|
+
(_a = require('worker_threads'), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable);
|
|
17
19
|
}
|
|
18
20
|
catch (e) {
|
|
19
21
|
}
|
|
@@ -26,6 +28,8 @@ var wk = Worker ? function (c, _, msg, transfer, cb) {
|
|
|
26
28
|
if (c && !done)
|
|
27
29
|
cb(new Error('exited with code ' + c), null);
|
|
28
30
|
});
|
|
31
|
+
if (isMarkedAsUntransferable)
|
|
32
|
+
transfer = transfer.filter(function (t) { return !isMarkedAsUntransferable(t); });
|
|
29
33
|
w.postMessage(msg, transfer);
|
|
30
34
|
w.terminate = function () {
|
|
31
35
|
done = true;
|
|
@@ -206,7 +210,7 @@ var ec = [
|
|
|
206
210
|
'invalid distance',
|
|
207
211
|
'stream finished',
|
|
208
212
|
'no stream handler',
|
|
209
|
-
,
|
|
213
|
+
, // determined by compression function
|
|
210
214
|
'no callback',
|
|
211
215
|
'invalid UTF-8 data',
|
|
212
216
|
'extra field too long',
|
|
@@ -923,12 +927,12 @@ var cbify = function (dat, opts, fns, init, id, cb) {
|
|
|
923
927
|
var astrm = function (strm) {
|
|
924
928
|
strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };
|
|
925
929
|
return function (ev) {
|
|
926
|
-
if (ev.data
|
|
930
|
+
if (ev.data[0]) {
|
|
927
931
|
strm.push(ev.data[0], ev.data[1]);
|
|
928
932
|
postMessage([ev.data[0].length]);
|
|
929
933
|
}
|
|
930
934
|
else
|
|
931
|
-
strm.flush();
|
|
935
|
+
strm.flush(ev.data[1]);
|
|
932
936
|
};
|
|
933
937
|
};
|
|
934
938
|
// async stream attach
|
|
@@ -958,17 +962,19 @@ var astrmify = function (fns, strm, opts, init, id, flush, ext) {
|
|
|
958
962
|
if (t)
|
|
959
963
|
strm.ondata(err(4, 0, 1), null, !!f);
|
|
960
964
|
strm.queuedSize += d.length;
|
|
961
|
-
|
|
965
|
+
// can fail for cross-realm Uint8Array, but ok - only a small performance penalty
|
|
966
|
+
w.postMessage([d, t = f], d.buffer instanceof ArrayBuffer ? [d.buffer] : []);
|
|
962
967
|
};
|
|
963
968
|
strm.terminate = function () { w.terminate(); };
|
|
964
969
|
if (flush) {
|
|
965
|
-
strm.flush = function () { w.postMessage([]); };
|
|
970
|
+
strm.flush = function (sync) { w.postMessage([0, sync]); };
|
|
966
971
|
}
|
|
967
972
|
};
|
|
968
973
|
// read 2 bytes
|
|
969
974
|
var b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };
|
|
970
975
|
// read 4 bytes
|
|
971
976
|
var b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };
|
|
977
|
+
// read 8 bytes
|
|
972
978
|
var b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };
|
|
973
979
|
// write bytes
|
|
974
980
|
var wbytes = function (d, b, v) {
|
|
@@ -1089,18 +1095,37 @@ var Deflate = /*#__PURE__*/ (function () {
|
|
|
1089
1095
|
this.p(this.b, final || false);
|
|
1090
1096
|
this.s.w = this.s.i, this.s.i -= 2;
|
|
1091
1097
|
}
|
|
1098
|
+
if (final) {
|
|
1099
|
+
// cleanup unneeded buffers/state to reduce memory usage
|
|
1100
|
+
this.s = this.o = {};
|
|
1101
|
+
this.b = et;
|
|
1102
|
+
}
|
|
1092
1103
|
};
|
|
1093
1104
|
/**
|
|
1094
1105
|
* Flushes buffered uncompressed data. Useful to immediately retrieve the
|
|
1095
1106
|
* deflated output for small inputs.
|
|
1107
|
+
* @param sync Whether to flush to a byte boundary. A sync flush takes 4-5
|
|
1108
|
+
* extra bytes, but guarantees all pushed data is immediately
|
|
1109
|
+
* decompressible. A separate DEFLATE stream may be concatenated
|
|
1110
|
+
* with the current output after a sync flush.
|
|
1096
1111
|
*/
|
|
1097
|
-
Deflate.prototype.flush = function () {
|
|
1112
|
+
Deflate.prototype.flush = function (sync) {
|
|
1098
1113
|
if (!this.ondata)
|
|
1099
1114
|
err(5);
|
|
1100
1115
|
if (this.s.l)
|
|
1101
1116
|
err(4);
|
|
1102
1117
|
this.p(this.b, false);
|
|
1103
1118
|
this.s.w = this.s.i, this.s.i -= 2;
|
|
1119
|
+
// could technically skip writing the type-0 block for (this.s.r & 7) == 0,
|
|
1120
|
+
// but the deterministic trailer (00 00 FF FF) is useful in some situations
|
|
1121
|
+
if (sync) {
|
|
1122
|
+
var c = new u8(6);
|
|
1123
|
+
c[0] = this.s.r >> 3;
|
|
1124
|
+
// write empty, non-final type-0 block
|
|
1125
|
+
var ep = wfblk(c, this.s.r, et);
|
|
1126
|
+
this.s.r = 0;
|
|
1127
|
+
this.ondata(c.subarray(0, ep >> 3), false);
|
|
1128
|
+
}
|
|
1104
1129
|
};
|
|
1105
1130
|
return Deflate;
|
|
1106
1131
|
}());
|
|
@@ -1211,12 +1236,6 @@ export function inflate(data, opts, cb) {
|
|
|
1211
1236
|
bInflt
|
|
1212
1237
|
], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);
|
|
1213
1238
|
}
|
|
1214
|
-
/**
|
|
1215
|
-
* Expands DEFLATE data with no wrapper
|
|
1216
|
-
* @param data The data to decompress
|
|
1217
|
-
* @param opts The decompression options
|
|
1218
|
-
* @returns The decompressed version of the data
|
|
1219
|
-
*/
|
|
1220
1239
|
export function inflateSync(data, opts) {
|
|
1221
1240
|
return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
|
|
1222
1241
|
}
|
|
@@ -1252,9 +1271,12 @@ var Gzip = /*#__PURE__*/ (function () {
|
|
|
1252
1271
|
/**
|
|
1253
1272
|
* Flushes buffered uncompressed data. Useful to immediately retrieve the
|
|
1254
1273
|
* GZIPped output for small inputs.
|
|
1274
|
+
* @param sync Whether to flush to a byte boundary. A sync flush takes 4-5
|
|
1275
|
+
* extra bytes, but guarantees all pushed data is immediately
|
|
1276
|
+
* decompressible.
|
|
1255
1277
|
*/
|
|
1256
|
-
Gzip.prototype.flush = function () {
|
|
1257
|
-
Deflate.prototype.flush.call(this);
|
|
1278
|
+
Gzip.prototype.flush = function (sync) {
|
|
1279
|
+
Deflate.prototype.flush.call(this, sync);
|
|
1258
1280
|
};
|
|
1259
1281
|
return Gzip;
|
|
1260
1282
|
}());
|
|
@@ -1332,14 +1354,17 @@ var Gunzip = /*#__PURE__*/ (function () {
|
|
|
1332
1354
|
}
|
|
1333
1355
|
// necessary to prevent TS from using the closure value
|
|
1334
1356
|
// This allows for workerization to function correctly
|
|
1335
|
-
Inflate.prototype.c.call(this,
|
|
1357
|
+
Inflate.prototype.c.call(this, 0);
|
|
1336
1358
|
// process concatenated GZIP
|
|
1337
|
-
if (this.s.f && !this.s.l
|
|
1359
|
+
if (this.s.f && !this.s.l) {
|
|
1338
1360
|
this.v = shft(this.s.p) + 9;
|
|
1339
1361
|
this.s = { i: 0 };
|
|
1340
1362
|
this.o = new u8(0);
|
|
1341
1363
|
this.push(new u8(0), final);
|
|
1342
1364
|
}
|
|
1365
|
+
else if (final) {
|
|
1366
|
+
Inflate.prototype.c.call(this, final);
|
|
1367
|
+
}
|
|
1343
1368
|
};
|
|
1344
1369
|
return Gunzip;
|
|
1345
1370
|
}());
|
|
@@ -1374,12 +1399,6 @@ export function gunzip(data, opts, cb) {
|
|
|
1374
1399
|
function () { return [gunzipSync]; }
|
|
1375
1400
|
], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);
|
|
1376
1401
|
}
|
|
1377
|
-
/**
|
|
1378
|
-
* Expands GZIP data
|
|
1379
|
-
* @param data The data to decompress
|
|
1380
|
-
* @param opts The decompression options
|
|
1381
|
-
* @returns The decompressed version of the data
|
|
1382
|
-
*/
|
|
1383
1402
|
export function gunzipSync(data, opts) {
|
|
1384
1403
|
var st = gzs(data);
|
|
1385
1404
|
if (st + 8 > data.length)
|
|
@@ -1415,9 +1434,12 @@ var Zlib = /*#__PURE__*/ (function () {
|
|
|
1415
1434
|
/**
|
|
1416
1435
|
* Flushes buffered uncompressed data. Useful to immediately retrieve the
|
|
1417
1436
|
* zlibbed output for small inputs.
|
|
1437
|
+
* @param sync Whether to flush to a byte boundary. A sync flush takes 4-5
|
|
1438
|
+
* extra bytes, but guarantees all pushed data is immediately
|
|
1439
|
+
* decompressible.
|
|
1418
1440
|
*/
|
|
1419
|
-
Zlib.prototype.flush = function () {
|
|
1420
|
-
Deflate.prototype.flush.call(this);
|
|
1441
|
+
Zlib.prototype.flush = function (sync) {
|
|
1442
|
+
Deflate.prototype.flush.call(this, sync);
|
|
1421
1443
|
};
|
|
1422
1444
|
return Zlib;
|
|
1423
1445
|
}());
|
|
@@ -1524,12 +1546,6 @@ export function unzlib(data, opts, cb) {
|
|
|
1524
1546
|
function () { return [unzlibSync]; }
|
|
1525
1547
|
], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);
|
|
1526
1548
|
}
|
|
1527
|
-
/**
|
|
1528
|
-
* Expands Zlib data
|
|
1529
|
-
* @param data The data to decompress
|
|
1530
|
-
* @param opts The decompression options
|
|
1531
|
-
* @returns The decompressed version of the data
|
|
1532
|
-
*/
|
|
1533
1549
|
export function unzlibSync(data, opts) {
|
|
1534
1550
|
return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);
|
|
1535
1551
|
}
|
|
@@ -1650,7 +1666,7 @@ var fltn = function (d, p, t, o) {
|
|
|
1650
1666
|
var val = d[k], n = p + k, op = o;
|
|
1651
1667
|
if (Array.isArray(val))
|
|
1652
1668
|
op = mrg(o, val[1]), val = val[0];
|
|
1653
|
-
if (val
|
|
1669
|
+
if (ArrayBuffer.isView(val))
|
|
1654
1670
|
t[n] = [val, op];
|
|
1655
1671
|
else {
|
|
1656
1672
|
t[n += '/'] = [new u8(0), op];
|
|
@@ -1835,15 +1851,30 @@ var dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };
|
|
|
1835
1851
|
var slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };
|
|
1836
1852
|
// read zip header
|
|
1837
1853
|
var zh = function (d, b, z) {
|
|
1838
|
-
var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl
|
|
1839
|
-
var _a =
|
|
1840
|
-
return [b2(d, b + 10), sc, su, fn, es +
|
|
1854
|
+
var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
|
|
1855
|
+
var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];
|
|
1856
|
+
return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
|
|
1841
1857
|
};
|
|
1842
|
-
// read zip64
|
|
1843
|
-
var
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1858
|
+
// read zip64 header sizes
|
|
1859
|
+
var z64hs = function (d, b, l, z, sc, su, off) {
|
|
1860
|
+
var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
|
|
1861
|
+
var nf = nsc + nsu + noff;
|
|
1862
|
+
if (z && nf) {
|
|
1863
|
+
for (; b + 4 < e; b += 4 + b2(d, b + 2)) {
|
|
1864
|
+
if (b2(d, b) == 1) {
|
|
1865
|
+
return [
|
|
1866
|
+
nsc ? b8(d, b + 4 + 8 * nsu) : sc,
|
|
1867
|
+
nsu ? b8(d, b + 4) : su,
|
|
1868
|
+
noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
|
|
1869
|
+
1
|
|
1870
|
+
];
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
// z == 2 for unknown whether or not zip64
|
|
1874
|
+
if (z < 2)
|
|
1875
|
+
err(13);
|
|
1876
|
+
}
|
|
1877
|
+
return [sc, su, off, 0];
|
|
1847
1878
|
};
|
|
1848
1879
|
// extra field length
|
|
1849
1880
|
var exfl = function (ex) {
|
|
@@ -1945,6 +1976,8 @@ var ZipPassThrough = /*#__PURE__*/ (function () {
|
|
|
1945
1976
|
this.size += chunk.length;
|
|
1946
1977
|
if (final)
|
|
1947
1978
|
this.crc = this.c.d();
|
|
1979
|
+
// we shouldn't really do this cast, but properly handling ArrayBufferLike
|
|
1980
|
+
// makes the API unergonomic with Buffer
|
|
1948
1981
|
this.process(chunk, final || false);
|
|
1949
1982
|
};
|
|
1950
1983
|
return ZipPassThrough;
|
|
@@ -2324,8 +2357,9 @@ export function zipSync(data, opts) {
|
|
|
2324
2357
|
var UnzipPassThrough = /*#__PURE__*/ (function () {
|
|
2325
2358
|
function UnzipPassThrough() {
|
|
2326
2359
|
}
|
|
2327
|
-
UnzipPassThrough.prototype.push = function (
|
|
2328
|
-
|
|
2360
|
+
UnzipPassThrough.prototype.push = function (chunk, final) {
|
|
2361
|
+
// same as ZipPassThrough: cast to retain Buffer ergonomics
|
|
2362
|
+
this.ondata(null, chunk, final);
|
|
2329
2363
|
};
|
|
2330
2364
|
UnzipPassThrough.compression = 0;
|
|
2331
2365
|
return UnzipPassThrough;
|
|
@@ -2345,9 +2379,9 @@ var UnzipInflate = /*#__PURE__*/ (function () {
|
|
|
2345
2379
|
_this.ondata(null, dat, final);
|
|
2346
2380
|
});
|
|
2347
2381
|
}
|
|
2348
|
-
UnzipInflate.prototype.push = function (
|
|
2382
|
+
UnzipInflate.prototype.push = function (chunk, final) {
|
|
2349
2383
|
try {
|
|
2350
|
-
this.i.push(
|
|
2384
|
+
this.i.push(chunk, final);
|
|
2351
2385
|
}
|
|
2352
2386
|
catch (e) {
|
|
2353
2387
|
this.ondata(e, null, final);
|
|
@@ -2378,10 +2412,10 @@ var AsyncUnzipInflate = /*#__PURE__*/ (function () {
|
|
|
2378
2412
|
this.terminate = this.i.terminate;
|
|
2379
2413
|
}
|
|
2380
2414
|
}
|
|
2381
|
-
AsyncUnzipInflate.prototype.push = function (
|
|
2415
|
+
AsyncUnzipInflate.prototype.push = function (chunk, final) {
|
|
2382
2416
|
if (this.i.terminate)
|
|
2383
|
-
|
|
2384
|
-
this.i.push(
|
|
2417
|
+
chunk = slc(chunk, 0);
|
|
2418
|
+
this.i.push(chunk, final);
|
|
2385
2419
|
};
|
|
2386
2420
|
AsyncUnzipInflate.compression = 8;
|
|
2387
2421
|
return AsyncUnzipInflate;
|
|
@@ -2438,7 +2472,6 @@ var Unzip = /*#__PURE__*/ (function () {
|
|
|
2438
2472
|
}
|
|
2439
2473
|
var l = buf.length, oc = this.c, add = oc && this.d;
|
|
2440
2474
|
var _loop_2 = function () {
|
|
2441
|
-
var _a;
|
|
2442
2475
|
var sig = b4(buf, i);
|
|
2443
2476
|
if (sig == 0x4034B50) {
|
|
2444
2477
|
f = 1, is = i;
|
|
@@ -2449,13 +2482,11 @@ var Unzip = /*#__PURE__*/ (function () {
|
|
|
2449
2482
|
var chks_3 = [];
|
|
2450
2483
|
this_1.k.unshift(chks_3);
|
|
2451
2484
|
f = 2;
|
|
2452
|
-
var
|
|
2485
|
+
var lsc = b4(buf, i + 18), lsu = b4(buf, i + 22);
|
|
2453
2486
|
var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
else if (dd)
|
|
2458
|
-
sc_1 = -1;
|
|
2487
|
+
var _a = z64hs(buf, i, es, 2, lsc, lsu, 0), sc_1 = _a[0], su_1 = _a[1], z64 = _a[3];
|
|
2488
|
+
if (dd)
|
|
2489
|
+
sc_1 = -1 - z64;
|
|
2459
2490
|
i += es;
|
|
2460
2491
|
this_1.c = sc_1;
|
|
2461
2492
|
var d_1;
|
|
@@ -2568,7 +2599,7 @@ export function unzip(data, opts, cb) {
|
|
|
2568
2599
|
if (lft) {
|
|
2569
2600
|
var c = lft;
|
|
2570
2601
|
var o = b4(data, e + 16);
|
|
2571
|
-
var z =
|
|
2602
|
+
var z = b4(data, e - 20) == 0x7064B50;
|
|
2572
2603
|
if (z) {
|
|
2573
2604
|
var ze = b4(data, e - 12);
|
|
2574
2605
|
z = b4(data, ze) == 0x6064B50;
|
|
@@ -2648,7 +2679,7 @@ export function unzipSync(data, opts) {
|
|
|
2648
2679
|
if (!c)
|
|
2649
2680
|
return {};
|
|
2650
2681
|
var o = b4(data, e + 16);
|
|
2651
|
-
var z =
|
|
2682
|
+
var z = b4(data, e - 20) == 0x7064B50;
|
|
2652
2683
|
if (z) {
|
|
2653
2684
|
var ze = b4(data, e - 12);
|
|
2654
2685
|
z = b4(data, ze) == 0x6064B50;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fflate",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "High performance (de)compression in an 8kB package",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./esm/browser.js",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"types": "./lib/browser.d.cts",
|
|
51
51
|
"default": "./lib/browser.cjs"
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
54
55
|
},
|
|
55
56
|
"targets": {
|
|
56
57
|
"main": false,
|
|
@@ -92,30 +93,30 @@
|
|
|
92
93
|
"build:umd": "SC=buildUMD npm run script",
|
|
93
94
|
"build:rewrite": "SC=rewriteBuilds npm run script",
|
|
94
95
|
"build:demo": "tsc --project tsconfig.demo.json && parcel build demo/index.html --no-cache --public-url \"./\" && SC=cpGHPages npm run script",
|
|
95
|
-
"build:docs": "typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs --readme none --disableSources --excludePrivate --excludeProtected --githubPages false --out docs/ src/index.ts",
|
|
96
|
+
"build:docs": "typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs --readme none --disableSources --excludePrivate --excludeProtected --expandParameters --githubPages false --out docs/ src/index.ts",
|
|
96
97
|
"test": "TS_NODE_PROJECT=test/tsconfig.json uvu -b -r ts-node/register test",
|
|
97
98
|
"prepack": "npm run build && npm run test"
|
|
98
99
|
},
|
|
99
100
|
"devDependencies": {
|
|
100
101
|
"@parcel/service-worker": "^2.9.3",
|
|
101
|
-
"@types/node": "^
|
|
102
|
+
"@types/node": "^25.8.0",
|
|
102
103
|
"@types/pako": "*",
|
|
103
104
|
"@types/react": "^18.2.21",
|
|
104
105
|
"@types/react-dom": "^18.2.7",
|
|
105
|
-
"jszip": "^3.
|
|
106
|
+
"jszip": "^3.10.1",
|
|
106
107
|
"pako": "*",
|
|
107
108
|
"parcel": "^2.9.3",
|
|
108
109
|
"preact": "^10.17.1",
|
|
109
110
|
"react": "^18.2.0",
|
|
110
111
|
"react-dom": "^18.2.0",
|
|
111
112
|
"simple-git": "^3.19.1",
|
|
112
|
-
"terser": "^5.
|
|
113
|
+
"terser": "^5.47.1",
|
|
113
114
|
"tiny-inflate": "*",
|
|
114
|
-
"ts-node": "^10.9.
|
|
115
|
-
"typedoc": "^0.
|
|
116
|
-
"typedoc-plugin-markdown": "^
|
|
117
|
-
"typescript": "^
|
|
118
|
-
"uvu": "^0.
|
|
115
|
+
"ts-node": "^10.9.2",
|
|
116
|
+
"typedoc": "^0.28.19",
|
|
117
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
118
|
+
"typescript": "^6.0.3",
|
|
119
|
+
"uvu": "^0.5.6",
|
|
119
120
|
"uzip": "*"
|
|
120
121
|
},
|
|
121
122
|
"alias": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# jiti
|
|
2
|
+
|
|
3
|
+
<!-- automd:badges color=F0DB4F bundlephobia -->
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.com/package/jiti)
|
|
6
|
+
[](https://npmjs.com/package/jiti)
|
|
7
|
+
[](https://bundlephobia.com/package/jiti)
|
|
8
|
+
|
|
9
|
+
<!-- /automd -->
|
|
10
|
+
|
|
11
|
+
> This is the active development branch. Check out [jiti/v1](https://github.com/unjs/jiti/tree/v1) for legacy v1 docs and code.
|
|
12
|
+
|
|
13
|
+
## 🌟 Used in
|
|
14
|
+
|
|
15
|
+
[Docusaurus](https://docusaurus.io/), [ESLint](https://github.com/eslint/eslint), [FormKit](https://formkit.com/), [Histoire](https://histoire.dev/), [Knip](https://knip.dev/), [Nitro](https://nitro.unjs.io/), [Nuxt](https://nuxt.com/), [PostCSS loader](https://github.com/webpack-contrib/postcss-loader), [Rsbuild](https://rsbuild.dev/), [Size Limit](https://github.com/ai/size-limit), [Slidev](https://sli.dev/), [Tailwindcss](https://tailwindcss.com/), [Tokenami](https://github.com/tokenami/tokenami), [UnoCSS](https://unocss.dev/), [WXT](https://wxt.dev/), [Winglang](https://www.winglang.io/), [Graphql code generator](https://the-guild.dev/graphql/codegen), [Lingui](https://lingui.dev/), [Scaffdog](https://scaff.dog/), [Storybook](https://storybook.js.org), [...UnJS ecosystem](https://unjs.io/), [...60M+ npm monthly downloads](https://npm.chart.dev/jiti), [...6M+ public repositories](https://github.com/unjs/jiti/network/dependents).
|
|
16
|
+
|
|
17
|
+
## ✅ Features
|
|
18
|
+
|
|
19
|
+
- Seamless TypeScript and ESM syntax support for Node.js
|
|
20
|
+
- Seamless interoperability between ESM and CommonJS
|
|
21
|
+
- Asynchronous API to replace `import()`
|
|
22
|
+
- Synchronous API to replace `require()` (deprecated)
|
|
23
|
+
- Super slim and zero dependency
|
|
24
|
+
- Custom resolve aliases
|
|
25
|
+
- Smart syntax detection to avoid extra transforms
|
|
26
|
+
- Node.js native `require.cache` integration
|
|
27
|
+
- Filesystem transpile with hard disk caches
|
|
28
|
+
- ESM Loader support
|
|
29
|
+
- JSX support (opt-in)
|
|
30
|
+
|
|
31
|
+
> [!IMPORTANT]
|
|
32
|
+
> To enhance compatibility, jiti `>=2.1` enabled [`interopDefault`](#interopdefault) using a new Proxy method. If you migrated to `2.0.0` earlier, this might have caused behavior changes. In case of any issues during the upgrade, please [report](https://github.com/unjs/jiti/issues) so we can investigate to solve them. 🙏🏼
|
|
33
|
+
|
|
34
|
+
## 💡 Usage
|
|
35
|
+
|
|
36
|
+
### CLI
|
|
37
|
+
|
|
38
|
+
You can use `jiti` CLI to quickly run any script with TypeScript and native ESM support!
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx jiti ./index.ts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Programmatic
|
|
45
|
+
|
|
46
|
+
Initialize a jiti instance:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// ESM
|
|
50
|
+
import { createJiti } from "jiti";
|
|
51
|
+
const jiti = createJiti(import.meta.url);
|
|
52
|
+
|
|
53
|
+
// CommonJS (deprecated)
|
|
54
|
+
const { createJiti } = require("jiti");
|
|
55
|
+
const jiti = createJiti(__filename);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Import (async) and resolve with ESM compatibility:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
// jiti.import(id) is similar to import(id)
|
|
62
|
+
const mod = await jiti.import("./path/to/file.ts");
|
|
63
|
+
|
|
64
|
+
// jiti.esmResolve(id) is similar to import.meta.resolve(id)
|
|
65
|
+
const resolvedPath = jiti.esmResolve("./src");
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If you need the default export of module, you can use `jiti.import(id, { default: true })` as shortcut to `mod?.default ?? mod`.
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
// shortcut to mod?.default ?? mod
|
|
72
|
+
const modDefault = await jiti.import("./path/to/file.ts", { default: true });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
CommonJS (sync & deprecated):
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
// jiti() is similar to require(id)
|
|
79
|
+
const mod = jiti("./path/to/file.ts");
|
|
80
|
+
|
|
81
|
+
// jiti.resolve() is similar to require.resolve(id)
|
|
82
|
+
const resolvedPath = jiti.resolve("./src");
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You can also pass options as the second argument:
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
const jiti = createJiti(import.meta.url, { debug: true });
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Register global ESM loader
|
|
92
|
+
|
|
93
|
+
You can globally register jiti using [global hooks](https://nodejs.org/api/module.html#initialize). (Important: Requires Node.js > 20)
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import "jiti/register";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Or:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
node --import jiti/register index.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🎈 `jiti/native`
|
|
106
|
+
|
|
107
|
+
You can alias `jiti` to `jiti/native` to directly depend on runtime's [`import.meta.resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve) and dynamic [`import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) support. This allows easing up the ecosystem transition to runtime native support by giving the same API of jiti.
|
|
108
|
+
|
|
109
|
+
## ⚙️ Options
|
|
110
|
+
|
|
111
|
+
### `debug`
|
|
112
|
+
|
|
113
|
+
- Type: Boolean
|
|
114
|
+
- Default: `false`
|
|
115
|
+
- Environment variable: `JITI_DEBUG`
|
|
116
|
+
|
|
117
|
+
Enable verbose logging. You can use `JITI_DEBUG=1 <your command>` to enable it.
|
|
118
|
+
|
|
119
|
+
### `fsCache`
|
|
120
|
+
|
|
121
|
+
- Type: Boolean | String
|
|
122
|
+
- Default: `true`
|
|
123
|
+
- Environment variable: `JITI_FS_CACHE`
|
|
124
|
+
|
|
125
|
+
Filesystem source cache (enabled by default)
|
|
126
|
+
|
|
127
|
+
By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
|
|
128
|
+
|
|
129
|
+
**Note:** It is recommended that this option be enabled for better performance.
|
|
130
|
+
|
|
131
|
+
### `rebuildFsCache`
|
|
132
|
+
|
|
133
|
+
- Type: Boolean
|
|
134
|
+
- Default: `false`
|
|
135
|
+
- Environment variable: `JITI_REBUILD_FS_CACHE`
|
|
136
|
+
|
|
137
|
+
Rebuild filesystem source cache created by `fsCache`.
|
|
138
|
+
|
|
139
|
+
### `moduleCache`
|
|
140
|
+
|
|
141
|
+
- Type: String
|
|
142
|
+
- Default: `true`
|
|
143
|
+
- Environment variable: `JITI_MODULE_CACHE`
|
|
144
|
+
|
|
145
|
+
Runtime module cache (enabled by default).
|
|
146
|
+
|
|
147
|
+
Disabling allows editing code and importing the same module multiple times.
|
|
148
|
+
|
|
149
|
+
When enabled, jiti integrates with Node.js native CommonJS cache-store.
|
|
150
|
+
|
|
151
|
+
### `transform`
|
|
152
|
+
|
|
153
|
+
- Type: Function
|
|
154
|
+
- Default: Babel (lazy loaded)
|
|
155
|
+
|
|
156
|
+
Transform function. See [src/babel](./src/babel.ts) for more details
|
|
157
|
+
|
|
158
|
+
### `sourceMaps`
|
|
159
|
+
|
|
160
|
+
- Type: Boolean
|
|
161
|
+
- Default `false`
|
|
162
|
+
- Environment variable: `JITI_SOURCE_MAPS`
|
|
163
|
+
|
|
164
|
+
Add inline source map to transformed source for better debugging.
|
|
165
|
+
|
|
166
|
+
### `interopDefault`
|
|
167
|
+
|
|
168
|
+
- Type: Boolean
|
|
169
|
+
- Default: `true`
|
|
170
|
+
- Environment variable: `JITI_INTEROP_DEFAULT`
|
|
171
|
+
|
|
172
|
+
Jiti combines module exports with the `default` export using an internal Proxy to improve compatibility with mixed CJS/ESM usage. You can check the current implementation [here](https://github.com/unjs/jiti/blob/main/src/utils.ts#L105).
|
|
173
|
+
|
|
174
|
+
> [!WARNING]
|
|
175
|
+
> This option wraps **all imported modules** in a Proxy, which adds ~25-50ns overhead per property access. For performance-critical hot paths where you access module exports very frequently, consider setting `interopDefault: false` or `JITI_INTEROP_DEFAULT=false`.
|
|
176
|
+
|
|
177
|
+
### `alias`
|
|
178
|
+
|
|
179
|
+
- Type: Object
|
|
180
|
+
- Default: -
|
|
181
|
+
- Environment variable: `JITI_ALIAS`
|
|
182
|
+
|
|
183
|
+
You can also pass an object to the environment variable for inline config. Example: `JITI_ALIAS='{"~/*": "./src/*"}' jiti ...`.
|
|
184
|
+
|
|
185
|
+
Custom alias map used to resolve IDs.
|
|
186
|
+
|
|
187
|
+
### `tsconfigPaths`
|
|
188
|
+
|
|
189
|
+
- Type: Boolean | String
|
|
190
|
+
- Default: `false`
|
|
191
|
+
- Environment variable: `JITI_TSCONFIG_PATHS`
|
|
192
|
+
|
|
193
|
+
Enable TypeScript [`paths`](https://www.typescriptlang.org/tsconfig/#paths) resolution using [`get-tsconfig`](https://github.com/privatenumber/get-tsconfig).
|
|
194
|
+
|
|
195
|
+
- `true`: Auto-discover `tsconfig.json` by walking up from the jiti instance's parent path.
|
|
196
|
+
- `string`: Explicit path to a `tsconfig.json` file.
|
|
197
|
+
- `false` (default): Disabled.
|
|
198
|
+
|
|
199
|
+
### `nativeModules`
|
|
200
|
+
|
|
201
|
+
- Type: Array
|
|
202
|
+
- Default: ['typescript']
|
|
203
|
+
- Environment variable: `JITI_NATIVE_MODULES`
|
|
204
|
+
|
|
205
|
+
List of modules (within `node_modules`) to always use native `require()` for them.
|
|
206
|
+
|
|
207
|
+
### `transformModules`
|
|
208
|
+
|
|
209
|
+
- Type: Array
|
|
210
|
+
- Default: []
|
|
211
|
+
- Environment variable: `JITI_TRANSFORM_MODULES`
|
|
212
|
+
|
|
213
|
+
List of modules (within `node_modules`) to transform them regardless of syntax.
|
|
214
|
+
|
|
215
|
+
### `importMeta`
|
|
216
|
+
|
|
217
|
+
Parent module's [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) context to use for ESM resolution. (only used for `jiti/native` import).
|
|
218
|
+
|
|
219
|
+
### `tryNative`
|
|
220
|
+
|
|
221
|
+
- Type: Boolean
|
|
222
|
+
- Default: Enabled if bun is detected
|
|
223
|
+
- Environment variable: `JITI_TRY_NATIVE`
|
|
224
|
+
|
|
225
|
+
Try to use native require and import without jiti transformations first.
|
|
226
|
+
|
|
227
|
+
### `jsx`
|
|
228
|
+
|
|
229
|
+
- Type: Boolean | {options}
|
|
230
|
+
- Default: `false`
|
|
231
|
+
- Environment Variable: `JITI_JSX`
|
|
232
|
+
|
|
233
|
+
Enable JSX support using [`@babel/plugin-transform-react-jsx`](https://babeljs.io/docs/babel-plugin-transform-react-jsx).
|
|
234
|
+
|
|
235
|
+
See [`test/fixtures/jsx`](./test/fixtures/jsx) for framework integration examples.
|
|
236
|
+
|
|
237
|
+
## Development
|
|
238
|
+
|
|
239
|
+
- Clone this repository
|
|
240
|
+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
|
241
|
+
- Install dependencies using `pnpm install`
|
|
242
|
+
- Run `pnpm dev`
|
|
243
|
+
- Run `pnpm jiti ./test/path/to/file.ts`
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
<!-- automd:contributors license=MIT author="pi0" -->
|
|
248
|
+
|
|
249
|
+
Published under the [MIT](https://github.com/unjs/jiti/blob/main/LICENSE) license.
|
|
250
|
+
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/jiti/graphs/contributors) 💛
|
|
251
|
+
<br><br>
|
|
252
|
+
<a href="https://github.com/unjs/jiti/graphs/contributors">
|
|
253
|
+
<img src="https://contrib.rocks/image?repo=unjs/jiti" />
|
|
254
|
+
</a>
|
|
255
|
+
|
|
256
|
+
<!-- /automd -->
|
|
257
|
+
|
|
258
|
+
<!-- automd:with-automd -->
|