Unverified Commit 82cc19f0 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

Merge pull request #322573 from dezren39/patch-2

wrangler: init at 3.62.0
parents 3607fb8f 876c65c4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4928,6 +4928,12 @@
    githubId = 579369;
    name = "Tuomas Tynkkynen";
  };
  dezren39 = {
    email = "drewrypope@gmail.com";
    github = "dezren39";
    githubId = 11225574;
    name = "Drewry Pope";
  };
  dfithian = {
    email = "daniel.m.fithian@gmail.com";
    name = "Daniel Fithian";
@@ -18072,6 +18078,12 @@
    githubId = 11613056;
    name = "Scott Dier";
  };
  seanrmurphy = {
    email = "sean@gopaddy.ch";
    github = "seanrmurphy";
    githubId = 540360;
    name = "Sean Murphy";
  };
  SeanZicari = {
    email = "sean.zicari@gmail.com";
    github = "SeanZicari";
+95 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  makeWrapper,
  nodejs,
  pnpm_9,
  autoPatchelfHook,
  llvmPackages,
  musl,
  xorg,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "wrangler";
  version = "3.62.0";

  src = fetchFromGitHub {
    owner = "cloudflare";
    repo = "workers-sdk";
    rev = "wrangler@${finalAttrs.version}";
    hash = "sha256-/4iIkvSn85fkRggmIha2kRlW0MEwvzy0ZAmIb8+LpZQ=";
  };

  pnpmDeps = pnpm_9.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "sha256-aTTaiGXm1WYwmy+ljUC9yO3qtvN20SA+24T83dWYrI0=";
  };

  buildInputs = [
    llvmPackages.libcxx
    llvmPackages.libunwind
    musl
    xorg.libX11
  ];

  nativeBuildInputs = [
    autoPatchelfHook
    makeWrapper
    nodejs
    pnpm_9.configHook
  ];

  # @cloudflare/vitest-pool-workers wanted to run a server as part of the build process
  # so I simply removed it
  postBuild = ''
    rm -fr packages/vitest-pool-workers
    NODE_ENV="production" pnpm --filter miniflare run build
    NODE_ENV="production" pnpm --filter wrangler run build
  '';

  # I'm sure this is suboptimal but it seems to work. Points:
  # - when build is run in the original repo, no specific executable seems to be generated; you run the resulting build with pnpm run start
  # - this means we need to add a dedicated script - perhaps it is possible to create this from the workers-sdk dir, but I don't know how to do this
  # - the build process builds a version of miniflare which is used by wrangler; for this reason, the miniflare package is copied also
  # - pnpm stores all content in the top-level node_modules directory, but it is linked to from a node_modules directory inside wrangler
  # - as they are linked via symlinks, the relative location of them on the filesystem should be maintained
  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin $out/lib $out/lib/packages/wrangler
    rm -rf node_modules/typescript node_modules/eslint node_modules/prettier node_modules/bin node_modules/.bin node_modules/**/bin node_modules/**/.bin
    cp -r node_modules $out/lib
    cp -r packages/miniflare $out/lib/packages
    cp -r packages/workers-tsconfig $out/lib/packages
    cp -r packages/wrangler/node_modules $out/lib/packages/wrangler
    cp -r packages/wrangler/templates $out/lib/packages/wrangler
    cp -r packages/wrangler/wrangler-dist $out/lib/packages/wrangler
    rm -rf $out/lib/**/bin $out/lib/**/.bin
    cp -r packages/wrangler/bin $out/lib/packages/wrangler
    NODE_PATH_ARRAY=( "$out/lib/node_modules" "$out/lib/packages/wrangler/node_modules" )
    makeWrapper ${lib.getExe nodejs} $out/bin/wrangler \
      --inherit-argv0 \
      --prefix-each NODE_PATH : "$${NODE_PATH_ARRAY[@]}" \
      --add-flags $out/lib/packages/wrangler/bin/wrangler.js
    runHook postInstall
  '';

  meta = {
    description = "Command-line interface for all things Cloudflare Workers";
    homepage = "https://github.com/cloudflare/workers-sdk#readme";
    license = with lib.licenses; [
      mit
      apsl20
    ];
    maintainers = with lib.maintainers; [
      seanrmurphy
      dezren39
    ];
    mainProgram = "wrangler";
    # cpp is required for building workerd.
    # workerd is used for some wrangler subcommands.
    # non-linux platforms may experience errors
    # on certain subcommands due to this issue.
    platforms = [ "x86_64-linux" ];
  };
})
+1 −0
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ mapAliases {
  vue-cli = self."@vue/cli"; # added 2023-08-18
  vue-language-server = self.vls; # added 2023-08-20
  inherit (pkgs) web-ext; # added 2023-08-20
  inherit (pkgs) wrangler; # added 2024-07-01
  inherit (pkgs) write-good; # added 2023-08-20
  inherit (pkgs) yaml-language-server; # added 2023-09-05
  inherit (pkgs) yo; # added 2023-08-20
+0 −1
Original line number Diff line number Diff line
@@ -259,7 +259,6 @@
, "webpack-dev-server"
, "copy-webpack-plugin"
, "webtorrent-cli"
, "wrangler"
, "wring"
, "@yaegassy/coc-nginx"
, "yalc"
+0 −132
Original line number Diff line number Diff line
@@ -57393,15 +57393,6 @@ let
        sha512 = "rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==";
      };
    };
    "workerd-1.20240610.1" = {
      name = "workerd";
      packageName = "workerd";
      version = "1.20240610.1";
      src = fetchurl {
        url = "https://registry.npmjs.org/workerd/-/workerd-1.20240610.1.tgz";
        sha512 = "Rtut5GrsODQMh6YU43b9WZ980Wd05Ov1/ds88pT/SoetmXFBvkBzdRfiHiATv+azmGX8KveE0i/Eqzk/yI01ug==";
      };
    };
    "workerpool-6.2.1" = {
      name = "workerpool";
      packageName = "workerpool";
@@ -92403,129 +92394,6 @@ in
    bypassCache = true;
    reconstructLock = true;
  };
  wrangler = nodeEnv.buildNodePackage {
    name = "wrangler";
    packageName = "wrangler";
    version = "3.60.3";
    src = fetchurl {
      url = "https://registry.npmjs.org/wrangler/-/wrangler-3.60.3.tgz";
      sha512 = "a6zn/KFnYaYp3nxJR/aP0TeaBvJDkrrfI89KoxUtx28H7zpya/5/VLu3CxQ3PRspEojJGF0s6f3/pddRy3F+BQ==";
    };
    dependencies = [
      sources."@cloudflare/kv-asset-handler-0.3.2"
      sources."@cloudflare/workers-types-4.20240605.0"
      sources."@cspotcode/source-map-support-0.8.1"
      sources."@esbuild-plugins/node-globals-polyfill-0.2.3"
      sources."@esbuild-plugins/node-modules-polyfill-0.2.2"
      sources."@esbuild/android-arm-0.17.19"
      sources."@esbuild/android-arm64-0.17.19"
      sources."@esbuild/android-x64-0.17.19"
      sources."@esbuild/darwin-arm64-0.17.19"
      sources."@esbuild/darwin-x64-0.17.19"
      sources."@esbuild/freebsd-arm64-0.17.19"
      sources."@esbuild/freebsd-x64-0.17.19"
      sources."@esbuild/linux-arm-0.17.19"
      sources."@esbuild/linux-arm64-0.17.19"
      sources."@esbuild/linux-ia32-0.17.19"
      sources."@esbuild/linux-loong64-0.17.19"
      sources."@esbuild/linux-mips64el-0.17.19"
      sources."@esbuild/linux-ppc64-0.17.19"
      sources."@esbuild/linux-riscv64-0.17.19"
      sources."@esbuild/linux-s390x-0.17.19"
      sources."@esbuild/linux-x64-0.17.19"
      sources."@esbuild/netbsd-x64-0.17.19"
      sources."@esbuild/openbsd-x64-0.17.19"
      sources."@esbuild/sunos-x64-0.17.19"
      sources."@esbuild/win32-arm64-0.17.19"
      sources."@esbuild/win32-ia32-0.17.19"
      sources."@esbuild/win32-x64-0.17.19"
      sources."@fastify/busboy-2.1.1"
      sources."@jridgewell/resolve-uri-3.1.2"
      sources."@jridgewell/sourcemap-codec-1.4.15"
      sources."@jridgewell/trace-mapping-0.3.9"
      sources."@types/node-20.14.2"
      sources."@types/node-forge-1.3.11"
      sources."acorn-8.12.0"
      sources."acorn-walk-8.3.3"
      sources."anymatch-3.1.3"
      sources."as-table-1.0.55"
      sources."binary-extensions-2.3.0"
      sources."blake3-wasm-2.1.5"
      sources."braces-3.0.3"
      sources."bufferutil-4.0.8"
      sources."capnp-ts-0.7.0"
      sources."chokidar-3.6.0"
      sources."consola-3.2.3"
      sources."cookie-0.5.0"
      sources."data-uri-to-buffer-2.0.2"
      sources."debug-4.3.5"
      sources."defu-6.1.4"
      sources."esbuild-0.17.19"
      sources."escape-string-regexp-4.0.0"
      sources."estree-walker-0.6.1"
      sources."exit-hook-2.2.1"
      sources."fill-range-7.1.1"
      sources."fsevents-2.3.3"
      sources."function-bind-1.1.2"
      sources."get-source-2.0.12"
      sources."glob-parent-5.1.2"
      sources."glob-to-regexp-0.4.1"
      sources."hasown-2.0.2"
      sources."is-binary-path-2.1.0"
      sources."is-core-module-2.13.1"
      sources."is-extglob-2.1.1"
      sources."is-glob-4.0.3"
      sources."is-number-7.0.0"
      sources."magic-string-0.25.9"
      sources."mime-3.0.0"
      sources."miniflare-3.20240610.0"
      sources."ms-2.1.2"
      sources."mustache-4.2.0"
      sources."nanoid-3.3.7"
      sources."node-fetch-native-1.6.4"
      sources."node-forge-1.3.1"
      sources."node-gyp-build-4.8.1"
      sources."normalize-path-3.0.0"
      sources."path-parse-1.0.7"
      sources."path-to-regexp-6.2.2"
      sources."pathe-1.1.2"
      sources."picomatch-2.3.1"
      sources."printable-characters-1.0.42"
      sources."readdirp-3.6.0"
      sources."resolve-1.22.8"
      sources."resolve.exports-2.0.2"
      sources."rollup-plugin-inject-3.0.2"
      sources."rollup-plugin-node-polyfills-0.2.1"
      sources."rollup-pluginutils-2.8.2"
      sources."selfsigned-2.4.1"
      sources."source-map-0.6.1"
      sources."sourcemap-codec-1.4.8"
      sources."stacktracey-2.1.8"
      sources."stoppable-1.1.0"
      sources."supports-preserve-symlinks-flag-1.0.0"
      sources."to-regex-range-5.0.1"
      sources."tslib-2.6.3"
      sources."ufo-1.5.3"
      sources."undici-5.28.4"
      sources."undici-types-5.26.5"
      sources."unenv-1.10.0-1717606461.a117952"
      sources."utf-8-validate-6.0.4"
      sources."workerd-1.20240610.1"
      sources."ws-8.17.0"
      sources."xxhash-wasm-1.0.2"
      sources."youch-3.3.3"
      sources."zod-3.23.8"
    ];
    buildInputs = globalBuildInputs;
    meta = {
      description = "Command-line interface for all things Cloudflare Workers";
      homepage = "https://github.com/cloudflare/workers-sdk#readme";
      license = "MIT OR Apache-2.0";
    };
    production = true;
    bypassCache = true;
    reconstructLock = true;
  };
  wring = nodeEnv.buildNodePackage {
    name = "wring";
    packageName = "wring";
Loading