@yowasp/clang 21.1.4-3 → 22.0.0-git20542-10

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/README.md CHANGED
@@ -3,7 +3,7 @@ YoWASP Clang/LLD package
3
3
 
4
4
  This package provides a complete [Clang/LLD][] toolchain built for [WebAssembly][] and targeting WebAssembly as well. See the [overview of the YoWASP project][yowasp] for details.
5
5
 
6
- At the moment, this package only offers an API allowing to run Clang and LLD in a virtual filesystem; no executables are provided.
6
+ At the moment, this package only offers an API allowing to run Clang and LLD in a virtual filesystem; no executables are provided. Note that if you are importing `.../gen/bundle.js` directly, you must use it as a module.
7
7
 
8
8
  [Clang/LLD]: https://llvm.org/
9
9
  [WebAssembly]: https://webassembly.org/
package/gen/bundle.js CHANGED
@@ -599,7 +599,7 @@ function parseTar(data, opts) {
599
599
  const files = [];
600
600
  let offset = 0;
601
601
  while (offset < buffer.byteLength - 512) {
602
- const name = _readString(buffer, offset, 100);
602
+ let name = _readString(buffer, offset, 100);
603
603
  if (name.length === 0) {
604
604
  break;
605
605
  }
@@ -613,6 +613,7 @@ function parseTar(data, opts) {
613
613
  const type = _type === TAR_TYPE_FILE ? "file" : _type === TAR_TYPE_DIR ? "directory" : _type;
614
614
  const user = _readString(buffer, offset + 265, 32);
615
615
  const group = _readString(buffer, offset + 297, 32);
616
+ name = _sanitizePath(name);
616
617
  const meta = {
617
618
  name,
618
619
  type,
@@ -647,6 +648,29 @@ function parseTar(data, opts) {
647
648
  }
648
649
  return files;
649
650
  }
651
+ function _sanitizePath(path) {
652
+ let normalized = path.replace(/\\/g, "/");
653
+ normalized = normalized.replace(/^[a-zA-Z]:\//, "");
654
+ normalized = normalized.replace(/^\/+/, "");
655
+ const hasLeadingDotSlash = normalized.startsWith("./");
656
+ const parts = normalized.split("/");
657
+ const resolved = [];
658
+ for (const part of parts) {
659
+ if (part === "..") {
660
+ resolved.pop();
661
+ } else if (part !== "." && part !== "") {
662
+ resolved.push(part);
663
+ }
664
+ }
665
+ let result = resolved.join("/");
666
+ if (hasLeadingDotSlash && !result.startsWith("./")) {
667
+ result = "./" + result;
668
+ }
669
+ if (path.endsWith("/") && !result.endsWith("/")) {
670
+ result += "/";
671
+ }
672
+ return result;
673
+ }
650
674
  function _readString(buffer, offset, size) {
651
675
  const view = new Uint8Array(buffer, offset, size);
652
676
  const i = view.indexOf(0);
@@ -696,7 +720,7 @@ var modules = async (fetch3) => ({
696
720
  var filesystem = async (fetch3) => ({
697
721
  "usr": await fetch3(new URL("./llvm-resources.tar", import.meta.url)).then((resp) => resp.arrayBuffer()).then(unpackTarFilesystem)
698
722
  });
699
- var totalSize = 102337718;
723
+ var totalSize = 105241285;
700
724
 
701
725
  // gen/llvm.js
702
726
  function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.instantiate) {
@@ -8034,7 +8058,7 @@ var commands = {
8034
8058
  "clang": subcommand(runClang, "clang"),
8035
8059
  "clang++": subcommand(runClang, "clang++")
8036
8060
  };
8037
- var version = "21.1.4-3";
8061
+ var version = "22.0.0-git20542-10";
8038
8062
  export {
8039
8063
  Exit,
8040
8064
  commands,
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yowasp/clang",
3
- "version": "21.1.4-3",
3
+ "version": "22.0.0-git20542-10",
4
4
  "description": "LLVM/Clang/LLD toolchain targeting WebAssembly",
5
5
  "author": "Catherine <whitequark@whitequark.org>",
6
6
  "license": "ISC",
@@ -32,7 +32,7 @@
32
32
  "scripts": {
33
33
  "transpile": "jco new ../llvm-build/bin/llvm --wasi-command --output llvm.wasm && jco transpile llvm.wasm --instantiation async --no-typescript --no-namespaced-exports --map 'wasi:io/*=runtime#io' --map 'wasi:cli/*=runtime#cli' --map 'wasi:clocks/*=runtime#*' --map 'wasi:filesystem/*=runtime#fs' --map 'wasi:random/*=runtime#random' --out-dir gen/",
34
34
  "pack": "yowasp-pack-resources gen/llvm-resources.js gen ../wasi-prefix/usr usr",
35
- "build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --define:VERSION=\\\"21.1.4-3\\\"",
35
+ "build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --define:VERSION=\\\"22.0.0-git20542-10\\\"",
36
36
  "all": "npm run transpile && npm run pack && npm run build"
37
37
  }
38
38
  }