fix: migrate to new spago, purescript, bun
This commit is contained in:
parent
dbf6c78697
commit
c5fc886786
8
.prettierrc.cjs
Normal file
8
.prettierrc.cjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
tabWidth: 2,
|
||||||
|
trailingComma: 'all',
|
||||||
|
singleQuote: true,
|
||||||
|
semi: false,
|
||||||
|
arrowParens: 'avoid',
|
||||||
|
plugins: ['prettier-plugin-sh'],
|
||||||
|
}
|
2
.tool-versions
Normal file
2
.tool-versions
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
purescript 0.15.12
|
||||||
|
bun 1.0.7
|
27
bun/fmt.js
Normal file
27
bun/fmt.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/** @type {(parser: string, ps: string[]) => import("bun").Subprocess} */
|
||||||
|
const prettier = (parser, ps) =>
|
||||||
|
Bun.spawn(['bun', 'x', 'prettier', '--write', '--parser', parser, ...ps], {
|
||||||
|
stdout: 'inherit',
|
||||||
|
stderr: 'inherit',
|
||||||
|
})
|
||||||
|
|
||||||
|
const procs = [
|
||||||
|
prettier('babel', ['./src/**/*.js', './bun/**/*.js', './.prettierrc.cjs']),
|
||||||
|
prettier('json', ['./package.json', './jsconfig.json']),
|
||||||
|
Bun.spawn(
|
||||||
|
[
|
||||||
|
'bun',
|
||||||
|
'x',
|
||||||
|
'purs-tidy',
|
||||||
|
'format-in-place',
|
||||||
|
'src/**/*.purs',
|
||||||
|
'test/**/*.purs',
|
||||||
|
],
|
||||||
|
{
|
||||||
|
stdout: 'inherit',
|
||||||
|
stderr: 'inherit',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
await Promise.all(procs.map(p => p.exited))
|
16
jsconfig.json
Normal file
16
jsconfig.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["bun-types"],
|
||||||
|
"lib": ["esnext"],
|
||||||
|
"target": "esnext",
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"jsx": "react",
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.js", "bun/**/*.js"]
|
||||||
|
}
|
131
package-lock.json
generated
131
package-lock.json
generated
@ -1,131 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "purescript-cheerio",
|
|
||||||
"version": "0.2.3",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
|
||||||
"dependencies": {
|
|
||||||
"boolbase": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
|
|
||||||
},
|
|
||||||
"cheerio": {
|
|
||||||
"version": "1.0.0-rc.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz",
|
|
||||||
"integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==",
|
|
||||||
"requires": {
|
|
||||||
"cheerio-select": "^2.1.0",
|
|
||||||
"dom-serializer": "^2.0.0",
|
|
||||||
"domhandler": "^5.0.3",
|
|
||||||
"domutils": "^3.0.1",
|
|
||||||
"htmlparser2": "^8.0.1",
|
|
||||||
"parse5": "^7.0.0",
|
|
||||||
"parse5-htmlparser2-tree-adapter": "^7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cheerio-select": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==",
|
|
||||||
"requires": {
|
|
||||||
"boolbase": "^1.0.0",
|
|
||||||
"css-select": "^5.1.0",
|
|
||||||
"css-what": "^6.1.0",
|
|
||||||
"domelementtype": "^2.3.0",
|
|
||||||
"domhandler": "^5.0.3",
|
|
||||||
"domutils": "^3.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"css-select": {
|
|
||||||
"version": "5.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
|
|
||||||
"integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==",
|
|
||||||
"requires": {
|
|
||||||
"boolbase": "^1.0.0",
|
|
||||||
"css-what": "^6.1.0",
|
|
||||||
"domhandler": "^5.0.2",
|
|
||||||
"domutils": "^3.0.1",
|
|
||||||
"nth-check": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"css-what": {
|
|
||||||
"version": "6.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
|
|
||||||
"integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw=="
|
|
||||||
},
|
|
||||||
"dom-serializer": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
|
|
||||||
"requires": {
|
|
||||||
"domelementtype": "^2.3.0",
|
|
||||||
"domhandler": "^5.0.2",
|
|
||||||
"entities": "^4.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"domelementtype": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="
|
|
||||||
},
|
|
||||||
"domhandler": {
|
|
||||||
"version": "5.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
|
|
||||||
"integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
|
|
||||||
"requires": {
|
|
||||||
"domelementtype": "^2.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"domutils": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==",
|
|
||||||
"requires": {
|
|
||||||
"dom-serializer": "^2.0.0",
|
|
||||||
"domelementtype": "^2.3.0",
|
|
||||||
"domhandler": "^5.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"entities": {
|
|
||||||
"version": "4.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
|
||||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="
|
|
||||||
},
|
|
||||||
"htmlparser2": {
|
|
||||||
"version": "8.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
|
||||||
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
|
|
||||||
"requires": {
|
|
||||||
"domelementtype": "^2.3.0",
|
|
||||||
"domhandler": "^5.0.3",
|
|
||||||
"domutils": "^3.0.1",
|
|
||||||
"entities": "^4.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nth-check": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
|
|
||||||
"requires": {
|
|
||||||
"boolbase": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parse5": {
|
|
||||||
"version": "7.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
|
|
||||||
"integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==",
|
|
||||||
"requires": {
|
|
||||||
"entities": "^4.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parse5-htmlparser2-tree-adapter": {
|
|
||||||
"version": "7.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz",
|
|
||||||
"integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==",
|
|
||||||
"requires": {
|
|
||||||
"domhandler": "^5.0.2",
|
|
||||||
"parse5": "^7.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,9 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "spago test"
|
"fmt": "bun fmt",
|
||||||
|
"build": "bun x spago build",
|
||||||
|
"test": "bun x spago test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -21,5 +23,9 @@
|
|||||||
"homepage": "https://github.com/icyrockcom/purescript-cheerio#readme",
|
"homepage": "https://github.com/icyrockcom/purescript-cheerio#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^1.0.0-rc.12"
|
"cheerio": "^1.0.0-rc.12"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"purs-tidy": "^0.10.0",
|
||||||
|
"spago": "next"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
let upstream =
|
|
||||||
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210811/packages.dhall sha256:a2de7ef2f2e753733eddfa90573a82da0c7c61d46fa87d015b7f15ef8a6e97d5
|
|
||||||
|
|
||||||
let overrides = {=}
|
|
||||||
|
|
||||||
let additions = {=}
|
|
||||||
|
|
||||||
in upstream // overrides // additions
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "purescript-cheerio",
|
|
||||||
"set": "psc-0.13.6-20200404",
|
|
||||||
"source": "https://github.com/purescript/package-sets.git",
|
|
||||||
"depends":
|
|
||||||
[ "console"
|
|
||||||
, "effect"
|
|
||||||
, "functions"
|
|
||||||
, "prelude"
|
|
||||||
, "psci-support"
|
|
||||||
, "test-unit"
|
|
||||||
]
|
|
||||||
}
|
|
15
spago.dhall
15
spago.dhall
@ -1,15 +0,0 @@
|
|||||||
{ name = "cheerio"
|
|
||||||
, license = "MIT"
|
|
||||||
, repository = "https://github.com/icyrockcom/purescript-cheerio"
|
|
||||||
, dependencies =
|
|
||||||
[ "arrays"
|
|
||||||
, "effect"
|
|
||||||
, "functions"
|
|
||||||
, "maybe"
|
|
||||||
, "prelude"
|
|
||||||
, "psci-support"
|
|
||||||
, "test-unit"
|
|
||||||
]
|
|
||||||
, packages = ./packages.dhall
|
|
||||||
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
|
|
||||||
}
|
|
15
spago.yaml
Normal file
15
spago.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package:
|
||||||
|
dependencies:
|
||||||
|
- arrays
|
||||||
|
- effect
|
||||||
|
- functions
|
||||||
|
- maybe
|
||||||
|
- prelude
|
||||||
|
- psci-support
|
||||||
|
- test-unit
|
||||||
|
name: cheerio
|
||||||
|
workspace:
|
||||||
|
extra_packages: {}
|
||||||
|
package_set:
|
||||||
|
url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.10-20230930/packages.json
|
||||||
|
hash: sha256-nTsd44o7/hrTdk0c6dh0wyBqhFFDJJIeKdQU6L1zv/A=
|
@ -1,7 +1,7 @@
|
|||||||
const cheerio = require('cheerio')
|
import cheerio from 'cheerio'
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
exports.attrImpl = function(nothing, just, name, cheerioInst) {
|
export const attrImpl = function(nothing, just, name, cheerioInst) {
|
||||||
|
|
||||||
if (cheerioInst.length > 0) {
|
if (cheerioInst.length > 0) {
|
||||||
const value = cheerioInst.attr(name);
|
const value = cheerioInst.attr(name);
|
||||||
@ -11,57 +11,57 @@ exports.attrImpl = function(nothing, just, name, cheerioInst) {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.hasClassImpl = function(className, cheerioInst) {
|
export const hasClassImpl = function(className, cheerioInst) {
|
||||||
return cheerioInst.hasClass(className);
|
return cheerioInst.hasClass(className);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Traversing
|
// Traversing
|
||||||
exports.findImpl = function(selector, cheerioInst) {
|
export const findImpl = function(selector, cheerioInst) {
|
||||||
return cheerioInst.find(selector);
|
return cheerioInst.find(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.parent = function(cheerioInst) {
|
export const parent = function(cheerioInst) {
|
||||||
return cheerioInst.parent()
|
return cheerioInst.parent()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.next = function(cheerioInst) {
|
export const next = function(cheerioInst) {
|
||||||
return cheerioInst.next()
|
return cheerioInst.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.prev = function(cheerioInst) {
|
export const prev = function(cheerioInst) {
|
||||||
return cheerioInst.prev()
|
return cheerioInst.prev()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.siblings = function(cheerioInst) {
|
export const siblings = function(cheerioInst) {
|
||||||
return cheerioInst.siblings()
|
return cheerioInst.siblings()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.children = function(cheerioInst) {
|
export const children = function(cheerioInst) {
|
||||||
return cheerioInst.children()
|
return cheerioInst.children()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.first = function(cheerioInst) {
|
export const first = function(cheerioInst) {
|
||||||
return cheerioInst.first()
|
return cheerioInst.first()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.last = function(cheerioInst) {
|
export const last = function(cheerioInst) {
|
||||||
return cheerioInst.last()
|
return cheerioInst.last()
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.eqImpl = function(index, cheerioInst) {
|
export const eqImpl = function(index, cheerioInst) {
|
||||||
return cheerioInst.eq(index)
|
return cheerioInst.eq(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
exports.htmlImpl = function(nothing, just, cheerioInst) {
|
export const htmlImpl = function(nothing, just, cheerioInst) {
|
||||||
return cheerioInst.length ? just(cheerioInst.html()) : nothing;
|
return cheerioInst.length ? just(cheerioInst.html()) : nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.text = function(cheerioInst) {
|
export const text = function(cheerioInst) {
|
||||||
return cheerioInst.text()
|
return cheerioInst.text()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
exports.length = function(cheerioInst) {
|
export const length = function(cheerioInst) {
|
||||||
return cheerioInst.length;
|
return cheerioInst.length;
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
const cheerio = require('cheerio')
|
import cheerio from 'cheerio'
|
||||||
|
|
||||||
// Loading
|
// Loading
|
||||||
exports.load = cheerio.load
|
export const load = cheerio.load
|
||||||
|
|
||||||
// Selecting
|
// Selecting
|
||||||
exports.selectImpl = function(str, cheerioStatic) {
|
export const selectImpl = function(str, cheerioStatic) {
|
||||||
return cheerioStatic(str)
|
return cheerioStatic(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.selectDeepImpl = function(strArr, cheerioStatic) {
|
export const selectDeepImpl = function(strArr, cheerioStatic) {
|
||||||
return cheerioStatic.apply(cheerioStatic, strArr)
|
return cheerioStatic.apply(cheerioStatic, strArr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
exports.htmlImpl = function(nothing, just, cheerioInst) {
|
export const htmlImpl = function(nothing, just, cheerioInst) {
|
||||||
const ret = cheerio.html(cheerioInst)
|
const ret = cheerio.html(cheerioInst)
|
||||||
return ret != null ? just(ret) : nothing
|
return ret != null ? just(ret) : nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utilities
|
// Utilities
|
||||||
exports.root = function(cheerioStatic) {
|
export const root = function(cheerioStatic) {
|
||||||
return cheerio.root.call(cheerioStatic)
|
return cheerio.root.call(cheerioStatic)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user