Skip to content

Commit

Permalink
Merge pull request #1 from l-adic/change-node-import
Browse files Browse the repository at this point in the history
Change node import
  • Loading branch information
martyall authored Apr 20, 2024
2 parents 8263037 + 859fe57 commit 12aaa4a
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 17 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ jobs:

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production
- name: Build source
run: npm run-script build
run: npm run build

- name: Run tests
run: |
bower install
npm run-script test --if-present
npm run test
- name: Check formatting
run: |
purs-tidy check src test
npm run tidy-check
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "purescript-node-buffer",
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "eslint src && pulp build -- --censor-lib --strict",
"test": "pulp test -- --censor-lib --strict"
"clean": "rm -rf output",
"build": "spago build",
"test": "spago test",
"tidy-check": "purs-tidy check src test"
},
"devDependencies": {
"eslint": "^7.15.0",
"pulp": "16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
"purescript": "^0.15.15",
"purs-tidy": "^0.11.0",
"spago": "^0.21.0"
}
}
105 changes: 105 additions & 0 deletions packages.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{-
Welcome to your new Dhall package-set!
Below are instructions for how to edit this file for most use
cases, so that you don't need to know Dhall to use it.
## Use Cases
Most will want to do one or both of these options:
1. Override/Patch a package's dependency
2. Add a package not already in the default package set
This file will continue to work whether you use one or both options.
Instructions for each option are explained below.
### Overriding/Patching a package
Purpose:
- Change a package's dependency to a newer/older release than the
default package set's release
- Use your own modified version of some dependency that may
include new API, changed API, removed API by
using your custom git repo of the library rather than
the package set's repo
Syntax:
where `entityName` is one of the following:
- dependencies
- repo
- version
-------------------------------
let upstream = --
in upstream
with packageName.entityName = "new value"
-------------------------------
Example:
-------------------------------
let upstream = --
in upstream
with halogen.version = "master"
with halogen.repo = "https://example.com/path/to/git/repo.git"
with halogen-vdom.version = "v4.0.0"
with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies
-------------------------------
### Additions
Purpose:
- Add packages that aren't already included in the default package set
Syntax:
where `<version>` is:
- a tag (i.e. "v4.0.0")
- a branch (i.e. "master")
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
-------------------------------
let upstream = --
in upstream
with new-package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"<version>"
}
-------------------------------
Example:
-------------------------------
let upstream = --
in upstream
with benchotron =
{ dependencies =
[ "arrays"
, "exists"
, "profunctor"
, "strings"
, "quickcheck"
, "lcg"
, "transformers"
, "foldable-traversable"
, "exceptions"
, "node-fs"
, "node-buffer"
, "node-readline"
, "datetime"
, "now"
]
, repo =
"https://github.com/hdgarrood/purescript-benchotron.git"
, version =
"v7.0.0"
}
-------------------------------
-}
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.15.15-20240419/packages.dhall
sha256:50c4ee579bf2c38671ac97df821c2cc4221fb3f6ad79c807bb6e4597ab6d1e95

in upstream
18 changes: 18 additions & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ name = "node-buffer"
, dependencies =
[ "arraybuffer-types"
, "assert"
, "console"
, "effect"
, "foldable-traversable"
, "functions"
, "maybe"
, "nullable"
, "partial"
, "prelude"
, "st"
, "unsafe-coerce"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}
2 changes: 1 addition & 1 deletion src/Node/Buffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer, transcode } from "node:buffer";
import { Buffer, transcode } from "buffer";

export const allocUnsafeImpl = (size) => Buffer.allocUnsafe(size);
export const allocUnsafeSlowImpl = (size) => Buffer.allocUnsafeSlow(size);
Expand Down
2 changes: 1 addition & 1 deletion src/Node/Buffer/Constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import buffer from "node:buffer";
import buffer from "buffer";

export const inspectMaxBytes = () => buffer.INSPECT_MAX_LENGTH;
export const maxLength = buffer.constants.MAX_LENGTH;
Expand Down
2 changes: 1 addition & 1 deletion src/Node/Buffer/Immutable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from "node:buffer";
import { Buffer } from "buffer";

import { inspect } from "util";
export const showImpl = inspect;
Expand Down
2 changes: 1 addition & 1 deletion src/Node/Encoding.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Buffer } from "node:buffer";
import { Buffer } from "buffer";

export const byteLengthImpl = (str, enc) => Buffer.byteLength(str, enc);

0 comments on commit 12aaa4a

Please sign in to comment.