repl-sdk 0.0.0 → 1.0.1
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/apl-fqmucPXA.js +141 -0
- package/dist/apl-fqmucPXA.js.map +1 -0
- package/dist/asciiarmor-DucZyvP0.js +57 -0
- package/dist/asciiarmor-DucZyvP0.js.map +1 -0
- package/dist/asn1-BnOEsgAm.js +145 -0
- package/dist/asn1-BnOEsgAm.js.map +1 -0
- package/dist/assets/tar-worker-CxTcoQcr.js +593 -0
- package/dist/assets/tar-worker-CxTcoQcr.js.map +1 -0
- package/dist/asterisk-QAlztEwS.js +346 -0
- package/dist/asterisk-QAlztEwS.js.map +1 -0
- package/dist/brainfuck-DZVCuF_t.js +54 -0
- package/dist/brainfuck-DZVCuF_t.js.map +1 -0
- package/dist/clike-CTYGlS6x.js +800 -0
- package/dist/clike-CTYGlS6x.js.map +1 -0
- package/dist/clojure-BhXMqnxz.js +850 -0
- package/dist/clojure-BhXMqnxz.js.map +1 -0
- package/dist/cmake-BGaNd9E7.js +72 -0
- package/dist/cmake-BGaNd9E7.js.map +1 -0
- package/dist/cobol-4yqQntpt.js +121 -0
- package/dist/cobol-4yqQntpt.js.map +1 -0
- package/dist/codemirror-De3S70Np.js +2912 -0
- package/dist/codemirror-De3S70Np.js.map +1 -0
- package/dist/coffeescript-D2dXvhEc.js +309 -0
- package/dist/coffeescript-D2dXvhEc.js.map +1 -0
- package/dist/commonlisp-CF_VNHQR.js +131 -0
- package/dist/commonlisp-CF_VNHQR.js.map +1 -0
- package/dist/crystal-DyuLTqLs.js +399 -0
- package/dist/crystal-DyuLTqLs.js.map +1 -0
- package/dist/css-DkSyTW67.js +1773 -0
- package/dist/css-DkSyTW67.js.map +1 -0
- package/dist/cypher-Dlu_3r4V.js +122 -0
- package/dist/cypher-Dlu_3r4V.js.map +1 -0
- package/dist/d-UURgV0Ux.js +180 -0
- package/dist/d-UURgV0Ux.js.map +1 -0
- package/dist/diff-B_Bi2Crb.js +26 -0
- package/dist/diff-B_Bi2Crb.js.map +1 -0
- package/dist/dockerfile-Bvk733Ga.js +202 -0
- package/dist/dockerfile-Bvk733Ga.js.map +1 -0
- package/dist/dtd-Dy74G54E.js +115 -0
- package/dist/dtd-Dy74G54E.js.map +1 -0
- package/dist/dylan-TSb-Nfix.js +315 -0
- package/dist/dylan-TSb-Nfix.js.map +1 -0
- package/dist/ebnf-4fKAGW3a.js +141 -0
- package/dist/ebnf-4fKAGW3a.js.map +1 -0
- package/dist/ecl-B59qGGVg.js +179 -0
- package/dist/ecl-B59qGGVg.js.map +1 -0
- package/dist/eiffel-Dze7nlu3.js +135 -0
- package/dist/eiffel-Dze7nlu3.js.map +1 -0
- package/dist/elm-DG7jkhNZ.js +177 -0
- package/dist/elm-DG7jkhNZ.js.map +1 -0
- package/dist/erlang-BO6gOnGA.js +675 -0
- package/dist/erlang-BO6gOnGA.js.map +1 -0
- package/dist/factor-CMxFHDqz.js +66 -0
- package/dist/factor-CMxFHDqz.js.map +1 -0
- package/dist/fcl-CDDUNjTj.js +142 -0
- package/dist/fcl-CDDUNjTj.js.map +1 -0
- package/dist/forth-B9D2JCeE.js +117 -0
- package/dist/forth-B9D2JCeE.js.map +1 -0
- package/dist/fortran-CAG2BFbe.js +468 -0
- package/dist/fortran-CAG2BFbe.js.map +1 -0
- package/dist/gas-0Aw8zDr5.js +294 -0
- package/dist/gas-0Aw8zDr5.js.map +1 -0
- package/dist/gherkin-DhZlEZiy.js +116 -0
- package/dist/gherkin-DhZlEZiy.js.map +1 -0
- package/dist/gjs-DfguZDLq.js +173 -0
- package/dist/gjs-DfguZDLq.js.map +1 -0
- package/dist/gmd-Yas-Oo8k.js +163 -0
- package/dist/gmd-Yas-Oo8k.js.map +1 -0
- package/dist/groovy-CpwJiBl7.js +224 -0
- package/dist/groovy-CpwJiBl7.js.map +1 -0
- package/dist/haskell-ySd-OUo8.js +460 -0
- package/dist/haskell-ySd-OUo8.js.map +1 -0
- package/dist/haxe-7MlzfeYV.js +515 -0
- package/dist/haxe-7MlzfeYV.js.map +1 -0
- package/dist/hbs-CxcmWxSJ.js +62 -0
- package/dist/hbs-CxcmWxSJ.js.map +1 -0
- package/dist/http-BqypyemW.js +80 -0
- package/dist/http-BqypyemW.js.map +1 -0
- package/dist/idl-4HIGJlDI.js +986 -0
- package/dist/idl-4HIGJlDI.js.map +1 -0
- package/dist/index-B3Meoznj.js +118 -0
- package/dist/index-B3Meoznj.js.map +1 -0
- package/dist/index-BQyfDUUx.js +692 -0
- package/dist/index-BQyfDUUx.js.map +1 -0
- package/dist/index-BRDroAD8.js +305 -0
- package/dist/index-BRDroAD8.js.map +1 -0
- package/dist/index-BRMAzRyM.js +179 -0
- package/dist/index-BRMAzRyM.js.map +1 -0
- package/dist/index-Bb8uYQgv.js +927 -0
- package/dist/index-Bb8uYQgv.js.map +1 -0
- package/dist/index-BlOjO66K.js +17618 -0
- package/dist/index-BlOjO66K.js.map +1 -0
- package/dist/index-BoGWnSNL.js +706 -0
- package/dist/index-BoGWnSNL.js.map +1 -0
- package/dist/index-BsRrEiOu.js +98 -0
- package/dist/index-BsRrEiOu.js.map +1 -0
- package/dist/index-C2sFZMth.js +391 -0
- package/dist/index-C2sFZMth.js.map +1 -0
- package/dist/index-C7xwOjmS.js +291 -0
- package/dist/index-C7xwOjmS.js.map +1 -0
- package/dist/index-CA3lFUx6.js +315 -0
- package/dist/index-CA3lFUx6.js.map +1 -0
- package/dist/index-CB-pPTIf.js +98 -0
- package/dist/index-CB-pPTIf.js.map +1 -0
- package/dist/index-CCa6x1FE.js +386 -0
- package/dist/index-CCa6x1FE.js.map +1 -0
- package/dist/index-CD4DINI1.js +158 -0
- package/dist/index-CD4DINI1.js.map +1 -0
- package/dist/index-CE0B_fcG.js +328 -0
- package/dist/index-CE0B_fcG.js.map +1 -0
- package/dist/index-CVGAEPMV.js +2139 -0
- package/dist/index-CVGAEPMV.js.map +1 -0
- package/dist/index-CmaT2afn.js +332 -0
- package/dist/index-CmaT2afn.js.map +1 -0
- package/dist/index-D8sUxXp5.js +83 -0
- package/dist/index-D8sUxXp5.js.map +1 -0
- package/dist/index-DIz8Vpn-.js +737 -0
- package/dist/index-DIz8Vpn-.js.map +1 -0
- package/dist/index-DNP1xT-S.js +408 -0
- package/dist/index-DNP1xT-S.js.map +1 -0
- package/dist/index-DOAqdvnQ.js +862 -0
- package/dist/index-DOAqdvnQ.js.map +1 -0
- package/dist/index-DVUMFbgi.js +152 -0
- package/dist/index-DVUMFbgi.js.map +1 -0
- package/dist/index-VeTBKRVd.js +83 -0
- package/dist/index-VeTBKRVd.js.map +1 -0
- package/dist/index-dXZeR7Bx.js +1767 -0
- package/dist/index-dXZeR7Bx.js.map +1 -0
- package/dist/index-gtqbIb6T.js +62 -0
- package/dist/index-gtqbIb6T.js.map +1 -0
- package/dist/index-pN_pUAQ7.js +2426 -0
- package/dist/index-pN_pUAQ7.js.map +1 -0
- package/dist/index-wasu5VX0.js +1150 -0
- package/dist/index-wasu5VX0.js.map +1 -0
- package/dist/javascript-Bt8B7yTi.js +993 -0
- package/dist/javascript-Bt8B7yTi.js.map +1 -0
- package/dist/julia-Bs6JJhYG.js +408 -0
- package/dist/julia-Bs6JJhYG.js.map +1 -0
- package/dist/livescript-DmzgM3Yt.js +297 -0
- package/dist/livescript-DmzgM3Yt.js.map +1 -0
- package/dist/lua-8cJgIlqe.js +257 -0
- package/dist/lua-8cJgIlqe.js.map +1 -0
- package/dist/mathematica-DNLOL9PQ.js +111 -0
- package/dist/mathematica-DNLOL9PQ.js.map +1 -0
- package/dist/mbox-Ga7d4MMN.js +118 -0
- package/dist/mbox-Ga7d4MMN.js.map +1 -0
- package/dist/mirc-Dma3B8rS.js +108 -0
- package/dist/mirc-Dma3B8rS.js.map +1 -0
- package/dist/mllike-DHn7xckP.js +335 -0
- package/dist/mllike-DHn7xckP.js.map +1 -0
- package/dist/modelica-0d55jYY0.js +148 -0
- package/dist/modelica-0d55jYY0.js.map +1 -0
- package/dist/mscgen-DdqZYINH.js +136 -0
- package/dist/mscgen-DdqZYINH.js.map +1 -0
- package/dist/mumps-Btr8VblO.js +94 -0
- package/dist/mumps-Btr8VblO.js.map +1 -0
- package/dist/nginx-DTDtBDVN.js +142 -0
- package/dist/nginx-DTDtBDVN.js.map +1 -0
- package/dist/nsis-3zG7tgur.js +63 -0
- package/dist/nsis-3zG7tgur.js.map +1 -0
- package/dist/ntriples-CvgOYMpL.js +154 -0
- package/dist/ntriples-CvgOYMpL.js.map +1 -0
- package/dist/octave-DYBj3-tl.js +201 -0
- package/dist/octave-DYBj3-tl.js.map +1 -0
- package/dist/oz-R_e8WMIi.js +232 -0
- package/dist/oz-R_e8WMIi.js.map +1 -0
- package/dist/parse-CAqQaKsh.js +21685 -0
- package/dist/parse-CAqQaKsh.js.map +1 -0
- package/dist/pascal-GD8iposT.js +106 -0
- package/dist/pascal-GD8iposT.js.map +1 -0
- package/dist/perl-DL9mHpoi.js +1106 -0
- package/dist/perl-DL9mHpoi.js.map +1 -0
- package/dist/pig-C_4T4YIV.js +102 -0
- package/dist/pig-C_4T4YIV.js.map +1 -0
- package/dist/powershell-B0suO7Vd.js +329 -0
- package/dist/powershell-B0suO7Vd.js.map +1 -0
- package/dist/properties-BR-vP1aU.js +59 -0
- package/dist/properties-BR-vP1aU.js.map +1 -0
- package/dist/protobuf-BxgpyhoW.js +78 -0
- package/dist/protobuf-BxgpyhoW.js.map +1 -0
- package/dist/pug-vHnWR0UE.js +406 -0
- package/dist/pug-vHnWR0UE.js.map +1 -0
- package/dist/puppet-Bdao66PW.js +138 -0
- package/dist/puppet-Bdao66PW.js.map +1 -0
- package/dist/python-BFGRmuZ9.js +427 -0
- package/dist/python-BFGRmuZ9.js.map +1 -0
- package/dist/q-CrbCVq4a.js +132 -0
- package/dist/q-CrbCVq4a.js.map +1 -0
- package/dist/r-V7nswm59.js +171 -0
- package/dist/r-V7nswm59.js.map +1 -0
- package/dist/render-app-island-B-i8rvGi.js +61 -0
- package/dist/render-app-island-B-i8rvGi.js.map +1 -0
- package/dist/repl-sdk.js +7 -0
- package/dist/repl-sdk.js.map +1 -0
- package/dist/rpm-C-DLY-If.js +110 -0
- package/dist/rpm-C-DLY-If.js.map +1 -0
- package/dist/ruby-JDKLJNK0.js +331 -0
- package/dist/ruby-JDKLJNK0.js.map +1 -0
- package/dist/sas-D2UG-yhZ.js +208 -0
- package/dist/sas-D2UG-yhZ.js.map +1 -0
- package/dist/scheme-BKzrkGJD.js +223 -0
- package/dist/scheme-BKzrkGJD.js.map +1 -0
- package/dist/shell-BlsXDxCn.js +223 -0
- package/dist/shell-BlsXDxCn.js.map +1 -0
- package/dist/sieve-CjwBwOY5.js +136 -0
- package/dist/sieve-CjwBwOY5.js.map +1 -0
- package/dist/simple-mode-DMneyfDu.js +131 -0
- package/dist/simple-mode-DMneyfDu.js.map +1 -0
- package/dist/smalltalk-BOIGQuhN.js +122 -0
- package/dist/smalltalk-BOIGQuhN.js.map +1 -0
- package/dist/solr-CwD7U71z.js +70 -0
- package/dist/solr-CwD7U71z.js.map +1 -0
- package/dist/sparql-DYskk2vE.js +250 -0
- package/dist/sparql-DYskk2vE.js.map +1 -0
- package/dist/spreadsheet-Bgtt3oLP.js +88 -0
- package/dist/spreadsheet-Bgtt3oLP.js.map +1 -0
- package/dist/sql-Cei9CMfk.js +343 -0
- package/dist/sql-Cei9CMfk.js.map +1 -0
- package/dist/stex-C1nZSzAw.js +231 -0
- package/dist/stex-C1nZSzAw.js.map +1 -0
- package/dist/stylus-BkS-boTH.js +566 -0
- package/dist/stylus-BkS-boTH.js.map +1 -0
- package/dist/swift-FRZi1uvB.js +292 -0
- package/dist/swift-FRZi1uvB.js.map +1 -0
- package/dist/tcl-CUcaCdmq.js +115 -0
- package/dist/tcl-CUcaCdmq.js.map +1 -0
- package/dist/textile-BnFpjsrl.js +415 -0
- package/dist/textile-BnFpjsrl.js.map +1 -0
- package/dist/tiddlywiki-CjprD-Qp.js +219 -0
- package/dist/tiddlywiki-CjprD-Qp.js.map +1 -0
- package/dist/tiki-DK9DOeWn.js +269 -0
- package/dist/tiki-DK9DOeWn.js.map +1 -0
- package/dist/toml-BOuWGMcf.js +77 -0
- package/dist/toml-BOuWGMcf.js.map +1 -0
- package/dist/troff-E1bJ0PPL.js +62 -0
- package/dist/troff-E1bJ0PPL.js.map +1 -0
- package/dist/ttcn-cfg-Dc39-fIP.js +134 -0
- package/dist/ttcn-cfg-Dc39-fIP.js.map +1 -0
- package/dist/ttcn-tKd4HLu4.js +193 -0
- package/dist/ttcn-tKd4HLu4.js.map +1 -0
- package/dist/turtle-Dq7-1WAf.js +125 -0
- package/dist/turtle-Dq7-1WAf.js.map +1 -0
- package/dist/vb-Dp90gtsv.js +197 -0
- package/dist/vb-Dp90gtsv.js.map +1 -0
- package/dist/vbscript-Bfn8O8I7.js +479 -0
- package/dist/vbscript-Bfn8O8I7.js.map +1 -0
- package/dist/velocity-BwIZK1TH.js +150 -0
- package/dist/velocity-BwIZK1TH.js.map +1 -0
- package/dist/verilog-CnT9bMk0.js +430 -0
- package/dist/verilog-CnT9bMk0.js.map +1 -0
- package/dist/vhdl-DCkMIyT9.js +159 -0
- package/dist/vhdl-DCkMIyT9.js.map +1 -0
- package/dist/webidl-BTLTThCm.js +205 -0
- package/dist/webidl-BTLTThCm.js.map +1 -0
- package/dist/xquery-BrBUuxMR.js +526 -0
- package/dist/xquery-BrBUuxMR.js.map +1 -0
- package/dist/yacas-b5lAVEIl.js +131 -0
- package/dist/yacas-b5lAVEIl.js.map +1 -0
- package/dist/z80-ClgwfNdB.js +93 -0
- package/dist/z80-ClgwfNdB.js.map +1 -0
- package/package.json +81 -9
- package/src/cache.js +138 -0
- package/src/cdn.js +93 -0
- package/src/codemirror.js +161 -0
- package/src/compilers/ember/gjs.js +212 -0
- package/src/compilers/ember/gmd.js +190 -0
- package/src/compilers/ember/hbs.js +98 -0
- package/src/compilers/ember/render-app-island.js +83 -0
- package/src/compilers/ember.js +166 -0
- package/src/compilers/js.js +32 -0
- package/src/compilers/markdown/build-compiler.js +151 -0
- package/src/compilers/markdown/const.js +2 -0
- package/src/compilers/markdown/heading-id.js +75 -0
- package/src/compilers/markdown/live-code-extraction.js +198 -0
- package/src/compilers/markdown/parse.js +22 -0
- package/src/compilers/markdown/parse.test.ts +363 -0
- package/src/compilers/markdown/sanitize-for-glimmer.js +26 -0
- package/src/compilers/markdown/types.ts +21 -0
- package/src/compilers/markdown/utils.js +78 -0
- package/src/compilers/markdown.js +125 -0
- package/src/compilers/mermaid.js +35 -0
- package/src/compilers/react.js +59 -0
- package/src/compilers/svelte.js +116 -0
- package/src/compilers/vue.js +58 -0
- package/src/compilers.js +108 -0
- package/src/es-module-shim.js +53 -0
- package/src/index.d.ts +53 -4
- package/src/index.js +744 -89
- package/src/npm.js +58 -0
- package/src/request.Request.test.ts +59 -0
- package/src/request.js +140 -0
- package/src/resolve.fromImports.test.ts +35 -0
- package/src/resolve.fromInternalImport.test.ts +69 -0
- package/src/resolve.js +352 -0
- package/src/resolve.resolvePath.test.ts +24 -0
- package/src/resolve.test.ts +23 -0
- package/src/specifier.js +71 -0
- package/src/specifier.test.ts +90 -0
- package/src/tar-worker.js +61 -0
- package/src/tar.js +76 -0
- package/src/types.ts +335 -58
- package/src/utils.js +28 -1
- package/declarations/index.d.ts +0 -73
- package/dist/index.js +0 -107
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
"use strict";
|
|
3
|
+
const proxyMarker = Symbol("Comlink.proxy");
|
|
4
|
+
const createEndpoint = Symbol("Comlink.endpoint");
|
|
5
|
+
const releaseProxy = Symbol("Comlink.releaseProxy");
|
|
6
|
+
const finalizer = Symbol("Comlink.finalizer");
|
|
7
|
+
const throwMarker = Symbol("Comlink.thrown");
|
|
8
|
+
const isObject = (val) => typeof val === "object" && val !== null || typeof val === "function";
|
|
9
|
+
const proxyTransferHandler = {
|
|
10
|
+
canHandle: (val) => isObject(val) && val[proxyMarker],
|
|
11
|
+
serialize(obj2) {
|
|
12
|
+
const { port1, port2 } = new MessageChannel();
|
|
13
|
+
expose(obj2, port1);
|
|
14
|
+
return [port2, [port2]];
|
|
15
|
+
},
|
|
16
|
+
deserialize(port) {
|
|
17
|
+
port.start();
|
|
18
|
+
return wrap(port);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const throwTransferHandler = {
|
|
22
|
+
canHandle: (value) => isObject(value) && throwMarker in value,
|
|
23
|
+
serialize({ value }) {
|
|
24
|
+
let serialized;
|
|
25
|
+
if (value instanceof Error) {
|
|
26
|
+
serialized = {
|
|
27
|
+
isError: true,
|
|
28
|
+
value: {
|
|
29
|
+
message: value.message,
|
|
30
|
+
name: value.name,
|
|
31
|
+
stack: value.stack
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
} else {
|
|
35
|
+
serialized = { isError: false, value };
|
|
36
|
+
}
|
|
37
|
+
return [serialized, []];
|
|
38
|
+
},
|
|
39
|
+
deserialize(serialized) {
|
|
40
|
+
if (serialized.isError) {
|
|
41
|
+
throw Object.assign(new Error(serialized.value.message), serialized.value);
|
|
42
|
+
}
|
|
43
|
+
throw serialized.value;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const transferHandlers = /* @__PURE__ */ new Map([
|
|
47
|
+
["proxy", proxyTransferHandler],
|
|
48
|
+
["throw", throwTransferHandler]
|
|
49
|
+
]);
|
|
50
|
+
function isAllowedOrigin(allowedOrigins, origin) {
|
|
51
|
+
for (const allowedOrigin of allowedOrigins) {
|
|
52
|
+
if (origin === allowedOrigin || allowedOrigin === "*") {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function expose(obj2, ep = globalThis, allowedOrigins = ["*"]) {
|
|
62
|
+
ep.addEventListener("message", function callback(ev) {
|
|
63
|
+
if (!ev || !ev.data) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
|
|
67
|
+
console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const { id, type, path } = Object.assign({ path: [] }, ev.data);
|
|
71
|
+
const argumentList = (ev.data.argumentList || []).map(fromWireValue);
|
|
72
|
+
let returnValue;
|
|
73
|
+
try {
|
|
74
|
+
const parent = path.slice(0, -1).reduce((obj3, prop) => obj3[prop], obj2);
|
|
75
|
+
const rawValue = path.reduce((obj3, prop) => obj3[prop], obj2);
|
|
76
|
+
switch (type) {
|
|
77
|
+
case "GET":
|
|
78
|
+
{
|
|
79
|
+
returnValue = rawValue;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case "SET":
|
|
83
|
+
{
|
|
84
|
+
parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
|
|
85
|
+
returnValue = true;
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "APPLY":
|
|
89
|
+
{
|
|
90
|
+
returnValue = rawValue.apply(parent, argumentList);
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "CONSTRUCT":
|
|
94
|
+
{
|
|
95
|
+
const value = new rawValue(...argumentList);
|
|
96
|
+
returnValue = proxy(value);
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "ENDPOINT":
|
|
100
|
+
{
|
|
101
|
+
const { port1, port2 } = new MessageChannel();
|
|
102
|
+
expose(obj2, port2);
|
|
103
|
+
returnValue = transfer(port1, [port1]);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case "RELEASE":
|
|
107
|
+
{
|
|
108
|
+
returnValue = void 0;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
} catch (value) {
|
|
115
|
+
returnValue = { value, [throwMarker]: 0 };
|
|
116
|
+
}
|
|
117
|
+
Promise.resolve(returnValue).catch((value) => {
|
|
118
|
+
return { value, [throwMarker]: 0 };
|
|
119
|
+
}).then((returnValue2) => {
|
|
120
|
+
const [wireValue, transferables] = toWireValue(returnValue2);
|
|
121
|
+
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
|
|
122
|
+
if (type === "RELEASE") {
|
|
123
|
+
ep.removeEventListener("message", callback);
|
|
124
|
+
closeEndPoint(ep);
|
|
125
|
+
if (finalizer in obj2 && typeof obj2[finalizer] === "function") {
|
|
126
|
+
obj2[finalizer]();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}).catch((error) => {
|
|
130
|
+
const [wireValue, transferables] = toWireValue({
|
|
131
|
+
value: new TypeError("Unserializable return value"),
|
|
132
|
+
[throwMarker]: 0
|
|
133
|
+
});
|
|
134
|
+
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
if (ep.start) {
|
|
138
|
+
ep.start();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function isMessagePort(endpoint) {
|
|
142
|
+
return endpoint.constructor.name === "MessagePort";
|
|
143
|
+
}
|
|
144
|
+
function closeEndPoint(endpoint) {
|
|
145
|
+
if (isMessagePort(endpoint))
|
|
146
|
+
endpoint.close();
|
|
147
|
+
}
|
|
148
|
+
function wrap(ep, target) {
|
|
149
|
+
const pendingListeners = /* @__PURE__ */ new Map();
|
|
150
|
+
ep.addEventListener("message", function handleMessage(ev) {
|
|
151
|
+
const { data } = ev;
|
|
152
|
+
if (!data || !data.id) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const resolver = pendingListeners.get(data.id);
|
|
156
|
+
if (!resolver) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
resolver(data);
|
|
161
|
+
} finally {
|
|
162
|
+
pendingListeners.delete(data.id);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return createProxy(ep, pendingListeners, [], target);
|
|
166
|
+
}
|
|
167
|
+
function throwIfProxyReleased(isReleased) {
|
|
168
|
+
if (isReleased) {
|
|
169
|
+
throw new Error("Proxy has been released and is not useable");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function releaseEndpoint(ep) {
|
|
173
|
+
return requestResponseMessage(ep, /* @__PURE__ */ new Map(), {
|
|
174
|
+
type: "RELEASE"
|
|
175
|
+
}).then(() => {
|
|
176
|
+
closeEndPoint(ep);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const proxyCounter = /* @__PURE__ */ new WeakMap();
|
|
180
|
+
const proxyFinalizers = "FinalizationRegistry" in globalThis && new FinalizationRegistry((ep) => {
|
|
181
|
+
const newCount = (proxyCounter.get(ep) || 0) - 1;
|
|
182
|
+
proxyCounter.set(ep, newCount);
|
|
183
|
+
if (newCount === 0) {
|
|
184
|
+
releaseEndpoint(ep);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
function registerProxy(proxy2, ep) {
|
|
188
|
+
const newCount = (proxyCounter.get(ep) || 0) + 1;
|
|
189
|
+
proxyCounter.set(ep, newCount);
|
|
190
|
+
if (proxyFinalizers) {
|
|
191
|
+
proxyFinalizers.register(proxy2, ep, proxy2);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function unregisterProxy(proxy2) {
|
|
195
|
+
if (proxyFinalizers) {
|
|
196
|
+
proxyFinalizers.unregister(proxy2);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function createProxy(ep, pendingListeners, path = [], target = function() {
|
|
200
|
+
}) {
|
|
201
|
+
let isProxyReleased = false;
|
|
202
|
+
const proxy2 = new Proxy(target, {
|
|
203
|
+
get(_target, prop) {
|
|
204
|
+
throwIfProxyReleased(isProxyReleased);
|
|
205
|
+
if (prop === releaseProxy) {
|
|
206
|
+
return () => {
|
|
207
|
+
unregisterProxy(proxy2);
|
|
208
|
+
releaseEndpoint(ep);
|
|
209
|
+
pendingListeners.clear();
|
|
210
|
+
isProxyReleased = true;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (prop === "then") {
|
|
214
|
+
if (path.length === 0) {
|
|
215
|
+
return { then: () => proxy2 };
|
|
216
|
+
}
|
|
217
|
+
const r = requestResponseMessage(ep, pendingListeners, {
|
|
218
|
+
type: "GET",
|
|
219
|
+
path: path.map((p) => p.toString())
|
|
220
|
+
}).then(fromWireValue);
|
|
221
|
+
return r.then.bind(r);
|
|
222
|
+
}
|
|
223
|
+
return createProxy(ep, pendingListeners, [...path, prop]);
|
|
224
|
+
},
|
|
225
|
+
set(_target, prop, rawValue) {
|
|
226
|
+
throwIfProxyReleased(isProxyReleased);
|
|
227
|
+
const [value, transferables] = toWireValue(rawValue);
|
|
228
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
229
|
+
type: "SET",
|
|
230
|
+
path: [...path, prop].map((p) => p.toString()),
|
|
231
|
+
value
|
|
232
|
+
}, transferables).then(fromWireValue);
|
|
233
|
+
},
|
|
234
|
+
apply(_target, _thisArg, rawArgumentList) {
|
|
235
|
+
throwIfProxyReleased(isProxyReleased);
|
|
236
|
+
const last = path[path.length - 1];
|
|
237
|
+
if (last === createEndpoint) {
|
|
238
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
239
|
+
type: "ENDPOINT"
|
|
240
|
+
}).then(fromWireValue);
|
|
241
|
+
}
|
|
242
|
+
if (last === "bind") {
|
|
243
|
+
return createProxy(ep, pendingListeners, path.slice(0, -1));
|
|
244
|
+
}
|
|
245
|
+
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
246
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
247
|
+
type: "APPLY",
|
|
248
|
+
path: path.map((p) => p.toString()),
|
|
249
|
+
argumentList
|
|
250
|
+
}, transferables).then(fromWireValue);
|
|
251
|
+
},
|
|
252
|
+
construct(_target, rawArgumentList) {
|
|
253
|
+
throwIfProxyReleased(isProxyReleased);
|
|
254
|
+
const [argumentList, transferables] = processArguments(rawArgumentList);
|
|
255
|
+
return requestResponseMessage(ep, pendingListeners, {
|
|
256
|
+
type: "CONSTRUCT",
|
|
257
|
+
path: path.map((p) => p.toString()),
|
|
258
|
+
argumentList
|
|
259
|
+
}, transferables).then(fromWireValue);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
registerProxy(proxy2, ep);
|
|
263
|
+
return proxy2;
|
|
264
|
+
}
|
|
265
|
+
function myFlat(arr) {
|
|
266
|
+
return Array.prototype.concat.apply([], arr);
|
|
267
|
+
}
|
|
268
|
+
function processArguments(argumentList) {
|
|
269
|
+
const processed = argumentList.map(toWireValue);
|
|
270
|
+
return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
|
|
271
|
+
}
|
|
272
|
+
const transferCache = /* @__PURE__ */ new WeakMap();
|
|
273
|
+
function transfer(obj2, transfers) {
|
|
274
|
+
transferCache.set(obj2, transfers);
|
|
275
|
+
return obj2;
|
|
276
|
+
}
|
|
277
|
+
function proxy(obj2) {
|
|
278
|
+
return Object.assign(obj2, { [proxyMarker]: true });
|
|
279
|
+
}
|
|
280
|
+
function toWireValue(value) {
|
|
281
|
+
for (const [name, handler] of transferHandlers) {
|
|
282
|
+
if (handler.canHandle(value)) {
|
|
283
|
+
const [serializedValue, transferables] = handler.serialize(value);
|
|
284
|
+
return [
|
|
285
|
+
{
|
|
286
|
+
type: "HANDLER",
|
|
287
|
+
name,
|
|
288
|
+
value: serializedValue
|
|
289
|
+
},
|
|
290
|
+
transferables
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return [
|
|
295
|
+
{
|
|
296
|
+
type: "RAW",
|
|
297
|
+
value
|
|
298
|
+
},
|
|
299
|
+
transferCache.get(value) || []
|
|
300
|
+
];
|
|
301
|
+
}
|
|
302
|
+
function fromWireValue(value) {
|
|
303
|
+
switch (value.type) {
|
|
304
|
+
case "HANDLER":
|
|
305
|
+
return transferHandlers.get(value.name).deserialize(value.value);
|
|
306
|
+
case "RAW":
|
|
307
|
+
return value.value;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function requestResponseMessage(ep, pendingListeners, msg, transfers) {
|
|
311
|
+
return new Promise((resolve) => {
|
|
312
|
+
const id = generateUUID();
|
|
313
|
+
pendingListeners.set(id, resolve);
|
|
314
|
+
if (ep.start) {
|
|
315
|
+
ep.start();
|
|
316
|
+
}
|
|
317
|
+
ep.postMessage(Object.assign({ id }, msg), transfers);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function generateUUID() {
|
|
321
|
+
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
322
|
+
}
|
|
323
|
+
const BLOCK_SIZE = 512;
|
|
324
|
+
const FILE_TYPE = {
|
|
325
|
+
GZIP: "GZIP",
|
|
326
|
+
GZIP2: "GZIP2",
|
|
327
|
+
TAR: "TAR",
|
|
328
|
+
PLAIN: "PLAIN"
|
|
329
|
+
};
|
|
330
|
+
async function parseTar(data) {
|
|
331
|
+
let buffer = (
|
|
332
|
+
/** @type {Uint8Array} */
|
|
333
|
+
data.buffer || /** @type {ArrayBuffer} */
|
|
334
|
+
data
|
|
335
|
+
);
|
|
336
|
+
const ftype = checkFileType(buffer);
|
|
337
|
+
if (ftype != FILE_TYPE.GZIP && ftype != FILE_TYPE.TAR) {
|
|
338
|
+
throw new Error("The file format should be tar.gz or tar");
|
|
339
|
+
}
|
|
340
|
+
if (ftype == FILE_TYPE.GZIP) {
|
|
341
|
+
const stream = new ReadableStream({
|
|
342
|
+
start(controller) {
|
|
343
|
+
controller.enqueue(new Uint8Array(data));
|
|
344
|
+
controller.close();
|
|
345
|
+
}
|
|
346
|
+
}).pipeThrough(new DecompressionStream("gzip"));
|
|
347
|
+
buffer = await new Response(stream).arrayBuffer();
|
|
348
|
+
}
|
|
349
|
+
const files = [];
|
|
350
|
+
let offset = 0;
|
|
351
|
+
while (offset < buffer.byteLength - BLOCK_SIZE) {
|
|
352
|
+
let name = readString(buffer, offset, 100);
|
|
353
|
+
if (name.length === 0) {
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
const prefix = readString(buffer, offset + 345, 155);
|
|
357
|
+
if (prefix) {
|
|
358
|
+
name = `${prefix}${name}`;
|
|
359
|
+
}
|
|
360
|
+
const mode = readString(buffer, offset + 100, 8);
|
|
361
|
+
const uid = Number.parseInt(readString(buffer, offset + 108, 8));
|
|
362
|
+
const gid = Number.parseInt(readString(buffer, offset + 116, 8));
|
|
363
|
+
const size = readNumber(buffer, offset + 124, 12);
|
|
364
|
+
const mtime = readNumber(buffer, offset + 136, 12);
|
|
365
|
+
const _type = readNumber(buffer, offset + 156, 1);
|
|
366
|
+
const type = _type === 0 ? "file" : _type === 5 ? "directory" : _type;
|
|
367
|
+
const user = readString(buffer, offset + 265, 32);
|
|
368
|
+
const group = readString(buffer, offset + 297, 32);
|
|
369
|
+
const fileStart = offset + BLOCK_SIZE;
|
|
370
|
+
const data2 = new Uint8Array(buffer, fileStart, size);
|
|
371
|
+
files.push({
|
|
372
|
+
name,
|
|
373
|
+
type,
|
|
374
|
+
size,
|
|
375
|
+
data: data2,
|
|
376
|
+
get text() {
|
|
377
|
+
return new TextDecoder().decode(this.data);
|
|
378
|
+
},
|
|
379
|
+
attrs: {
|
|
380
|
+
mode,
|
|
381
|
+
uid,
|
|
382
|
+
gid,
|
|
383
|
+
mtime,
|
|
384
|
+
user,
|
|
385
|
+
group
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
offset += 512 + 512 * Math.trunc(size / 512);
|
|
389
|
+
if (size % 512) {
|
|
390
|
+
offset += 512;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return files;
|
|
394
|
+
}
|
|
395
|
+
function checkFileType(buffer) {
|
|
396
|
+
let bytes = readBytes(buffer, 0, 2);
|
|
397
|
+
if (bufferToHex(bytes) === "1f8b") {
|
|
398
|
+
return FILE_TYPE.GZIP;
|
|
399
|
+
}
|
|
400
|
+
bytes = readBytes(buffer, 0, 5);
|
|
401
|
+
if (bufferToHex(bytes) === "425a683931") {
|
|
402
|
+
return FILE_TYPE.GZIP2;
|
|
403
|
+
}
|
|
404
|
+
bytes = readBytes(buffer, 257, 5);
|
|
405
|
+
if (bufferToHex(bytes) === "7573746172") {
|
|
406
|
+
return FILE_TYPE.TAR;
|
|
407
|
+
}
|
|
408
|
+
return FILE_TYPE.PLAIN;
|
|
409
|
+
}
|
|
410
|
+
function readString(buffer, offset, size) {
|
|
411
|
+
const view = new Uint8Array(buffer, offset, size);
|
|
412
|
+
const i = view.indexOf(0);
|
|
413
|
+
const td = new TextDecoder();
|
|
414
|
+
return td.decode(view.slice(0, i));
|
|
415
|
+
}
|
|
416
|
+
function readNumber(buffer, offset, size) {
|
|
417
|
+
const view = new Uint8Array(buffer, offset, size);
|
|
418
|
+
let str = "";
|
|
419
|
+
for (let i = 0; i < size; i++) {
|
|
420
|
+
str += String.fromCodePoint(view[i]);
|
|
421
|
+
}
|
|
422
|
+
return Number.parseInt(str, 8);
|
|
423
|
+
}
|
|
424
|
+
function readBytes(buffer, start, length) {
|
|
425
|
+
return buffer.slice(start, start + length);
|
|
426
|
+
}
|
|
427
|
+
function bufferToHex(buffer) {
|
|
428
|
+
const uint8Array = new Uint8Array(buffer);
|
|
429
|
+
let hexString = "";
|
|
430
|
+
for (let i = 0; i < uint8Array.length; i++) {
|
|
431
|
+
hexString += uint8Array[i].toString(16).padStart(2, "0");
|
|
432
|
+
}
|
|
433
|
+
return hexString;
|
|
434
|
+
}
|
|
435
|
+
function assert(message, test) {
|
|
436
|
+
if (!test) {
|
|
437
|
+
throw new Error(message);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const secretKey = "__repl-sdk__compiler__";
|
|
441
|
+
const secret = Symbol.for(secretKey);
|
|
442
|
+
function getGlobal() {
|
|
443
|
+
const global = (
|
|
444
|
+
/** @type {ExtendedWindow} */
|
|
445
|
+
globalThis
|
|
446
|
+
);
|
|
447
|
+
return global;
|
|
448
|
+
}
|
|
449
|
+
assert(
|
|
450
|
+
`There is already an instance of repl-sdk, and there can only be one. Make sure that your dependency graph is correct.`,
|
|
451
|
+
!getGlobal()[secret]
|
|
452
|
+
);
|
|
453
|
+
class Caches {
|
|
454
|
+
clear() {
|
|
455
|
+
delete getGlobal()[secret];
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Cache of resolved modulePaths to their module "value"
|
|
459
|
+
*
|
|
460
|
+
* @type {{ [modulePath: string]: unknown }}
|
|
461
|
+
*/
|
|
462
|
+
get resolves() {
|
|
463
|
+
this.#root.resolves ||= {};
|
|
464
|
+
return this.#root.resolves;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Cache of untarred tarballs
|
|
468
|
+
*
|
|
469
|
+
* @type {Map<string, import('./types.ts').UntarredPackage>}
|
|
470
|
+
*/
|
|
471
|
+
get tarballs() {
|
|
472
|
+
this.#root.tarballs ||= /* @__PURE__ */ new Map();
|
|
473
|
+
return this.#root.tarballs;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Cache of request resolutions
|
|
477
|
+
*
|
|
478
|
+
* @type {Map<string, ResolveIdValue>}
|
|
479
|
+
*/
|
|
480
|
+
get resolveId() {
|
|
481
|
+
this.#root.resolveId ||= /* @__PURE__ */ new Map();
|
|
482
|
+
return this.#root.resolveId;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Cache of request Key to file content string
|
|
486
|
+
*
|
|
487
|
+
* @type {Map<string, { code: string, ext: string }>}
|
|
488
|
+
*/
|
|
489
|
+
get fileCache() {
|
|
490
|
+
this.#root.fileCache ||= /* @__PURE__ */ new Map();
|
|
491
|
+
return this.#root.fileCache;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* For any key, store a promise for resolving later
|
|
495
|
+
*
|
|
496
|
+
* @type {Map<string, Promise<unknown>>}
|
|
497
|
+
*/
|
|
498
|
+
get promiseCache() {
|
|
499
|
+
this.#root.promiseCache ||= /* @__PURE__ */ new Map();
|
|
500
|
+
return this.#root.promiseCache;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* @template Return
|
|
504
|
+
* @type {(key: string, callback: () => Promise<any>) => Promise<any>}
|
|
505
|
+
*/
|
|
506
|
+
cachedPromise(key, callback) {
|
|
507
|
+
const existing = this.promiseCache.get(key);
|
|
508
|
+
if (existing) {
|
|
509
|
+
return (
|
|
510
|
+
/** @type {Promise<Return>} */
|
|
511
|
+
existing
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
const promise = callback();
|
|
515
|
+
this.promiseCache.set(key, promise);
|
|
516
|
+
return promise;
|
|
517
|
+
}
|
|
518
|
+
get requestCache() {
|
|
519
|
+
this.#root.requestCache ||= /* @__PURE__ */ new Map();
|
|
520
|
+
return this.#root.requestCache;
|
|
521
|
+
}
|
|
522
|
+
get #root() {
|
|
523
|
+
const global = getGlobal();
|
|
524
|
+
global[secret] ||= {};
|
|
525
|
+
global[secret].caches ||= this;
|
|
526
|
+
return global[secret];
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
const cache = new Caches();
|
|
530
|
+
const packageNameRegex = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
531
|
+
const npmInfoCache = /* @__PURE__ */ new Map();
|
|
532
|
+
async function getNPMInfo(name, version) {
|
|
533
|
+
const key = `${name}@${version}`;
|
|
534
|
+
assert(`Must pass valid npm-compatible package name`, packageNameRegex.test(name));
|
|
535
|
+
const existing = npmInfoCache.get(key);
|
|
536
|
+
if (existing) {
|
|
537
|
+
return existing;
|
|
538
|
+
}
|
|
539
|
+
return cache.cachedPromise(`getNPMInfo:${key}`, async () => {
|
|
540
|
+
assert(`Cannot get data from NPM without specifying the name of the package`, name);
|
|
541
|
+
assert(`Version is required. It may be 'latest'`, version);
|
|
542
|
+
const response = await fetch(`https://registry.npmjs.org/${name}`);
|
|
543
|
+
const json = await response.json();
|
|
544
|
+
npmInfoCache.set(key, json);
|
|
545
|
+
return json;
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
async function getTarUrl(npmInfo, requestedVersion) {
|
|
549
|
+
const json = npmInfo;
|
|
550
|
+
if (json.error) {
|
|
551
|
+
throw new Error(json.error);
|
|
552
|
+
}
|
|
553
|
+
const tag = requestedVersion in json["dist-tags"] ? json["dist-tags"][requestedVersion] : requestedVersion ?? json["dist-tags"].latest;
|
|
554
|
+
const requested = json.versions[tag];
|
|
555
|
+
return requested.dist.tarball;
|
|
556
|
+
}
|
|
557
|
+
const obj = { getTar };
|
|
558
|
+
expose(obj);
|
|
559
|
+
async function getTar(name, requestedVersion) {
|
|
560
|
+
const key = `${name}@${requestedVersion}`;
|
|
561
|
+
const untarred = cache.tarballs.get(key);
|
|
562
|
+
if (untarred) {
|
|
563
|
+
return untarred;
|
|
564
|
+
}
|
|
565
|
+
const contents = await cache.cachedPromise(`getTar:${key}`, async () => {
|
|
566
|
+
const json = await getNPMInfo(name, requestedVersion);
|
|
567
|
+
const tgzUrl = await getTarUrl(json, requestedVersion);
|
|
568
|
+
const response = await fetch(tgzUrl, {
|
|
569
|
+
headers: {
|
|
570
|
+
ACCEPT: "application/octet-stream"
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
return await untar(await response.arrayBuffer());
|
|
574
|
+
});
|
|
575
|
+
const manifest = JSON.parse(contents["package.json"].text);
|
|
576
|
+
const info = (
|
|
577
|
+
/** @type {import('./types.ts').UntarredPackage}*/
|
|
578
|
+
{ manifest, contents }
|
|
579
|
+
);
|
|
580
|
+
cache.tarballs.set(key, info);
|
|
581
|
+
return info;
|
|
582
|
+
}
|
|
583
|
+
async function untar(arrayBuffer) {
|
|
584
|
+
const contents = {};
|
|
585
|
+
for (const file of await parseTar(arrayBuffer)) {
|
|
586
|
+
if (file.type === "file") {
|
|
587
|
+
contents[file.name.slice(8)] = file;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return contents;
|
|
591
|
+
}
|
|
592
|
+
})();
|
|
593
|
+
//# sourceMappingURL=tar-worker-CxTcoQcr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar-worker-CxTcoQcr.js","sources":["../../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs","../../../node_modules/.pnpm/tarparser@0.0.5/node_modules/tarparser/lib/index.js","../src/utils.js","../src/cache.js","../../../node_modules/.pnpm/package-name-regex@4.0.3/node_modules/package-name-regex/dist/index.js","../src/npm.js","../src/tar-worker.js"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst proxyMarker = Symbol(\"Comlink.proxy\");\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\nconst finalizer = Symbol(\"Comlink.finalizer\");\nconst throwMarker = Symbol(\"Comlink.thrown\");\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n};\n/**\n * Allows customizing the serialization of certain values.\n */\nconst transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n]);\nfunction isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n}\nfunction expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n}\nfunction isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n}\nfunction closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n}\nfunction wrap(ep, target) {\n const pendingListeners = new Map();\n ep.addEventListener(\"message\", function handleMessage(ev) {\n const { data } = ev;\n if (!data || !data.id) {\n return;\n }\n const resolver = pendingListeners.get(data.id);\n if (!resolver) {\n return;\n }\n try {\n resolver(data);\n }\n finally {\n pendingListeners.delete(data.id);\n }\n });\n return createProxy(ep, pendingListeners, [], target);\n}\nfunction throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\nfunction releaseEndpoint(ep) {\n return requestResponseMessage(ep, new Map(), {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n}\nconst proxyCounter = new WeakMap();\nconst proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\nfunction registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n}\nfunction unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n}\nfunction createProxy(ep, pendingListeners, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n pendingListeners.clear();\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, pendingListeners, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, pendingListeners, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, pendingListeners, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, pendingListeners, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n}\nfunction myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n}\nfunction processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\nconst transferCache = new WeakMap();\nfunction transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n}\nfunction proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n}\nfunction windowEndpoint(w, context = globalThis, targetOrigin = \"*\") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\nfunction toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\nfunction fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n}\nfunction requestResponseMessage(ep, pendingListeners, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n pendingListeners.set(id, resolve);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n}\nfunction generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n}\n\nexport { createEndpoint, expose, finalizer, proxy, proxyMarker, releaseProxy, transfer, transferHandlers, windowEndpoint, wrap };\n//# sourceMappingURL=comlink.mjs.map\n","const BLOCK_SIZE = 512;\nconst FILE_TYPE = {\n\tGZIP: \"GZIP\",\n\tGZIP2: \"GZIP2\",\n\tTAR: \"TAR\",\n\tPLAIN: \"PLAIN\",\n};\n\n/**\n * @typedef FileDescription\n * @property {string} name - The name of the file.\n * @property {\"file\"|\"directory\"|number} type - The type of the file, either \"file\" or \"directory\".\n * @property {number} size - The size of the file in bytes.\n * @property {Uint8Array} data - The binary data of the file content.\n * @property {string} text - A getter to decode and return the file content as a UTF-8 string.\n * @property {FileAttrs} attrs - file attributes\n */\n\n/**\n * @typedef FileAttrs\n * @property {string} mode - The file permissions in octal format.\n * @property {number} uid - User ID of the file owner.\n * @property {number} gid - Group ID of the file owner.\n * @property {number} mtime - Last modification time in Unix time format.\n * @property {string} user - The username of the file owner.\n * @property {string} group - The group name of the file owner.\n */\n\n/**\n * Parses a tar file from binary data and returns an array of FileDescription objects.\n * @param {ArrayBuffer|Uint8Array} data - The binary data of the tar file.\n * @returns {Promise<FileDescription[]>} - An array of FileDescription objects representing the parsed files in the tar archive.\n */\nexport async function parseTar(data) {\n\tlet buffer = /** @type {Uint8Array} */ (data).buffer || /** @type {ArrayBuffer} */ (data);\n\n\tconst ftype = checkFileType(buffer);\n\tif (ftype != FILE_TYPE.GZIP && ftype != FILE_TYPE.TAR) {\n\t\tthrow new Error(\"The file format should be tar.gz or tar\");\n\t\treturn;\n\t}\n\n\tif (ftype == FILE_TYPE.GZIP) {\n\t\t// if the file is gzip we proceed to decompress the file and set that as the\n\t\t// new buffer to be process\n\t\tconst stream = new ReadableStream({\n\t\t\tstart(controller) {\n\t\t\t\tcontroller.enqueue(new Uint8Array(data));\n\t\t\t\tcontroller.close();\n\t\t\t},\n\t\t}).pipeThrough(new DecompressionStream(\"gzip\"));\n\n\t\tbuffer = await new Response(stream).arrayBuffer();\n\t\t// TODO: we should again check the buffer type to make sure is a tar inside the gzip\n\t}\n\n\t/** @type {FileDescription[]} */\n\tconst files = [];\n\tlet offset = 0;\n\n\t// TAR files consist of 512-byte blocks. Each file is preceded by a header block\n\t// followed by data blocks. The archive ends with two consecutive null blocks.\n\twhile (offset < buffer.byteLength - BLOCK_SIZE) {\n\t\t// File name (100 bytes, null-terminated string)\n\t\t// In POSIX ustar format, this field stores the file name for short names\n\t\t// or a prefix for long names\n\t\tlet name = readString(buffer, offset, 100);\n\t\tif (name.length === 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// In case is a long name we need to added to the name\n\t\tconst prefix = readString(buffer, offset + 345, 155);\n\t\tif (prefix) {\n\t\t\tname = `${prefix}${name}`;\n\t\t}\n\n\t\t// File mode (8 bytes, octal number stored as ASCII)\n\t\t// This represents the file permissions in octal format\n\t\tconst mode = readString(buffer, offset + 100, 8);\n\n\t\t// File uid (8 bytes, octal number stored as ASCII)\n\t\t// User ID of the file owner\n\t\tconst uid = Number.parseInt(readString(buffer, offset + 108, 8));\n\n\t\t// File gid (8 bytes, octal number stored as ASCII)\n\t\t// Group ID of the file owner\n\t\tconst gid = Number.parseInt(readString(buffer, offset + 116, 8));\n\n\t\t// File size (12 bytes, octal number stored as ASCII)\n\t\t// Size of the file in bytes\n\t\tconst size = readNumber(buffer, offset + 124, 12);\n\n\t\t// File mtime (12 bytes, octal number stored as ASCII)\n\t\t// Last modification time in Unix time format\n\t\tconst mtime = readNumber(buffer, offset + 136, 12);\n\n\t\t// File type flag (1 byte)\n\t\t// 0 or '\\0': normal file\n\t\t// 5: directory\n\t\t// Other values represent special file types (e.g., symbolic links)\n\t\tconst _type = readNumber(buffer, offset + 156, 1);\n\t\tconst type = _type === 0 ? \"file\" : _type === 5 ? \"directory\" : _type;\n\n\t\t// File owner username (32 bytes, null-terminated string)\n\t\t// Present in POSIX ustar format\n\t\tconst user = readString(buffer, offset + 265, 32);\n\n\t\t// File owner group name (32 bytes, null-terminated string)\n\t\t// Present in POSIX ustar format\n\t\tconst group = readString(buffer, offset + 297, 32);\n\n\t\t// Where the file content start in order to read the file data\n\t\tconst fileStart = offset + BLOCK_SIZE;\n\n\t\t// File data\n\t\t// For regular files, this contains the file contents\n\t\t// For directories, this is empty (size should be 0)\n\t\tconst data = new Uint8Array(buffer, fileStart, size);\n\n\t\tfiles.push({\n\t\t\tname,\n\t\t\ttype,\n\t\t\tsize,\n\t\t\tdata,\n\t\t\tget text() {\n\t\t\t\treturn new TextDecoder().decode(this.data);\n\t\t\t},\n\t\t\tattrs: {\n\t\t\t\tmode,\n\t\t\t\tuid,\n\t\t\t\tgid,\n\t\t\t\tmtime,\n\t\t\t\tuser,\n\t\t\t\tgroup,\n\t\t\t},\n\t\t});\n\n\t\t// Move to the next file\n\t\t// The offset is increased by:\n\t\t// 1. 512 bytes for the header\n\t\t// 2. The file size rounded up to the nearest 512 bytes\n\t\toffset += 512 + 512 * Math.trunc(size / 512);\n\t\tif (size % 512) {\n\t\t\toffset += 512;\n\t\t}\n\t}\n\n\treturn files;\n}\n\n/**\n * checkFileType function to check file type using a buffer\n * @param {ArrayBuffer|Uint8Array} buffer - The binary data of the file.\n * @returns {string} - The type of the file as defined in FILE_TYPE object.\n */\nfunction checkFileType(buffer) {\n\t// Read the first 2 bytes (for gzip check)\n\tlet bytes = readBytes(buffer, 0, 2);\n\tif (bufferToHex(bytes) === \"1f8b\") {\n\t\treturn FILE_TYPE.GZIP;\n\t}\n\n\t// Read the first 5 bytes (for bzip2 check)\n\tbytes = readBytes(buffer, 0, 5);\n\tif (bufferToHex(bytes) === \"425a683931\") {\n\t\treturn FILE_TYPE.GZIP2;\n\t}\n\n\t// Read 5 bytes starting at offset 257 (for tar check)\n\tbytes = readBytes(buffer, 257, 5);\n\tif (bufferToHex(bytes) === \"7573746172\") {\n\t\treturn FILE_TYPE.TAR;\n\t}\n\n\treturn FILE_TYPE.PLAIN;\n}\n\n/**\n * Reads a null-terminated string from a buffer at a specified offset and size.\n * @param {ArrayBuffer|Uint8Array} buffer - The binary data of the buffer.\n * @param {number} offset - The starting offset in the buffer.\n * @param {number} size - The number of bytes to read.\n * @returns {string} - The string read from the buffer.\n */\nfunction readString(buffer, offset, size) {\n\tconst view = new Uint8Array(buffer, offset, size);\n\tconst i = view.indexOf(0);\n\tconst td = new TextDecoder();\n\treturn td.decode(view.slice(0, i));\n}\n\n/**\n * Reads an 8-bit number from a buffer at a specified offset and size.\n * @param {ArrayBuffer|Uint8Array} buffer - The binary data of the buffer.\n * @param {number} offset - The starting offset in the buffer.\n * @param {number} size - The number of bytes to read (must be 12 for mtime).\n * @returns {number} - The numeric value read from the buffer.\n */\nfunction readNumber(buffer, offset, size) {\n\tconst view = new Uint8Array(buffer, offset, size);\n\tlet str = \"\";\n\tfor (let i = 0; i < size; i++) {\n\t\tstr += String.fromCodePoint(view[i]);\n\t}\n\treturn Number.parseInt(str, 8);\n}\n\n/**\n * Reads specific bytes from a buffer.\n * @param {ArrayBuffer|Uint8Array} buffer - The binary data of the buffer.\n * @param {number} start - The starting offset in the buffer.\n * @param {number} length - The number of bytes to read.\n * @returns {ArrayBuffer|Uint8Array} - A view into the Buffer containing the specified bytes.\n */\nfunction readBytes(buffer, start, length) {\n\treturn buffer.slice(start, start + length);\n}\n\n/**\n * Converts a buffer to a hex string representation.\n * @param {ArrayBuffer|Uint8Array} buffer - The binary data buffer.\n * @returns {string} - A hexadecimal string representing the buffer contents.\n */\nfunction bufferToHex(buffer) {\n\tconst uint8Array = new Uint8Array(buffer);\n\tlet hexString = \"\";\n\n\tfor (let i = 0; i < uint8Array.length; i++) {\n\t\thexString += uint8Array[i].toString(16).padStart(2, \"0\");\n\t}\n\n\treturn hexString;\n}\n","/**\n * @param {string} message\n * @param {unknown} test\n * @returns {asserts test}\n */\nexport function assert(message, test) {\n if (!test) {\n throw new Error(message);\n }\n}\n\nlet i = 0;\n\nexport function nextId() {\n i += 1;\n\n return `repl_${i}`;\n}\n\nexport const fakeDomain = 'repl.sdk';\nexport const tgzPrefix = 'file:///tgz.repl.sdk/';\nexport const unzippedPrefix = 'file:///tgz.repl.sdk/unzipped';\n\n/**\n * @param {string} url\n */\nexport function prefix_tgz(url) {\n return `${tgzPrefix}${url}`;\n}\n\n/**\n * @param {unknown} x\n * @returns {x is Record<string, unknown>}\n */\nexport function isRecord(x) {\n return typeof x === 'object' && x !== null && !Array.isArray(x);\n}\n","import { assert } from './utils.js';\n\nexport const secretKey = '__repl-sdk__compiler__';\n\n/**\n * @typedef {object} ResolveIdValue\n * @property {string} name\n * @property {string} version\n * @property {import('./types.ts').RequestAnswer} path\n *\n * @typedef {import('./request.js').Request} Request\n *\n * @typedef {typeof globalThis & { [secret]?: {\n * requestCache?: Map<string, Request>,\n * resolveId?: Map<string, ResolveIdValue>,\n * tarballs?: Map<string, import('./types.ts').UntarredPackage>,\n * resolves?: { [modulePath: string]: unknown },\n * promiseCache?: Map<string, Promise<unknown>>,\n * fileCache?: Map<string, { code: string, ext: string }>\n * caches?: Caches\n * } }} ExtendedWindow\n */\nconst secret = Symbol.for(secretKey);\n\nfunction getGlobal() {\n const global = /** @type {ExtendedWindow} */ (globalThis);\n\n return global;\n}\n\nassert(\n `There is already an instance of repl-sdk, and there can only be one. Make sure that your dependency graph is correct.`,\n !getGlobal()[secret]\n);\n\nclass Caches {\n clear() {\n delete getGlobal()[secret];\n }\n\n /**\n * Cache of resolved modulePaths to their module \"value\"\n *\n * @type {{ [modulePath: string]: unknown }}\n */\n get resolves() {\n this.#root.resolves ||= {};\n\n return this.#root.resolves;\n }\n\n /**\n * Cache of untarred tarballs\n *\n * @type {Map<string, import('./types.ts').UntarredPackage>}\n */\n get tarballs() {\n this.#root.tarballs ||= new Map();\n\n return this.#root.tarballs;\n }\n\n /**\n * Cache of request resolutions\n *\n * @type {Map<string, ResolveIdValue>}\n */\n get resolveId() {\n this.#root.resolveId ||= new Map();\n\n return this.#root.resolveId;\n }\n\n /**\n * Cache of request Key to file content string\n *\n * @type {Map<string, { code: string, ext: string }>}\n */\n get fileCache() {\n this.#root.fileCache ||= new Map();\n\n return this.#root.fileCache;\n }\n\n /**\n * For any key, store a promise for resolving later\n *\n * @type {Map<string, Promise<unknown>>}\n */\n get promiseCache() {\n this.#root.promiseCache ||= new Map();\n\n return this.#root.promiseCache;\n }\n\n /**\n * @template Return\n * @type {(key: string, callback: () => Promise<any>) => Promise<any>}\n */\n cachedPromise(key, callback) {\n const existing = this.promiseCache.get(key);\n\n if (existing) {\n return /** @type {Promise<Return>} */ (existing);\n }\n\n const promise = callback();\n\n this.promiseCache.set(key, promise);\n\n return promise;\n }\n\n get requestCache() {\n this.#root.requestCache ||= new Map();\n\n return this.#root.requestCache;\n }\n\n get #root() {\n const global = getGlobal();\n\n global[secret] ||= {};\n global[secret].caches ||= this;\n\n return global[secret];\n }\n}\n\nexport function deleteCache() {\n if (!getGlobal()?.[secret]) {\n return;\n }\n\n delete getGlobal()[secret];\n}\n\nexport const cache = new Caches();\n","export const packageNameRegex = /^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/;\nexport default packageNameRegex;","import packageNameRegex from 'package-name-regex';\n\nimport { cache } from './cache.js';\nimport { assert } from './utils.js';\n\n/**\n * @type {Map<string, unknown>} namp@version => manifest\n */\nconst npmInfoCache = new Map();\n\n/**\n * @param {string} name\n * @param {string} version\n */\nexport async function getNPMInfo(name, version) {\n const key = `${name}@${version}`;\n\n assert(`Must pass valid npm-compatible package name`, packageNameRegex.test(name));\n\n const existing = npmInfoCache.get(key);\n\n if (existing) {\n return existing;\n }\n\n return cache.cachedPromise(`getNPMInfo:${key}`, async () => {\n assert(`Cannot get data from NPM without specifying the name of the package`, name);\n assert(`Version is required. It may be 'latest'`, version);\n\n const response = await fetch(`https://registry.npmjs.org/${name}`);\n const json = await response.json();\n\n npmInfoCache.set(key, json);\n\n return json;\n });\n}\n\n/**\n * @param {any} npmInfo\n * @param {string} requestedVersion\n */\nexport async function getTarUrl(npmInfo, requestedVersion) {\n const json = npmInfo;\n\n if (json.error) {\n throw new Error(json.error);\n }\n\n const tag =\n requestedVersion in json['dist-tags']\n ? json['dist-tags'][requestedVersion]\n : (requestedVersion ?? json['dist-tags'].latest);\n\n const requested = json.versions[tag];\n\n return requested.dist.tarball;\n}\n","import { expose } from 'comlink';\nimport { parseTar } from 'tarparser';\n\nimport { cache } from './cache.js';\nimport { getNPMInfo, getTarUrl } from './npm.js';\n\nconst obj = { getTar };\n\nexpose(obj);\n\n/**\n * @param {string} name of the package\n * @param {string} requestedVersion version or tag to fetch the package at\n */\nasync function getTar(name, requestedVersion) {\n const key = `${name}@${requestedVersion}`;\n const untarred = cache.tarballs.get(key);\n\n if (untarred) {\n return untarred;\n }\n\n const contents = await cache.cachedPromise(`getTar:${key}`, async () => {\n const json = await getNPMInfo(name, requestedVersion);\n const tgzUrl = await getTarUrl(json, requestedVersion);\n\n const response = await fetch(tgzUrl, {\n headers: {\n ACCEPT: 'application/octet-stream',\n },\n });\n\n return await untar(await response.arrayBuffer());\n });\n\n const manifest = JSON.parse(contents['package.json'].text);\n\n const info = /** @type {import('./types.ts').UntarredPackage}*/ ({ manifest, contents });\n\n cache.tarballs.set(key, info);\n\n return info;\n}\n\n/**\n * @param {ArrayBuffer} arrayBuffer\n */\nasync function untar(arrayBuffer) {\n /**\n * @type {{ [name: string]: import('tarparser').FileDescription }}\n */\n const contents = {};\n\n for (const file of await parseTar(arrayBuffer)) {\n if (file.type === 'file') {\n contents[file.name.slice(8)] = file; // remove `package/` prefix\n }\n }\n\n return contents;\n}\n"],"names":["obj","returnValue","proxy","data"],"mappings":";;AAKA,QAAM,cAAc,OAAO,eAAe;AAC1C,QAAM,iBAAiB,OAAO,kBAAkB;AAChD,QAAM,eAAe,OAAO,sBAAsB;AAClD,QAAM,YAAY,OAAO,mBAAmB;AAC5C,QAAM,cAAc,OAAO,gBAAgB;AAC3C,QAAM,WAAW,CAAC,QAAS,OAAO,QAAQ,YAAY,QAAQ,QAAS,OAAO,QAAQ;AAItF,QAAM,uBAAuB;AAAA,IACzB,WAAW,CAAC,QAAQ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