Skip to content

Commit c038ce9

Browse files
authored
Merge pull request #135 from mlabs-haskell/bladyjoker/ctl-upgrade
Upgrading to CTL latest
2 parents 5ffaa1a + b884811 commit c038ce9

File tree

45 files changed

+6307
-2919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6307
-2919
lines changed

extras/flake-purescript.nix

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
pkgs: pursProjOpts:
22
let
3-
mkFlake = projectName: purs: {
4-
packages = {
5-
"purescript:${projectName}:src" = pkgs.stdenv.mkDerivation {
6-
name = projectName;
7-
inherit (pursProjOpts) src;
8-
phases = "installPhase";
9-
installPhase = "ln -s $src $out";
3+
mkFlake = projectName: purs:
4+
{
5+
packages = {
6+
"purescript:${projectName}:src" = pkgs.stdenv.mkDerivation {
7+
name = projectName;
8+
inherit (pursProjOpts) src;
9+
phases = "installPhase";
10+
installPhase = "ln -s $src $out";
11+
};
12+
"purescript:${projectName}:lib" = purs.compiled;
13+
"purescript:${projectName}:node-modules" = purs.nodeModules;
14+
"purescript:${projectName}:webpack-web" = purs.bundlePursProjectWebpack {
15+
main = "Test.Main";
16+
entrypoint = "app/index.js";
17+
bundledModuleName = "dist/output.js";
18+
};
19+
"purescript:${projectName}:esbuild-web" = purs.bundlePursProjectEsbuild {
20+
main = "Test.Main";
21+
browserRuntime = true;
22+
};
23+
"purescript:${projectName}:esbuild-nodejs" = purs.bundlePursProjectEsbuild {
24+
main = "Test.Main";
25+
browserRuntime = false;
26+
};
27+
28+
"purescript:${projectName}:docs" = purs.buildPursDocs { };
29+
"purescript:${projectName}:docs-search" = purs.buildSearchablePursDocs { };
1030
};
11-
"purescript:${projectName}:lib" = purs.compiled;
12-
"purescript:${projectName}:node-modules" = purs.nodeModules;
13-
"purescript:${projectName}:bundle" = purs.bundlePursProject { main = "Test.Main"; entrypoint = "app/index.js"; bundledModuleName = "dist/output.js"; };
14-
"purescript:${projectName}:docs" = purs.buildPursDocs { };
15-
"purescript:${projectName}:docs-search" = purs.buildSearchablePursDocs { };
16-
};
1731

18-
checks = {
19-
"purescript:${projectName}:check" = purs.runPursTest { };
20-
};
32+
checks = {
33+
"purescript:${projectName}:check" = purs.runPursTest { testMain = "Test.Main"; };
34+
};
2135

22-
devShell = purs.devShell;
23-
};
36+
devShell = purs.devShell;
37+
};
2438
in
2539
mkFlake pursProjOpts.projectName (pkgs.purescriptProject pursProjOpts)

flake.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
protobufs-nix.url = "github:mlabs-haskell/protobufs.nix";
99
mlabs-tooling.url = "github:mlabs-haskell/mlabs-tooling.nix";
1010
hci-effects.url = "github:hercules-ci/hercules-ci-effects";
11-
ctl.url = "github:plutonomicon/cardano-transaction-lib/bladyjoker/lambda-buffers-catalyst"; # path:/home/bladyjoker/Desktop/cardano-transaction-lib;
11+
ctl.url = "github:plutonomicon/cardano-transaction-lib?rev=fbf56b2965752ced05fd7f3a2d7ae6778e566df9";
1212
iohk-nix.url = "github:input-output-hk/iohk-nix";
1313
flake-parts.url = "github:hercules-ci/flake-parts";
1414
purifix.url = "github:purifix/purifix";

lambda-buffers-codegen/data/purescript-prelude-base.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"CodePoint"
4242
],
4343
"Prelude.Integer": [
44-
"bigints",
45-
"Data.BigInt",
44+
"js-bigints",
45+
"JS.BigInt",
4646
"BigInt"
4747
],
4848
"Prelude.Bool": [

lambda-buffers-codegen/src/LambdaBuffers/Codegen/Purescript/Print/LamVal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ caseInt :: Purs.QValName
3535
caseInt = normalValName "lbr-prelude" "LambdaBuffers.Runtime.Prelude" "caseInt"
3636

3737
fromInt :: Purs.QValName
38-
fromInt = normalValName "bigint" "Data.BigInt" "fromInt"
38+
fromInt = normalValName "js-bigints" "JS.BigInt" "fromInt"
3939

4040
printCtorCase :: MonadPrint m => PC.QTyName -> ((LV.Ctor, [LV.ValueE]) -> LV.ValueE) -> LV.Ctor -> m (Doc ann)
4141
printCtorCase (_, tyn) ctorCont ctor@(ctorN, fields) = do

runtimes/purescript/lbr-plutus/build.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _:
1414
withRuntime = false;
1515
packageLockOnly = true;
1616
packages = [
17-
pkgs.nodejs_16
17+
pkgs.nodejs-18_x
1818
pkgs.bashInteractive
1919
pkgs.fd
2020
] ++ config.settings.shell.tools;
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import * as esbuild from "esbuild";
2+
import { wasmLoader } from "esbuild-plugin-wasm";
3+
import { polyfillNode } from "esbuild-plugin-polyfill-node";
4+
5+
if (process.argv.length < 4) {
6+
throw `usage: node bundle.js ENTRY_POINT OUTPUT_FILENAME`;
7+
}
8+
9+
const isBrowser = !!process.env.BROWSER_RUNTIME;
10+
11+
export const buildOptions = ({ entryPoint, outfile }) => {
12+
const config = {
13+
entryPoints: [entryPoint],
14+
outfile: outfile,
15+
define: {
16+
BROWSER_RUNTIME: isBrowser ? "true" : '""',
17+
},
18+
plugins: [
19+
wasmLoader({
20+
mode: "deferred",
21+
}),
22+
],
23+
bundle: true,
24+
platform: isBrowser ? "browser" : "node",
25+
format: "esm",
26+
treeShaking: true,
27+
logLevel: "error",
28+
};
29+
30+
// https://esbuild.github.io/api/#packages
31+
if (!isBrowser) {
32+
config.packages = "external";
33+
} else {
34+
config.plugins.push(
35+
polyfillNode({
36+
polyfills: {
37+
crypto: true,
38+
fs: true,
39+
os: true,
40+
},
41+
})
42+
);
43+
}
44+
45+
return config;
46+
};
47+
48+
esbuild.build(
49+
buildOptions({
50+
entryPoint: process.argv[2],
51+
outfile: process.argv[3],
52+
})
53+
);

0 commit comments

Comments
 (0)