declarations are now bundled as well
This commit is contained in:
parent
1f2a950fea
commit
84ebe88a12
|
@ -0,0 +1,116 @@
|
||||||
|
name: build, test (node and browser), coverage, publish to NPM
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use Node.js 18
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
nodetests:
|
||||||
|
name: tests in Node.js
|
||||||
|
needs: [build]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
node-version: [16.x, 18.x]
|
||||||
|
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
|
||||||
|
fail-fast: false
|
||||||
|
# The maximum number of jobs that can run simultaneously. Set to 1 if you can't run tests in parallel
|
||||||
|
# max-parallel: 1
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm i
|
||||||
|
|
||||||
|
- name: node esm tests
|
||||||
|
run: npm run test:node-esm
|
||||||
|
# env:
|
||||||
|
# VARIABLE1: ${{ secrets.VARIABLE1 }}
|
||||||
|
# VARIABLE2: ${{ secrets.VARIABLE2 }}
|
||||||
|
|
||||||
|
- name: node cjs tests
|
||||||
|
run: npm run test:node-cjs
|
||||||
|
# env:
|
||||||
|
# VARIABLE1: ${{ secrets.VARIABLE1 }}
|
||||||
|
# VARIABLE2: ${{ secrets.VARIABLE2 }}
|
||||||
|
|
||||||
|
browsertests:
|
||||||
|
needs: [build]
|
||||||
|
name: tests in browser
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Use Node.js 18
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: browser tests
|
||||||
|
run: npm run test:browser-headless
|
||||||
|
# env:
|
||||||
|
# VARIABLE1: ${{ secrets.VARIABLE1 }}
|
||||||
|
# VARIABLE2: ${{ secrets.VARIABLE2 }}
|
||||||
|
|
||||||
|
publish:
|
||||||
|
needs: [nodetests, browsertests]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Node.js, NPM and Yarn
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "18.x"
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: coverage
|
||||||
|
run: npm run coverage
|
||||||
|
|
||||||
|
- name: send report to coveralls.io
|
||||||
|
uses: coverallsapp/github-action@master
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: NPM publish
|
||||||
|
run: npm publish --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@ -1,81 +0,0 @@
|
||||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
||||||
|
|
||||||
name: Node CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: build, test, check coverage
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16, 18]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
|
|
||||||
- name: install
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
publication:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: EndBug/version-check@v1
|
|
||||||
id: check
|
|
||||||
|
|
||||||
- name: check version changes
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
- name: install
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
- name: create code coverage report
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: npm run coverage
|
|
||||||
|
|
||||||
- name: send report to coveralls.io
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
uses: coverallsapp/github-action@master
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: publish to NPM
|
|
||||||
if: steps.check.outputs.changed == 'true'
|
|
||||||
run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
@ -38,7 +38,7 @@ import * as bigintModArith from 'bigint-mod-arith'
|
||||||
|
|
||||||
The appropriate version for browser or node is automatically exported.
|
The appropriate version for browser or node is automatically exported.
|
||||||
|
|
||||||
You can also download the [IIFE bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundles/iife.js), the [ESM bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundles/esm.min.js) or the [UMD bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundles/umd.js) and manually add it to your project, or, if you have already imported `bigint-mod-arith` to your project, just get the bundles from `node_modules/bigint-mod-arith/dist/bundles/`.
|
You can also download the [IIFE bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundle.iife.js), the [ESM bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundle.esm.min.js) or the [UMD bundle](https://raw.githubusercontent.com/juanelas/bigint-mod-arith/main/dist/bundle.umd.js) and manually add it to your project, or, if you have already imported `bigint-mod-arith` to your project, just get the bundles from `node_modules/bigint-mod-arith/dist/bundles/`.
|
||||||
|
|
||||||
An example of usage could be:
|
An example of usage could be:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
const minimatch = require('minimatch')
|
const minimatch = require('minimatch').minimatch
|
||||||
const rimraf = require('rimraf')
|
const rimraf = require('rimraf')
|
||||||
const runScript = require('../run-script.cjs')
|
const runScript = require('../run-script.cjs')
|
||||||
|
|
||||||
|
@ -58,9 +58,11 @@ function parse () {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
let testsGlob = (args.pop() ?? '').replace(/^['"]/, '').replace(/['"]$/, '') // Let us remove surrounding quotes in string (it gives issues in windows)
|
let testsGlob = args.pop()
|
||||||
if (testsGlob === '') {
|
if (testsGlob === undefined) {
|
||||||
testsGlob = '{src/ts/**/*.spec.ts,test/**/*.ts}'
|
testsGlob = '{src/ts/**/*.spec.ts,test/**/*.ts}'
|
||||||
|
} else {
|
||||||
|
testsGlob = testsGlob.replace(/^['"]/, '').replace(/['"]$/, '') // Let us remove surrounding quotes in string (it gives issues in windows)
|
||||||
}
|
}
|
||||||
|
|
||||||
const mochaArgs = []
|
const mochaArgs = []
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { mkdirSync, readFileSync, writeFileSync } from 'fs'
|
import { mkdirSync, writeFileSync } from 'fs'
|
||||||
import ts from 'typescript'
|
import ts from 'typescript'
|
||||||
import { join, dirname, extname } from 'path'
|
import { join, dirname, extname } from 'path'
|
||||||
import { sync } from 'rimraf'
|
import { sync } from 'rimraf'
|
||||||
|
@ -8,9 +8,7 @@ const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||||
const { readJsonConfigFile, sys, parseJsonSourceFileConfigFileContent, createCompilerHost, createProgram } = ts
|
const { readJsonConfigFile, sys, parseJsonSourceFileConfigFileContent, createCompilerHost, createProgram } = ts
|
||||||
|
|
||||||
const rootDir = join(__dirname, '..')
|
const rootDir = join(__dirname, '..')
|
||||||
const pkgJson = JSON.parse(readFileSync(join(rootDir, 'package.json')))
|
|
||||||
const srcFile = join(rootDir, 'src/ts/index.ts')
|
const srcFile = join(rootDir, 'src/ts/index.ts')
|
||||||
const outDir = dirname(join(rootDir, pkgJson.types))
|
|
||||||
|
|
||||||
const tsConfigPath = join(rootDir, 'tsconfig.json')
|
const tsConfigPath = join(rootDir, 'tsconfig.json')
|
||||||
|
|
||||||
|
@ -20,6 +18,7 @@ const configFile = readJsonConfigFile(tsConfigPath, (file) => {
|
||||||
|
|
||||||
const tsConfig = parseJsonSourceFileConfigFileContent(configFile, sys, dirname(tsConfigPath))
|
const tsConfig = parseJsonSourceFileConfigFileContent(configFile, sys, dirname(tsConfigPath))
|
||||||
|
|
||||||
|
export const compile = (outDir) => {
|
||||||
const compilerOptions = {
|
const compilerOptions = {
|
||||||
...tsConfig.options,
|
...tsConfig.options,
|
||||||
declaration: true,
|
declaration: true,
|
||||||
|
@ -44,7 +43,6 @@ host.writeFile = (fileName, contents) => {
|
||||||
writeFileSync(fileName2, contents)
|
writeFileSync(fileName2, contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const compile = () => {
|
|
||||||
// Clear the types dir
|
// Clear the types dir
|
||||||
sync(outDir)
|
sync(outDir)
|
||||||
// Prepare and emit the d.ts files
|
// Prepare and emit the d.ts files
|
||||||
|
|
|
@ -1,27 +1,28 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
import inject from '@rollup/plugin-inject'
|
import inject from '@rollup/plugin-inject'
|
||||||
|
import json from '@rollup/plugin-json'
|
||||||
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve'
|
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve'
|
||||||
import replace from '@rollup/plugin-replace'
|
import replace from '@rollup/plugin-replace'
|
||||||
import terser from '@rollup/plugin-terser'
|
import terser from '@rollup/plugin-terser'
|
||||||
import typescriptPlugin from '@rollup/plugin-typescript'
|
import rollupPluginTs from '@rollup/plugin-typescript'
|
||||||
import commonjs from '@rollup/plugin-commonjs'
|
|
||||||
import json from '@rollup/plugin-json'
|
|
||||||
|
|
||||||
import { dirname, join } from 'path'
|
|
||||||
import { existsSync, readFileSync } from 'fs'
|
import { existsSync, readFileSync } from 'fs'
|
||||||
|
import { dirname, join } from 'path'
|
||||||
// import { browser, name as _name, exports } from '../package.json' assert { type: 'json' }
|
import dts from 'rollup-plugin-dts'
|
||||||
import { compile } from './rollup-plugin-dts.js'
|
import { compile } from './rollup-plugin-dts.js'
|
||||||
|
import { builtinModules } from 'module'
|
||||||
|
|
||||||
import * as url from 'url'
|
import * as url from 'url'
|
||||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||||
|
|
||||||
const rootDir = join(__dirname, '..')
|
const rootDir = join(__dirname, '..')
|
||||||
const pkgJson = JSON.parse(readFileSync(join(rootDir, 'package.json')))
|
const pkgJson = JSON.parse(readFileSync(join(rootDir, 'package.json')))
|
||||||
// const dstDir = join(rootDir, directories.dist)
|
const pkgJsonLock = JSON.parse(readFileSync(join(rootDir, 'package-lock.json')))
|
||||||
const srcDir = join(rootDir, 'src', 'ts')
|
const srcDir = join(rootDir, 'src', 'ts')
|
||||||
|
|
||||||
|
const tsConfigPath = join(rootDir, 'tsconfig.json')
|
||||||
|
|
||||||
function camelise (str) {
|
function camelise (str) {
|
||||||
return str.replace(/-([a-z])/g,
|
return str.replace(/-([a-z])/g,
|
||||||
function (m, w) {
|
function (m, w) {
|
||||||
|
@ -29,6 +30,11 @@ function camelise (str) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDevDependency (moduleName) {
|
||||||
|
const packageEntry = pkgJsonLock.packages['node_modules/' + moduleName]
|
||||||
|
return (packageEntry ?? {}).dev === true
|
||||||
|
}
|
||||||
|
|
||||||
const regex = /^(?:(?<scope>@.*?)\/)?(?<name>.*)/ // We are going to take only the package name part if there is a scope, e.g. @my-org/package-name
|
const regex = /^(?:(?<scope>@.*?)\/)?(?<name>.*)/ // We are going to take only the package name part if there is a scope, e.g. @my-org/package-name
|
||||||
const { name } = pkgJson.name.match(regex).groups
|
const { name } = pkgJson.name.match(regex).groups
|
||||||
const pkgCamelisedName = camelise(name)
|
const pkgCamelisedName = camelise(name)
|
||||||
|
@ -36,9 +42,9 @@ const pkgCamelisedName = camelise(name)
|
||||||
const input = join(srcDir, 'index.ts')
|
const input = join(srcDir, 'index.ts')
|
||||||
if (existsSync(input) !== true) throw new Error('The entry point should be index.ts')
|
if (existsSync(input) !== true) throw new Error('The entry point should be index.ts')
|
||||||
|
|
||||||
const tsBundleOptions = {
|
const tsPluginOptions = {
|
||||||
tsconfig: join(rootDir, 'tsconfig.json'),
|
tsconfig: tsConfigPath,
|
||||||
outDir: undefined, // ignore outDir in tsconfig.json
|
outDir: undefined,
|
||||||
include: ['src/ts/**/*', 'build/typings/is-browser.d.ts'],
|
include: ['src/ts/**/*', 'build/typings/is-browser.d.ts'],
|
||||||
exclude: ['src/**/*.spec.ts']
|
exclude: ['src/**/*.spec.ts']
|
||||||
}
|
}
|
||||||
|
@ -48,23 +54,47 @@ const sourcemapOutputOptions = {
|
||||||
sourcemapExcludeSources: true
|
sourcemapExcludeSources: true
|
||||||
}
|
}
|
||||||
|
|
||||||
function compileDts () {
|
function compileDts (outDir) {
|
||||||
return {
|
return {
|
||||||
name: 'compile-dts',
|
name: 'compile-dts',
|
||||||
closeBundle () {
|
closeBundle () {
|
||||||
compile()
|
compile(outDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveOnly (module) { // if a dev dependency is imported we will resolve it so that the dist modules always work
|
||||||
|
const moduleNameMatch = module.match(/^(?:@[a-z0-9_-]+\/)?(?:node:)?[a-z0-9_-]+/)
|
||||||
|
if (moduleNameMatch === null || moduleNameMatch.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const moduleName = moduleNameMatch[0].replace(/^node:/, '')
|
||||||
|
// don't resolve if it is a native module
|
||||||
|
if (builtinModules.includes(moduleName)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDevDependency(moduleName)) {
|
||||||
|
console.warn(`\x1b[33m⚠ WARM: dev dependency \x1b[0m${module}\x1b[33m being bundled. Should it be a dependency instead?\x1b[0m`)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const tmpDeclarationsDir = join(rootDir, '.types')
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{ // Browser ESM bundle
|
{ // Browser ESM
|
||||||
input,
|
input,
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
file: join(rootDir, pkgJson.browser),
|
file: join(rootDir, pkgJson.exports['.'].default.default),
|
||||||
...sourcemapOutputOptions,
|
...sourcemapOutputOptions,
|
||||||
format: 'es'
|
format: 'es',
|
||||||
|
plugins: [
|
||||||
|
terser()
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -73,9 +103,15 @@ export default [
|
||||||
_MODULE_TYPE: "'ESM'",
|
_MODULE_TYPE: "'ESM'",
|
||||||
preventAssignment: true
|
preventAssignment: true
|
||||||
}),
|
}),
|
||||||
typescriptPlugin(tsBundleOptions),
|
rollupPluginTs(tsPluginOptions),
|
||||||
commonjs({ extensions: ['.js', '.cjs', '.ts', '.jsx', '.cjsx', '.tsx'] }), // the ".ts" extension is required
|
commonjs({ extensions: ['.js', '.cjs', '.jsx', '.cjsx'] }),
|
||||||
json()
|
json(),
|
||||||
|
resolve({
|
||||||
|
browser: true,
|
||||||
|
exportConditions: ['browser', 'default'],
|
||||||
|
mainFields: ['browser', 'module', 'main'],
|
||||||
|
resolveOnly
|
||||||
|
})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ // Browser bundles
|
{ // Browser bundles
|
||||||
|
@ -109,17 +145,13 @@ export default [
|
||||||
_MODULE_TYPE: "'BUNDLE'",
|
_MODULE_TYPE: "'BUNDLE'",
|
||||||
preventAssignment: true
|
preventAssignment: true
|
||||||
}),
|
}),
|
||||||
typescriptPlugin({
|
rollupPluginTs({
|
||||||
...tsBundleOptions,
|
...tsPluginOptions,
|
||||||
sourceMap: false
|
sourceMap: false
|
||||||
}),
|
}),
|
||||||
resolve({
|
commonjs({ extensions: ['.js', '.cjs', '.jsx', '.cjsx'] }),
|
||||||
browser: true,
|
json(),
|
||||||
exportConditions: ['browser', 'default'],
|
resolve({ browser: true })
|
||||||
mainFields: ['browser', 'module', 'main']
|
|
||||||
}),
|
|
||||||
commonjs({ extensions: ['.js', '.cjs', '.ts', '.jsx', '.cjsx', '.tsx'] }), // the ".ts" extension is required
|
|
||||||
json()
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ // Node CJS
|
{ // Node CJS
|
||||||
|
@ -136,21 +168,26 @@ export default [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'await import(': 'require(',
|
||||||
|
delimiters: ['', ''],
|
||||||
|
preventAssignment: true
|
||||||
|
}),
|
||||||
replace({
|
replace({
|
||||||
IS_BROWSER: false,
|
IS_BROWSER: false,
|
||||||
_MODULE_TYPE: "'CJS'",
|
_MODULE_TYPE: "'CJS'",
|
||||||
preventAssignment: true
|
preventAssignment: true
|
||||||
}),
|
}),
|
||||||
|
rollupPluginTs(tsPluginOptions),
|
||||||
inject({
|
inject({
|
||||||
crypto: ['crypto', 'webcrypto']
|
crypto: ['crypto', 'webcrypto']
|
||||||
}),
|
}),
|
||||||
typescriptPlugin(tsBundleOptions),
|
commonjs({ extensions: ['.js', '.cjs', '.jsx', '.cjsx'] }),
|
||||||
// resolve({
|
json(),
|
||||||
// browser: false,
|
resolve({
|
||||||
// exportConditions: ['require', 'node', 'module', 'import']
|
exportConditions: ['node'],
|
||||||
// }),
|
resolveOnly
|
||||||
commonjs({ extensions: ['.js', '.cjs', '.ts', '.jsx', '.cjsx', '.tsx'] }), // the ".ts" extension is required
|
})
|
||||||
json()
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ // Node ESM and type declarations
|
{ // Node ESM and type declarations
|
||||||
|
@ -173,17 +210,32 @@ export default [
|
||||||
__dirname: `'${dirname(pkgJson.exports['.'].node.import.default)}'`,
|
__dirname: `'${dirname(pkgJson.exports['.'].node.import.default)}'`,
|
||||||
preventAssignment: true
|
preventAssignment: true
|
||||||
}),
|
}),
|
||||||
|
rollupPluginTs(tsPluginOptions),
|
||||||
|
compileDts(tmpDeclarationsDir),
|
||||||
inject({
|
inject({
|
||||||
crypto: ['crypto', 'webcrypto']
|
crypto: ['crypto', 'webcrypto']
|
||||||
}),
|
}),
|
||||||
typescriptPlugin(tsBundleOptions),
|
commonjs({ extensions: ['.js', '.cjs', '.jsx', '.cjsx'] }),
|
||||||
// resolve({
|
json(),
|
||||||
// browser: false,
|
resolve({
|
||||||
// exportConditions: ['node']
|
exportConditions: ['node'],
|
||||||
// }),
|
resolveOnly
|
||||||
compileDts(),
|
})
|
||||||
commonjs({ extensions: ['.js', '.cjs', '.ts', '.jsx', '.cjsx', '.tsx'] }), // the ".ts" extension is required
|
|
||||||
json()
|
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: join(tmpDeclarationsDir, 'index.d.ts'),
|
||||||
|
output: [{ file: 'dist/index.d.ts', format: 'es' }],
|
||||||
|
plugins: [
|
||||||
|
dts({
|
||||||
|
respectExternal: true
|
||||||
|
})
|
||||||
|
],
|
||||||
|
external: (module) => {
|
||||||
|
if (/^[./]/.test(module)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return !resolveOnly(module)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const puppeteer = require('puppeteer')
|
const puppeteer = require('puppeteer')
|
||||||
const minimatch = require('minimatch')
|
const minimatch = require('minimatch').minimatch
|
||||||
const glob = require('glob')
|
const glob = require('glob')
|
||||||
const rootDir = path.join(__dirname, '../../..')
|
const rootDir = path.join(__dirname, '../../..')
|
||||||
const pkgJson = require(path.join(rootDir, 'package.json'))
|
const pkgJson = require(path.join(rootDir, 'package.json'))
|
||||||
|
|
|
@ -60,24 +60,20 @@ async function buildTests (testFiles) {
|
||||||
input: testFiles,
|
input: testFiles,
|
||||||
plugins: [
|
plugins: [
|
||||||
multi(),
|
multi(),
|
||||||
replace({
|
|
||||||
'#pkg': `/${name}.esm.js`,
|
|
||||||
delimiters: ['', ''],
|
|
||||||
preventAssignment: true
|
|
||||||
}),
|
|
||||||
replace({
|
replace({
|
||||||
IS_BROWSER: true,
|
IS_BROWSER: true,
|
||||||
_MODULE_TYPE: "'ESM'",
|
_MODULE_TYPE: "'ESM'",
|
||||||
preventAssignment: true
|
preventAssignment: true
|
||||||
}),
|
}),
|
||||||
typescriptPlugin(tsBundleOptions),
|
typescriptPlugin(tsBundleOptions),
|
||||||
resolve({
|
commonjs({ extensions: ['.js', '.cjs', '.jsx', '.cjsx'] }),
|
||||||
browser: true,
|
json(),
|
||||||
exportConditions: ['browser', 'default'],
|
resolve({ browser: true }),
|
||||||
mainFields: ['browser', 'module', 'main']
|
replace({
|
||||||
}),
|
'#pkg': `/${name}.esm.js`,
|
||||||
commonjs(),
|
delimiters: ['', ''],
|
||||||
json()
|
preventAssignment: true
|
||||||
|
})
|
||||||
],
|
],
|
||||||
external: [`/${name}.esm.js`]
|
external: [`/${name}.esm.js`]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,146 +0,0 @@
|
||||||
function abs(a) {
|
|
||||||
return (a >= 0) ? a : -a;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bitLength(a) {
|
|
||||||
if (typeof a === 'number')
|
|
||||||
a = BigInt(a);
|
|
||||||
if (a === 1n) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
let bits = 1;
|
|
||||||
do {
|
|
||||||
bits++;
|
|
||||||
} while ((a >>= 1n) > 1n);
|
|
||||||
return bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
function eGcd(a, b) {
|
|
||||||
if (typeof a === 'number')
|
|
||||||
a = BigInt(a);
|
|
||||||
if (typeof b === 'number')
|
|
||||||
b = BigInt(b);
|
|
||||||
if (a <= 0n || b <= 0n)
|
|
||||||
throw new RangeError('a and b MUST be > 0');
|
|
||||||
let x = 0n;
|
|
||||||
let y = 1n;
|
|
||||||
let u = 1n;
|
|
||||||
let v = 0n;
|
|
||||||
while (a !== 0n) {
|
|
||||||
const q = b / a;
|
|
||||||
const r = b % a;
|
|
||||||
const m = x - (u * q);
|
|
||||||
const n = y - (v * q);
|
|
||||||
b = a;
|
|
||||||
a = r;
|
|
||||||
x = u;
|
|
||||||
y = v;
|
|
||||||
u = m;
|
|
||||||
v = n;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
g: b,
|
|
||||||
x,
|
|
||||||
y
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function gcd(a, b) {
|
|
||||||
let aAbs = (typeof a === 'number') ? BigInt(abs(a)) : abs(a);
|
|
||||||
let bAbs = (typeof b === 'number') ? BigInt(abs(b)) : abs(b);
|
|
||||||
if (aAbs === 0n) {
|
|
||||||
return bAbs;
|
|
||||||
}
|
|
||||||
else if (bAbs === 0n) {
|
|
||||||
return aAbs;
|
|
||||||
}
|
|
||||||
let shift = 0n;
|
|
||||||
while (((aAbs | bAbs) & 1n) === 0n) {
|
|
||||||
aAbs >>= 1n;
|
|
||||||
bAbs >>= 1n;
|
|
||||||
shift++;
|
|
||||||
}
|
|
||||||
while ((aAbs & 1n) === 0n)
|
|
||||||
aAbs >>= 1n;
|
|
||||||
do {
|
|
||||||
while ((bAbs & 1n) === 0n)
|
|
||||||
bAbs >>= 1n;
|
|
||||||
if (aAbs > bAbs) {
|
|
||||||
const x = aAbs;
|
|
||||||
aAbs = bAbs;
|
|
||||||
bAbs = x;
|
|
||||||
}
|
|
||||||
bAbs -= aAbs;
|
|
||||||
} while (bAbs !== 0n);
|
|
||||||
return aAbs << shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
function lcm(a, b) {
|
|
||||||
if (typeof a === 'number')
|
|
||||||
a = BigInt(a);
|
|
||||||
if (typeof b === 'number')
|
|
||||||
b = BigInt(b);
|
|
||||||
if (a === 0n && b === 0n)
|
|
||||||
return BigInt(0);
|
|
||||||
return abs((a / gcd(a, b)) * b);
|
|
||||||
}
|
|
||||||
|
|
||||||
function max(a, b) {
|
|
||||||
return (a >= b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
function min(a, b) {
|
|
||||||
return (a >= b) ? b : a;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toZn(a, n) {
|
|
||||||
if (typeof a === 'number')
|
|
||||||
a = BigInt(a);
|
|
||||||
if (typeof n === 'number')
|
|
||||||
n = BigInt(n);
|
|
||||||
if (n <= 0n) {
|
|
||||||
throw new RangeError('n must be > 0');
|
|
||||||
}
|
|
||||||
const aZn = a % n;
|
|
||||||
return (aZn < 0n) ? aZn + n : aZn;
|
|
||||||
}
|
|
||||||
|
|
||||||
function modInv(a, n) {
|
|
||||||
const egcd = eGcd(toZn(a, n), n);
|
|
||||||
if (egcd.g !== 1n) {
|
|
||||||
throw new RangeError(`${a.toString()} does not have inverse modulo ${n.toString()}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return toZn(egcd.x, n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function modPow(b, e, n) {
|
|
||||||
if (typeof b === 'number')
|
|
||||||
b = BigInt(b);
|
|
||||||
if (typeof e === 'number')
|
|
||||||
e = BigInt(e);
|
|
||||||
if (typeof n === 'number')
|
|
||||||
n = BigInt(n);
|
|
||||||
if (n <= 0n) {
|
|
||||||
throw new RangeError('n must be > 0');
|
|
||||||
}
|
|
||||||
else if (n === 1n) {
|
|
||||||
return 0n;
|
|
||||||
}
|
|
||||||
b = toZn(b, n);
|
|
||||||
if (e < 0n) {
|
|
||||||
return modInv(modPow(b, abs(e), n), n);
|
|
||||||
}
|
|
||||||
let r = 1n;
|
|
||||||
while (e > 0) {
|
|
||||||
if ((e % 2n) === 1n) {
|
|
||||||
r = r * b % n;
|
|
||||||
}
|
|
||||||
e = e / 2n;
|
|
||||||
b = b ** 2n % n;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { abs, bitLength, eGcd, gcd, lcm, max, min, modInv, modPow, toZn };
|
|
|
@ -1 +0,0 @@
|
||||||
function n(n){return n>=0?n:-n}function t(n){if("number"==typeof n&&(n=BigInt(n)),1n===n)return 1;let t=1;do{t++}while((n>>=1n)>1n);return t}function r(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),n<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,e=1n,o=1n,u=0n;for(;0n!==n;){const i=t/n,f=t%n,g=r-o*i,b=e-u*i;t=n,n=f,r=o,e=u,o=g,u=b}return{g:t,x:r,y:e}}function e(t,r){let e="number"==typeof t?BigInt(n(t)):n(t),o="number"==typeof r?BigInt(n(r)):n(r);if(0n===e)return o;if(0n===o)return e;let u=0n;for(;0n===(1n&(e|o));)e>>=1n,o>>=1n,u++;for(;0n===(1n&e);)e>>=1n;do{for(;0n===(1n&o);)o>>=1n;if(e>o){const n=e;e=o,o=n}o-=e}while(0n!==o);return e<<u}function o(t,r){return"number"==typeof t&&(t=BigInt(t)),"number"==typeof r&&(r=BigInt(r)),0n===t&&0n===r?BigInt(0):n(t/e(t,r)*r)}function u(n,t){return n>=t?n:t}function i(n,t){return n>=t?t:n}function f(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");const r=n%t;return r<0n?r+t:r}function g(n,t){const e=r(f(n,t),t);if(1n!==e.g)throw new RangeError(`${n.toString()} does not have inverse modulo ${t.toString()}`);return f(e.x,t)}function b(t,r,e){if("number"==typeof t&&(t=BigInt(t)),"number"==typeof r&&(r=BigInt(r)),"number"==typeof e&&(e=BigInt(e)),e<=0n)throw new RangeError("n must be > 0");if(1n===e)return 0n;if(t=f(t,e),r<0n)return g(b(t,n(r),e),e);let o=1n;for(;r>0;)r%2n===1n&&(o=o*t%e),r/=2n,t=t**2n%e;return o}export{n as abs,t as bitLength,r as eGcd,e as gcd,o as lcm,u as max,i as min,g as modInv,b as modPow,f as toZn};
|
|
|
@ -1 +0,0 @@
|
||||||
var bigintModArith=function(n){"use strict";function t(n){return n>=0?n:-n}function r(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),n<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,e=1n,o=1n,i=0n;for(;0n!==n;){const u=t/n,f=t%n,g=r-o*u,m=e-i*u;t=n,n=f,r=o,e=i,o=g,i=m}return{g:t,x:r,y:e}}function e(n,r){let e="number"==typeof n?BigInt(t(n)):t(n),o="number"==typeof r?BigInt(t(r)):t(r);if(0n===e)return o;if(0n===o)return e;let i=0n;for(;0n===(1n&(e|o));)e>>=1n,o>>=1n,i++;for(;0n===(1n&e);)e>>=1n;do{for(;0n===(1n&o);)o>>=1n;if(e>o){const n=e;e=o,o=n}o-=e}while(0n!==o);return e<<i}function o(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");const r=n%t;return r<0n?r+t:r}function i(n,t){const e=r(o(n,t),t);if(1n!==e.g)throw new RangeError(`${n.toString()} does not have inverse modulo ${t.toString()}`);return o(e.x,t)}return n.abs=t,n.bitLength=function(n){if("number"==typeof n&&(n=BigInt(n)),1n===n)return 1;let t=1;do{t++}while((n>>=1n)>1n);return t},n.eGcd=r,n.gcd=e,n.lcm=function(n,r){return"number"==typeof n&&(n=BigInt(n)),"number"==typeof r&&(r=BigInt(r)),0n===n&&0n===r?BigInt(0):t(n/e(n,r)*r)},n.max=function(n,t){return n>=t?n:t},n.min=function(n,t){return n>=t?t:n},n.modInv=i,n.modPow=function n(r,e,u){if("number"==typeof r&&(r=BigInt(r)),"number"==typeof e&&(e=BigInt(e)),"number"==typeof u&&(u=BigInt(u)),u<=0n)throw new RangeError("n must be > 0");if(1n===u)return 0n;if(r=o(r,u),e<0n)return i(n(r,t(e),u),u);let f=1n;for(;e>0;)e%2n===1n&&(f=f*r%u),e/=2n,r=r**2n%u;return f},n.toZn=o,n}({});
|
|
|
@ -1 +0,0 @@
|
||||||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).bigintModArith={})}(this,(function(n){"use strict";function t(n){return n>=0?n:-n}function e(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),n<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let e=0n,r=1n,o=1n,i=0n;for(;0n!==n;){const f=t/n,u=t%n,g=e-o*f,b=r-i*f;t=n,n=u,e=o,r=i,o=g,i=b}return{g:t,x:e,y:r}}function r(n,e){let r="number"==typeof n?BigInt(t(n)):t(n),o="number"==typeof e?BigInt(t(e)):t(e);if(0n===r)return o;if(0n===o)return r;let i=0n;for(;0n===(1n&(r|o));)r>>=1n,o>>=1n,i++;for(;0n===(1n&r);)r>>=1n;do{for(;0n===(1n&o);)o>>=1n;if(r>o){const n=r;r=o,o=n}o-=r}while(0n!==o);return r<<i}function o(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");const e=n%t;return e<0n?e+t:e}function i(n,t){const r=e(o(n,t),t);if(1n!==r.g)throw new RangeError(`${n.toString()} does not have inverse modulo ${t.toString()}`);return o(r.x,t)}n.abs=t,n.bitLength=function(n){if("number"==typeof n&&(n=BigInt(n)),1n===n)return 1;let t=1;do{t++}while((n>>=1n)>1n);return t},n.eGcd=e,n.gcd=r,n.lcm=function(n,e){return"number"==typeof n&&(n=BigInt(n)),"number"==typeof e&&(e=BigInt(e)),0n===n&&0n===e?BigInt(0):t(n/r(n,e)*e)},n.max=function(n,t){return n>=t?n:t},n.min=function(n,t){return n>=t?t:n},n.modInv=i,n.modPow=function n(e,r,f){if("number"==typeof e&&(e=BigInt(e)),"number"==typeof r&&(r=BigInt(r)),"number"==typeof f&&(f=BigInt(f)),f<=0n)throw new RangeError("n must be > 0");if(1n===f)return 0n;if(e=o(e,f),r<0n)return i(n(e,t(r),f),f);let u=1n;for(;r>0;)r%2n===1n&&(u=u*e%f),r/=2n,e=e**2n%f;return u},n.toZn=o}));
|
|
|
@ -1,2 +0,0 @@
|
||||||
"use strict";function n(n){return n>=0?n:-n}function t(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),n<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,e=1n,o=1n,i=0n;for(;0n!==n;){const u=t/n,f=t%n,g=r-o*u,p=e-i*u;t=n,n=f,r=o,e=i,o=g,i=p}return{g:t,x:r,y:e}}function r(t,r){let e="number"==typeof t?BigInt(n(t)):n(t),o="number"==typeof r?BigInt(n(r)):n(r);if(0n===e)return o;if(0n===o)return e;let i=0n;for(;0n===(1n&(e|o));)e>>=1n,o>>=1n,i++;for(;0n===(1n&e);)e>>=1n;do{for(;0n===(1n&o);)o>>=1n;if(e>o){const n=e;e=o,o=n}o-=e}while(0n!==o);return e<<i}function e(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");const r=n%t;return r<0n?r+t:r}function o(n,r){const o=t(e(n,r),r);if(1n!==o.g)throw new RangeError(`${n.toString()} does not have inverse modulo ${r.toString()}`);return e(o.x,r)}exports.abs=n,exports.bitLength=function(n){if("number"==typeof n&&(n=BigInt(n)),1n===n)return 1;let t=1;do{t++}while((n>>=1n)>1n);return t},exports.eGcd=t,exports.gcd=r,exports.lcm=function(t,e){return"number"==typeof t&&(t=BigInt(t)),"number"==typeof e&&(e=BigInt(e)),0n===t&&0n===e?BigInt(0):n(t/r(t,e)*e)},exports.max=function(n,t){return n>=t?n:t},exports.min=function(n,t){return n>=t?t:n},exports.modInv=o,exports.modPow=function t(r,i,u){if("number"==typeof r&&(r=BigInt(r)),"number"==typeof i&&(i=BigInt(i)),"number"==typeof u&&(u=BigInt(u)),u<=0n)throw new RangeError("n must be > 0");if(1n===u)return 0n;if(r=e(r,u),i<0n)return o(t(r,n(i),u),u);let f=1n;for(;i>0;)i%2n===1n&&(f=f*r%u),i/=2n,r=r**2n%u;return f},exports.toZn=e;
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubm9kZS5janMiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cy9hYnMudHMiLCIuLi8uLi9zcmMvdHMvZWdjZC50cyIsIi4uLy4uL3NyYy90cy9nY2QudHMiLCIuLi8uLi9zcmMvdHMvdG9abi50cyIsIi4uLy4uL3NyYy90cy9tb2RJbnYudHMiLCIuLi8uLi9zcmMvdHMvYml0TGVuZ3RoLnRzIiwiLi4vLi4vc3JjL3RzL2xjbS50cyIsIi4uLy4uL3NyYy90cy9tYXgudHMiLCIuLi8uLi9zcmMvdHMvbWluLnRzIiwiLi4vLi4vc3JjL3RzL21vZFBvdy50cyJdLCJzb3VyY2VzQ29udGVudCI6bnVsbCwibmFtZXMiOlsiYWJzIiwiYSIsImVHY2QiLCJiIiwiQmlnSW50IiwiUmFuZ2VFcnJvciIsIngiLCJ5IiwidSIsInYiLCJxIiwiciIsIm0iLCJuIiwiZyIsImd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sTUFIaUIsaUJBQU5GLElBQWdCQSxFQUFJRyxPQUFPSCxJQUNyQixpQkFBTkUsSUFBZ0JBLEVBQUlDLE9BQU9ELElBRTVCLEtBQU5GLEdBQWtCLEtBQU5FLEVBQWlCQyxPQUFPLEdBRWpDSixFQUFLQyxFQUFJYyxFQUFJZCxFQUFHRSxHQUFNQSxFQUMvQixjQ1JnQixTQUFLRixFQUFvQkUsR0FDdkMsT0FBUUYsR0FBS0UsRUFBS0YsRUFBSUUsQ0FDeEIsY0NGZ0IsU0FBS0YsRUFBb0JFLEdBQ3ZDLE9BQVFGLEdBQUtFLEVBQUtBLEVBQUlGLENBQ3hCLDJDQ0lnQndCLEVBQVF0QixFQUFvQnVCLEVBQW9CYixHQUs5RCxHQUppQixpQkFBTlYsSUFBZ0JBLEVBQUlDLE9BQU9ELElBQ3JCLGlCQUFOdUIsSUFBZ0JBLEVBQUl0QixPQUFPc0IsSUFDckIsaUJBQU5iLElBQWdCQSxFQUFJVCxPQUFPUyxJQUVsQ0EsR0FBSyxHQUNQLE1BQU0sSUFBSVIsV0FBVyxpQkFDaEIsR0FBVSxLQUFOUSxFQUNULE9BQU8sR0FLVCxHQUZBVixFQUFJZ0IsRUFBS2hCLEVBQUdVLEdBRVJhLEVBQUksR0FDTixPQUFPTCxFQUFPSSxFQUFPdEIsRUFBR0gsRUFBSTBCLEdBQUliLEdBQUlBLEdBR3RDLElBQUlGLEVBQUksR0FDUixLQUFPZSxFQUFJLEdBQ0pBLEVBQUksS0FBUSxLQUNmZixFQUFJQSxFQUFJUixFQUFJVSxHQUVkYSxHQUFRLEdBQ1J2QixFQUFJQSxHQUFLLEdBQUtVLEVBRWhCLE9BQU9GLENBQ1QifQ==
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
function n(n){return n>=0?n:-n}function t(n){if("number"==typeof n&&(n=BigInt(n)),1n===n)return 1;let t=1;do{t++}while((n>>=1n)>1n);return t}function r(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),n<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,e=1n,o=1n,u=0n;for(;0n!==n;){const i=t/n,f=t%n,g=r-o*i,b=e-u*i;t=n,n=f,r=o,e=u,o=g,u=b}return{g:t,x:r,y:e}}function e(t,r){let e="number"==typeof t?BigInt(n(t)):n(t),o="number"==typeof r?BigInt(n(r)):n(r);if(0n===e)return o;if(0n===o)return e;let u=0n;for(;0n===(1n&(e|o));)e>>=1n,o>>=1n,u++;for(;0n===(1n&e);)e>>=1n;do{for(;0n===(1n&o);)o>>=1n;if(e>o){const n=e;e=o,o=n}o-=e}while(0n!==o);return e<<u}function o(t,r){return"number"==typeof t&&(t=BigInt(t)),"number"==typeof r&&(r=BigInt(r)),0n===t&&0n===r?BigInt(0):n(t/e(t,r)*r)}function u(n,t){return n>=t?n:t}function i(n,t){return n>=t?t:n}function f(n,t){if("number"==typeof n&&(n=BigInt(n)),"number"==typeof t&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");const r=n%t;return r<0n?r+t:r}function g(n,t){const e=r(f(n,t),t);if(1n!==e.g)throw new RangeError(`${n.toString()} does not have inverse modulo ${t.toString()}`);return f(e.x,t)}function b(t,r,e){if("number"==typeof t&&(t=BigInt(t)),"number"==typeof r&&(r=BigInt(r)),"number"==typeof e&&(e=BigInt(e)),e<=0n)throw new RangeError("n must be > 0");if(1n===e)return 0n;if(t=f(t,e),r<0n)return g(b(t,n(r),e),e);let o=1n;for(;r>0;)r%2n===1n&&(o=o*t%e),r/=2n,t=t**2n%e;return o}export{n as abs,t as bitLength,r as eGcd,e as gcd,o as lcm,u as max,i as min,g as modInv,b as modPow,f as toZn};
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgubm9kZS5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3RzL2Ficy50cyIsIi4uLy4uL3NyYy90cy9i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VCxPQUFPLEdBS1QsR0FGQVQsRUFBSWtCLEVBQUtsQixFQUFHUyxHQUVSZSxFQUFJLEdBQ04sT0FBT0osRUFBT0csRUFBT3ZCLEVBQUdOLEVBQUk4QixHQUFJZixHQUFJQSxHQUd0QyxJQUFJRixFQUFJLEdBQ1IsS0FBT2lCLEVBQUksR0FDSkEsRUFBSSxLQUFRLEtBQ2ZqQixFQUFJQSxFQUFJUCxFQUFJUyxHQUVkZSxHQUFRLEdBQ1J4QixFQUFJQSxHQUFLLEdBQUtTLEVBRWhCLE9BQU9GLENBQ1QifQ==
|
|
|
@ -1 +0,0 @@
|
||||||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
292
docs/API.md
292
docs/API.md
|
@ -1,292 +0,0 @@
|
||||||
# bigint-mod-arith - v3.2.0
|
|
||||||
|
|
||||||
Some common functions for modular arithmetic using native JS implementation of BigInt
|
|
||||||
|
|
||||||
## Table of contents
|
|
||||||
|
|
||||||
### Interfaces
|
|
||||||
|
|
||||||
- [Egcd](interfaces/Egcd.md)
|
|
||||||
|
|
||||||
### Functions
|
|
||||||
|
|
||||||
- [abs](API.md#abs)
|
|
||||||
- [bitLength](API.md#bitlength)
|
|
||||||
- [eGcd](API.md#egcd)
|
|
||||||
- [gcd](API.md#gcd)
|
|
||||||
- [lcm](API.md#lcm)
|
|
||||||
- [max](API.md#max)
|
|
||||||
- [min](API.md#min)
|
|
||||||
- [modInv](API.md#modinv)
|
|
||||||
- [modPow](API.md#modpow)
|
|
||||||
- [toZn](API.md#tozn)
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
### abs
|
|
||||||
|
|
||||||
▸ **abs**(`a`): `number` \| `bigint`
|
|
||||||
|
|
||||||
Absolute value. abs(a)==a if a>=0. abs(a)==-a if a<0
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`number` \| `bigint`
|
|
||||||
|
|
||||||
The absolute value of a
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[abs.ts:8](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/abs.ts#L8)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### bitLength
|
|
||||||
|
|
||||||
▸ **bitLength**(`a`): `number`
|
|
||||||
|
|
||||||
Returns the (minimum) length of a number expressed in bits.
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`number`
|
|
||||||
|
|
||||||
The bit length
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[bitLength.ts:7](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/bitLength.ts#L7)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### eGcd
|
|
||||||
|
|
||||||
▸ **eGcd**(`a`, `b`): [`Egcd`](interfaces/Egcd.md)
|
|
||||||
|
|
||||||
An iterative implementation of the extended euclidean algorithm or extended greatest common divisor algorithm.
|
|
||||||
Take positive integers a, b as input, and return a triple (g, x, y), such that ax + by = g = gcd(a, b).
|
|
||||||
|
|
||||||
**`Throws`**
|
|
||||||
|
|
||||||
RangeError if a or b are <= 0
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
| `b` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
[`Egcd`](interfaces/Egcd.md)
|
|
||||||
|
|
||||||
A triple (g, x, y), such that ax + by = g = gcd(a, b).
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[egcd.ts:17](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/egcd.ts#L17)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### gcd
|
|
||||||
|
|
||||||
▸ **gcd**(`a`, `b`): `bigint`
|
|
||||||
|
|
||||||
Greatest common divisor of two integers based on the iterative binary algorithm.
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
| `b` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`bigint`
|
|
||||||
|
|
||||||
The greatest common divisor of a and b
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[gcd.ts:10](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/gcd.ts#L10)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### lcm
|
|
||||||
|
|
||||||
▸ **lcm**(`a`, `b`): `bigint`
|
|
||||||
|
|
||||||
The least common multiple computed as abs(a*b)/gcd(a,b)
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
| `b` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`bigint`
|
|
||||||
|
|
||||||
The least common multiple of a and b
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[lcm.ts:10](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/lcm.ts#L10)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### max
|
|
||||||
|
|
||||||
▸ **max**(`a`, `b`): `number` \| `bigint`
|
|
||||||
|
|
||||||
Maximum. max(a,b)==a if a>=b. max(a,b)==b if a<b
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
| `b` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`number` \| `bigint`
|
|
||||||
|
|
||||||
Maximum of numbers a and b
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[max.ts:9](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/max.ts#L9)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### min
|
|
||||||
|
|
||||||
▸ **min**(`a`, `b`): `number` \| `bigint`
|
|
||||||
|
|
||||||
Minimum. min(a,b)==b if a>=b. min(a,b)==a if a<b
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type |
|
|
||||||
| :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` |
|
|
||||||
| `b` | `number` \| `bigint` |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`number` \| `bigint`
|
|
||||||
|
|
||||||
Minimum of numbers a and b
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[min.ts:9](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/min.ts#L9)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### modInv
|
|
||||||
|
|
||||||
▸ **modInv**(`a`, `n`): `bigint`
|
|
||||||
|
|
||||||
Modular inverse.
|
|
||||||
|
|
||||||
**`Throws`**
|
|
||||||
|
|
||||||
RangeError if a does not have inverse modulo n
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| :------ | :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` | The number to find an inverse for |
|
|
||||||
| `n` | `number` \| `bigint` | The modulo |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`bigint`
|
|
||||||
|
|
||||||
The inverse modulo n
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[modInv.ts:13](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/modInv.ts#L13)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### modPow
|
|
||||||
|
|
||||||
▸ **modPow**(`b`, `e`, `n`): `bigint`
|
|
||||||
|
|
||||||
Modular exponentiation b**e mod n. Currently using the right-to-left binary method
|
|
||||||
|
|
||||||
**`Throws`**
|
|
||||||
|
|
||||||
RangeError if n <= 0
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| :------ | :------ | :------ |
|
|
||||||
| `b` | `number` \| `bigint` | base |
|
|
||||||
| `e` | `number` \| `bigint` | exponent |
|
|
||||||
| `n` | `number` \| `bigint` | modulo |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`bigint`
|
|
||||||
|
|
||||||
b**e mod n
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[modPow.ts:15](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/modPow.ts#L15)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### toZn
|
|
||||||
|
|
||||||
▸ **toZn**(`a`, `n`): `bigint`
|
|
||||||
|
|
||||||
Finds the smallest positive element that is congruent to a in modulo n
|
|
||||||
|
|
||||||
**`Remarks`**
|
|
||||||
|
|
||||||
a and b must be the same type, either number or bigint
|
|
||||||
|
|
||||||
**`Throws`**
|
|
||||||
|
|
||||||
RangeError if n <= 0
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| :------ | :------ | :------ |
|
|
||||||
| `a` | `number` \| `bigint` | An integer |
|
|
||||||
| `n` | `number` \| `bigint` | The modulo |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
`bigint`
|
|
||||||
|
|
||||||
A bigint with the smallest positive representation of a modulo n
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[toZn.ts:14](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/toZn.ts#L14)
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Interface: Egcd
|
|
||||||
|
|
||||||
## Table of contents
|
|
||||||
|
|
||||||
### Properties
|
|
||||||
|
|
||||||
- [g](Egcd.md#g)
|
|
||||||
- [x](Egcd.md#x)
|
|
||||||
- [y](Egcd.md#y)
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
### g
|
|
||||||
|
|
||||||
• **g**: `bigint`
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[egcd.ts:2](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/egcd.ts#L2)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### x
|
|
||||||
|
|
||||||
• **x**: `bigint`
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[egcd.ts:3](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/egcd.ts#L3)
|
|
||||||
|
|
||||||
___
|
|
||||||
|
|
||||||
### y
|
|
||||||
|
|
||||||
• **y**: `bigint`
|
|
||||||
|
|
||||||
#### Defined in
|
|
||||||
|
|
||||||
[egcd.ts:4](https://github.com/juanelas/bigint-mod-arith/blob/1f18626/src/ts/egcd.ts#L4)
|
|
|
@ -22,15 +22,16 @@
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
"chai": "^4.3.3",
|
"chai": "^4.3.3",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"glob": "^9.3.4",
|
"glob": "^10.0.0",
|
||||||
"json5": "^2.2.0",
|
"json5": "^2.2.0",
|
||||||
"minimatch": "^8.0.3",
|
"minimatch": "^9.0.0",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"puppeteer": "^19.1.2",
|
"puppeteer": "^19.1.2",
|
||||||
"rimraf": "^4.4.1",
|
"rimraf": "^5.0.0",
|
||||||
"rollup": "^3.20.2",
|
"rollup": "^3.20.2",
|
||||||
|
"rollup-plugin-dts": "^5.3.0",
|
||||||
"ts-standard": "^12.0.2",
|
"ts-standard": "^12.0.2",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typedoc": "~0.23.0",
|
"typedoc": "~0.23.0",
|
||||||
|
@ -395,9 +396,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@puppeteer/browsers": {
|
"node_modules/@puppeteer/browsers": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-0.4.1.tgz",
|
||||||
"integrity": "sha512-3iB5pWn9Sr55PKKwqFWSWjLsTKCOEhKNI+uV3BZesgXuA3IhsX8I3hW0HI+3ksMIPkh2mVYzKSpvgq3oicjG2Q==",
|
"integrity": "sha512-4IICvy1McAkT/HyNZHIs7sp8ngBX1dmO0TPQ+FWq9ATQMqI8p+Ulm5A3kS2wYDh5HDHHkYrrETOu6rlj64VuTw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
|
@ -466,9 +467,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/plugin-commonjs": {
|
"node_modules/@rollup/plugin-commonjs": {
|
||||||
"version": "24.0.1",
|
"version": "24.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.1.0.tgz",
|
||||||
"integrity": "sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow==",
|
"integrity": "sha512-eSL45hjhCWI0jCCXcNtLVqM5N1JlBGvlFfY0m6oOYnLCJ6N0qEXoZql4sY2MOUArzhH4SA/qBpTxvvZp2Sc+DQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rollup/pluginutils": "^5.0.1",
|
"@rollup/pluginutils": "^5.0.1",
|
||||||
|
@ -2966,15 +2967,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "9.3.5",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-10.0.0.tgz",
|
||||||
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
|
"integrity": "sha512-zmp9ZDC6NpDNLujV2W2n+3lH+BafIVZ4/ct+Yj3BMZTH/+bgm/eVjHzeFLwxJrrIGgjjS2eiQLlpurHsNlEAtQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs.realpath": "^1.0.0",
|
"fs.realpath": "^1.0.0",
|
||||||
"minimatch": "^8.0.2",
|
"minimatch": "^9.0.0",
|
||||||
"minipass": "^4.2.4",
|
"minipass": "^5.0.0",
|
||||||
"path-scurry": "^1.6.1"
|
"path-scurry": "^1.6.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16 || 14 >=14.17"
|
"node": ">=16 || 14 >=14.17"
|
||||||
|
@ -3977,9 +3978,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "8.0.4",
|
"version": "9.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz",
|
||||||
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
|
"integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^2.0.1"
|
"brace-expansion": "^2.0.1"
|
||||||
|
@ -4001,9 +4002,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minipass": {
|
"node_modules/minipass": {
|
||||||
"version": "4.2.7",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||||
"integrity": "sha512-ScVIgqHcXRMyfflqHmEW0bm8z8rb5McHyOY3ewX9JBgZaR77G7nxq9L/mtV96/QbAAwtbCAHVVLzD1kkyfFQEw==",
|
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
|
@ -4675,15 +4676,6 @@
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-scurry/node_modules/minipass": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/path-type": {
|
"node_modules/path-type": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
||||||
|
@ -4915,27 +4907,27 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/puppeteer": {
|
"node_modules/puppeteer": {
|
||||||
"version": "19.8.5",
|
"version": "19.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.8.5.tgz",
|
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.9.0.tgz",
|
||||||
"integrity": "sha512-WSjouU7eux6cwBMEz4A7mDRVZWTQQTDXrb1R6AhKDdeEgpiBBkAzcAusPhILxiJOKj60rULZpWuCZ7HZIO6GTA==",
|
"integrity": "sha512-JDx8WwGlkdQYTaa3OMYDF+uFWimiwNnacg5FGEC5J6+VxDsLK30wHKU/Db2LqEhtAoIu4RwS+BRH4zRPlCsFpA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "0.4.0",
|
"@puppeteer/browsers": "0.4.1",
|
||||||
"cosmiconfig": "8.1.3",
|
"cosmiconfig": "8.1.3",
|
||||||
"https-proxy-agent": "5.0.1",
|
"https-proxy-agent": "5.0.1",
|
||||||
"progress": "2.0.3",
|
"progress": "2.0.3",
|
||||||
"proxy-from-env": "1.1.0",
|
"proxy-from-env": "1.1.0",
|
||||||
"puppeteer-core": "19.8.5"
|
"puppeteer-core": "19.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/puppeteer-core": {
|
"node_modules/puppeteer-core": {
|
||||||
"version": "19.8.5",
|
"version": "19.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.8.5.tgz",
|
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.9.0.tgz",
|
||||||
"integrity": "sha512-zoGhim/oBQbkND6h4Xz4X7l5DkWVH9wH7z0mVty5qa/c0P1Yad47t/npVtt2xS10BiQwzztWKx7Pa2nJ5yykdw==",
|
"integrity": "sha512-IJYfCE0oFpi5dTvNFqOwo8Dey6zzx7hANy7z6K2bjpCux9oPOSOIubq40awNhaHlfi8soYtgU4qabnzMXB7xBQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "0.4.0",
|
"@puppeteer/browsers": "0.4.1",
|
||||||
"chromium-bidi": "0.4.6",
|
"chromium-bidi": "0.4.6",
|
||||||
"cross-fetch": "3.1.5",
|
"cross-fetch": "3.1.5",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
|
@ -5121,12 +5113,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rimraf": {
|
"node_modules/rimraf": {
|
||||||
"version": "4.4.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.0.tgz",
|
||||||
"integrity": "sha512-Gk8NlF062+T9CqNGn6h4tls3k6T1+/nXdOcSZVikNVtlRdYpA7wRJJMoXmuvOnLW844rPjdQ7JgXCYM6PPC/og==",
|
"integrity": "sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"glob": "^9.2.0"
|
"glob": "^10.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"rimraf": "dist/cjs/src/bin.js"
|
"rimraf": "dist/cjs/src/bin.js"
|
||||||
|
@ -5154,6 +5146,40 @@
|
||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rollup-plugin-dts": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"magic-string": "^0.30.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=v14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/Swatinem"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@babel/code-frame": "^7.18.6"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"rollup": "^3.0.0",
|
||||||
|
"typescript": "^4.1 || ^5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rollup-plugin-dts/node_modules/magic-string": {
|
||||||
|
"version": "0.30.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz",
|
||||||
|
"integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/sourcemap-codec": "^1.4.13"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/run-parallel": {
|
"node_modules/run-parallel": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||||
|
|
58
package.json
58
package.json
|
@ -24,46 +24,50 @@
|
||||||
"node": ">=10.4.0"
|
"node": ">=10.4.0"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/cjs/index.node.cjs",
|
"main": "./dist/index.node.cjs",
|
||||||
"types": "./types/index.d.cts",
|
"browser": "./dist/index.browser.esm.js",
|
||||||
"browser": "./dist/esm/index.browser.js",
|
"types": "./dist/index.d.ts",
|
||||||
"module": "./dist/esm/index.node.js",
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"node": {
|
"node": {
|
||||||
"require": {
|
"module": {
|
||||||
"default": "./dist/cjs/index.node.cjs",
|
"types": "./dist/index.d.ts",
|
||||||
"types": "./types/index.d.cts"
|
"default": "./dist/index.node.esm.js"
|
||||||
},
|
},
|
||||||
"import": {
|
"import": {
|
||||||
"default": "./dist/esm/index.node.js",
|
"types": "./dist/index.d.ts",
|
||||||
"types": "./types/index.d.ts"
|
"default": "./dist/index.node.esm.js"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"default": "./dist/index.node.cjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"script": "./dist/bundle.iife.js",
|
||||||
"default": {
|
"default": {
|
||||||
"default": "./dist/esm/index.browser.js",
|
"types": "./dist/index.d.ts",
|
||||||
"types": "./types/index.d.ts"
|
"default": "./dist/index.browser.esm.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"./esm-browser-bundle": "./dist/bundles/esm.min.js",
|
"./esm-browser-bundle": "./dist/bundle.esm.min.js",
|
||||||
"./esm-browser-bundle-nomin": "./dist/bundles/esm.js",
|
"./esm-browser-bundle-nomin": "./dist/bundle.esm.js",
|
||||||
"./iife-browser-bundle": "./dist/bundles/iife.js",
|
"./iife-browser-bundle": "./dist/bundle.iife.js",
|
||||||
"./umd-browser-bundle": "./dist/bundles/umd.js",
|
"./umd-browser-bundle": "./dist/bundle.umd.js",
|
||||||
"./types": "./types/index.d.cts"
|
"./types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
"#pkg": {
|
"#pkg": {
|
||||||
"require": {
|
"require": {
|
||||||
"default": "./dist/cjs/index.node.cjs",
|
"types": "./dist/index.d.ts",
|
||||||
"types": "./types/index.d.cts"
|
"default": "./dist/index.node.cjs"
|
||||||
},
|
},
|
||||||
"import": {
|
"import": {
|
||||||
"default": "./dist/esm/index.node.js",
|
"types": "./dist/index.d.ts",
|
||||||
"types": "./types/index.d.ts"
|
"default": "./dist/index.node.esm.js"
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"default": "./dist/esm/index.browser.js",
|
"types": "./dist/esm/index.d.ts",
|
||||||
"types": "./types/index.d.ts"
|
"default": "./dist/index.browser.esm.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -79,7 +83,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-s lint:src build:js lint:test docs",
|
"build": "run-s lint:src build:js lint:test docs",
|
||||||
"build:js": "rollup -c build/rollup.config.js",
|
"build:js": "rollup -c build/rollup.config.js",
|
||||||
"clean": "rimraf .mocha-ts coverage dist types docs",
|
"postbuild:js": "rimraf .types",
|
||||||
|
"clean": "rimraf .mocha-ts coverage dist .types docs",
|
||||||
"coverage": "c8 --clean --check-coverage --exclude \"{src/ts/**/*.spec.ts,test,test-vectors,build}\" --exclude-after-remap --reporter=text --reporter=lcov node ./build/bin/mocha-ts.cjs --commonjs ",
|
"coverage": "c8 --clean --check-coverage --exclude \"{src/ts/**/*.spec.ts,test,test-vectors,build}\" --exclude-after-remap --reporter=text --reporter=lcov node ./build/bin/mocha-ts.cjs --commonjs ",
|
||||||
"docs": "node build/build.docs.cjs",
|
"docs": "node build/build.docs.cjs",
|
||||||
"git:add": "git add -A",
|
"git:add": "git add -A",
|
||||||
|
@ -143,15 +148,16 @@
|
||||||
"c8": "^7.12.0",
|
"c8": "^7.12.0",
|
||||||
"chai": "^4.3.3",
|
"chai": "^4.3.3",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"glob": "^9.3.4",
|
"glob": "^10.0.0",
|
||||||
"json5": "^2.2.0",
|
"json5": "^2.2.0",
|
||||||
"minimatch": "^8.0.3",
|
"minimatch": "^9.0.0",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"puppeteer": "^19.1.2",
|
"puppeteer": "^19.1.2",
|
||||||
"rimraf": "^4.4.1",
|
"rimraf": "^5.0.0",
|
||||||
"rollup": "^3.20.2",
|
"rollup": "^3.20.2",
|
||||||
|
"rollup-plugin-dts": "^5.3.0",
|
||||||
"ts-standard": "^12.0.2",
|
"ts-standard": "^12.0.2",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typedoc": "~0.23.0",
|
"typedoc": "~0.23.0",
|
||||||
|
|
Loading…
Reference in New Issue