chore: reduce published size
This commit is contained in:
parent
382e824b39
commit
0c3918df24
10 changed files with 39 additions and 1331 deletions
|
@ -12,3 +12,4 @@ temp
|
|||
__mock__
|
||||
target
|
||||
scripts
|
||||
triples/index.js
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
target
|
||||
node_modules
|
||||
scripts
|
||||
triples/index.js
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
const { readFileSync, writeFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
const esbuild = require('esbuild')
|
||||
const { groupBy, mapValues } = require('lodash')
|
||||
const prettier = require('prettier')
|
||||
|
||||
const { parseTriple } = require('./cli/scripts/parse-triple')
|
||||
|
||||
const rawLists = readFileSync(join(__dirname, 'triples', 'target-list'), 'utf8')
|
||||
const RAW_LIST = readFileSync(join(__dirname, 'triples', 'target-list'), 'utf8')
|
||||
|
||||
const tripleLists = rawLists
|
||||
.trim()
|
||||
const SUPPORTED_PLATFORM = new Set([
|
||||
'darwin',
|
||||
'ios',
|
||||
'android',
|
||||
'win32',
|
||||
'linux',
|
||||
'freebsd',
|
||||
])
|
||||
|
||||
const tripleLists = RAW_LIST.trim()
|
||||
.split('\n')
|
||||
.filter((line) => !line.startsWith('wasm') && line.trim().length)
|
||||
.map(parseTriple)
|
||||
|
@ -19,22 +27,22 @@ const tripleLists = rawLists
|
|||
}, {})
|
||||
|
||||
const platformArchTriples = mapValues(
|
||||
groupBy([...Object.values(tripleLists)], 'platform'),
|
||||
groupBy(
|
||||
Object.values(tripleLists).filter((k) =>
|
||||
SUPPORTED_PLATFORM.has(k.platform),
|
||||
),
|
||||
'platform',
|
||||
),
|
||||
(v) => groupBy(v, 'arch'),
|
||||
)
|
||||
|
||||
const fileContent = `
|
||||
module.exports = ${JSON.stringify(tripleLists, null, 2)}
|
||||
|
||||
module.exports.platformArchTriples = ${JSON.stringify(platformArchTriples)}
|
||||
`
|
||||
|
||||
writeFileSync(
|
||||
join(__dirname, 'triples', 'index.js'),
|
||||
prettier.format(fileContent, {
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
parser: 'typescript',
|
||||
}),
|
||||
esbuild.transformSync(fileContent, {
|
||||
minify: true,
|
||||
}).code,
|
||||
)
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
"benny": "^3.6.15",
|
||||
"c8": "^7.7.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "^0.12.15",
|
||||
"eslint": "^7.31.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# `@napi-rs/triples`
|
||||
|
||||
[![install size](https://packagephobia.com/badge?p=@napi-rs/triples)](https://packagephobia.com/result?p=@napi-rs/triples)
|
||||
[![Downloads](https://img.shields.io/npm/dm/@napi-rs/triples.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/triples?minimal=true)
|
||||
|
||||
> Rust build triples definitions
|
||||
|
||||
## Usage
|
||||
|
|
6
triples/index.d.ts
vendored
6
triples/index.d.ts
vendored
|
@ -6,12 +6,8 @@ interface Triple {
|
|||
raw: string
|
||||
}
|
||||
|
||||
declare const Triples: Triple[] & {
|
||||
platformArchTriples: {
|
||||
export const platformArchTriples: {
|
||||
[index: string]: {
|
||||
[index: string]: Triple[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = Triples
|
||||
|
|
1310
triples/index.js
1310
triples/index.js
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@
|
|||
"registry": "https://registry.npmjs.org/",
|
||||
"access": "public"
|
||||
},
|
||||
"files": ["index.js", "index.d.ts", "target-list"],
|
||||
"files": ["index.js", "index.d.ts"],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/napi-rs/napi-rs.git"
|
||||
|
|
|
@ -72,9 +72,9 @@ x86_64-apple-ios
|
|||
x86_64-fortanix-unknown-sgx
|
||||
x86_64-fuchsia
|
||||
x86_64-linux-android
|
||||
x86_64-pc-solaris
|
||||
x86_64-pc-windows-gnu
|
||||
x86_64-pc-windows-msvc
|
||||
x86_64-rumprun-netbsd
|
||||
x86_64-sun-solaris
|
||||
x86_64-unknown-freebsd
|
||||
x86_64-unknown-illumos
|
||||
|
|
|
@ -2604,6 +2604,11 @@ es-to-primitive@^1.2.1:
|
|||
is-date-object "^1.0.1"
|
||||
is-symbol "^1.0.2"
|
||||
|
||||
esbuild@^0.12.15:
|
||||
version "0.12.15"
|
||||
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.12.15.tgz#9d99cf39aeb2188265c5983e983e236829f08af0"
|
||||
integrity sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==
|
||||
|
||||
escalade@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
|
||||
|
@ -4441,6 +4446,7 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2:
|
|||
resolved "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a"
|
||||
integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ==
|
||||
dependencies:
|
||||
encoding "^0.1.12"
|
||||
minipass "^3.1.0"
|
||||
minipass-sized "^1.0.3"
|
||||
minizlib "^2.0.0"
|
||||
|
|
Loading…
Reference in a new issue