Coder Social home page Coder Social logo

sapphiredev / type Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 2.0 13.84 MB

A type detection utility for JavaScript

Home Page: https://www.sapphirejs.dev/

License: MIT License

TypeScript 71.16% Python 3.59% C++ 9.57% JavaScript 15.69%
sapphire type typescript javascript internals hacktoberfest

type's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar depfu[bot] avatar favna avatar github-actions[bot] avatar lioness100 avatar pyrotechniac avatar realshadownova avatar renovate[bot] avatar vladfrangu avatar voltrexkeyva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

type's Issues

request: musl 1.2.4 support for Alpine 3.18 users

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

The prebuilt binaries do not include musl 1.2.4, which is used by Alpine 3.18. I believe this was just recently released (start of June if I'm correct) so that's why there is no prebuilt for musl (last release of this package was on April).

I checked #429 and the solution seems to be to use Yarn, but it didn't mention that it required Python to be installed in the Docker image. I had to add the following line to my Dockerfile as suggested here:

RUN apk add --no-cache libc6-compat python3 build-base gcc

Desired solution

Prebuilt binaries for musl 1.2.4 in releases would prevent users from having to install Python into the Docker build image.

I know I can use multi-stage builds to remove Python from the final image -- I'm using that for my image. But having the prebuilt for musl could reduce build times.

Alternatives considered

Building manually works with Yarn and Python installed in the Docker build image.

Additional context

Here's the log generated from the failed build by node-pre-gyp when I didn't have Python installed, just in case it is needed:

build.log
# This file contains the result of Yarn building a package (@sapphire/type@npm:2.4.0)
# Script name: install

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp info check checked for "/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4/type.node" (not found)
node-pre-gyp http GET https://github.com/sapphiredev/type/releases/download/v2.4.0/type-v2.4.0-node-v108-linux-x64-musl-1.2.4.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/sapphiredev/type/releases/download/v2.4.0/type-v2.4.0-node-v108-linux-x64-musl-1.2.4.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for @sapphire/[email protected] and [email protected] (node-v108 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/sapphiredev/type/releases/download/v2.4.0/type-v2.4.0-node-v108-linux-x64-musl-1.2.4.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/app/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/app/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/app/node_modules/node-gyp/lib/find-python.js:202:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/app/node_modules/node-gyp/lib/find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Linux 5.15.90.1-microsoft-standard-WSL2
gyp ERR! command "/usr/local/bin/node" "/app/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4/type.node" "--module_name=type" "--module_path=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
gyp ERR! cwd /app/node_modules/@sapphire/type
gyp ERR! node -v v18.16.1
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4/type.node --module_name=type --module_path=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/@discordjs/node-pre-gyp/lib/util/compile.js:85:20)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Linux 5.15.90.1-microsoft-standard-WSL2
node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/@discordjs/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /app/node_modules/@sapphire/type
node-pre-gyp ERR! node -v v18.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.4.5
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4/type.node --module_name=type --module_path=/app/node_modules/@sapphire/type/prebuild/type-node-v108-linux-x64-musl-1.2.4 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

bug: Error when getting output type of "require('discord.js')"

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Only seems to happen when requiring discord.js and evaluating the output of it using the Type class. So I doubt you would want to fix it. Just thought I'd make a bug report just in case.

Example code includes

const { Type } = require('@sapphire/type');
const DJS = require('discord.js');
const output = new Type(DJS);
output.toString();

Will cause the error.

TypeError: Cannot read properties of null (reading 'name')
     at Function.resolve (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:152:2)
     at new Type (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:60:13)
     at _Type.addValue (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:102:25)
     at _Type.addEntry (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:112:30)
     at _Type.check (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:134:2)
     at _Type.toString (/opt/stratobotelite/node_modules/@sapphire/type/src/lib/index.ts:77:7)
     at Function.codeBlock (/opt/stratobotelite/src/frameworks/klasa/lib/util/util.js:41:42)
     at module.exports.run (/opt/stratobotelite/src/bot/commands/Admin/eval.js:138:23)
     at processTicksAndRejections (node:internal/process/task_queues:95:5)
     at async module.exports.runCommand (/opt/stratobotelite/src/bot/monitors/commandHandler.js:75:23)

Steps To Reproduce

const { Type } = require('@sapphire/type');
const DJS = require('discord.js');
const output = new Type(DJS);
output.toString();

Expected behavior

Wasn't expected to error.

Screenshots

image
image

Additional context

No response

System Info

System:
    OS: Linux 4.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (4) x64 Intel Core Processor (Haswell, no TSX)
    Memory: 6.34 GB / 7.60 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 21.7.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.0 - /usr/local/bin/npm

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update all non-major dependencies to ^2.0.3 (@vitest/coverage-v8, vitest)

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/auto-deprecate.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/ci-build-and-test.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
.github/workflows/ci-lint-and-docs.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/continuous-delivery.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/deprecate-on-merge.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/documentation.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/download-artifact v4
  • actions/checkout v4
  • nick-fields/retry v3
.github/workflows/labelsync.yml
  • actions/checkout v4
  • crazy-max/ghaction-github-labeler v5
.github/workflows/manual-asset-updater.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
.github/workflows/publish.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/release-updater.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • kludge-cs/gitcord-release-changelogger v3.0.0@5592170408dc081d7cb6a74ce025911bd1fcb7c3
npm
package.json
  • @discordjs/node-pre-gyp ^0.4.5
  • nan ^2.20.0
  • tslib ^2.6.3
  • @actions/core ^1.10.1
  • @actions/github ^6.0.0
  • @actions/glob ^0.4.0
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @favware/cliff-jumper ^4.0.2
  • @favware/npm-deprecate ^1.0.7
  • @sapphire/eslint-config ^5.0.5
  • @sapphire/prettier-config ^2.0.0
  • @sapphire/ts-config ^5.0.1
  • @types/node ^20.14.10
  • @vitest/coverage-v8 ^2.0.2
  • cz-conventional-changelog ^3.3.0
  • discord.js ^14.15.3
  • eslint ^8.57.0
  • eslint-config-prettier ^9.1.0
  • eslint-plugin-prettier ^5.1.3
  • lint-staged ^15.2.7
  • prettier ^3.3.3
  • tsup ^8.1.0
  • vite ^5.3.3
  • vitest ^2.0.2
  • ansi-regex ^5.0.1
  • minimist ^1.2.8
  • yarn 4.3.1

  • Check this box to trigger a request for Renovate to run again on this repository

request: glibc 2.28 support for AlmaLinux 8.7 users

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

The prebuilt binaries released do not include ones for glibc 2.28, which is used in AlmaLinux 8.7 (CentOS replacement). Therefore, Sapphire cannot run on an AlmaLinux 8.7 system without manually building it (which is very tedious considering this package is often a dependency and used within a package manager, which fails because it could not find a prebuilt for glibc 2.28 to download).

Desired solution

Prebuilt binaries for glibc 2.28 in releases.

Alternatives considered

Building manually; very tedious and not worth the amount of effort necessary, especially for every new release.

Using a different version of glibc; also very tedious when AlmaLinux is basically set to use 2.28 by default. Even AlmaLinux 9 uses 2.34, which is also not included in prebuilt binaries.

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.